From 79ee54c91e8ae0ad25fa98e5105f8a787bfc6208 Mon Sep 17 00:00:00 2001 From: Gianmaria Del Monte Date: Tue, 11 Oct 2022 13:52:48 +0200 Subject: [PATCH] add check lightweight account method --- pkg/utils/utils.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index 9d675bc61a..d534e0ea66 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -19,6 +19,7 @@ package utils import ( + "context" "fmt" "math/rand" "net" @@ -36,6 +37,7 @@ import ( userpb "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1" + ctxpkg "github.com/cs3org/reva/pkg/ctx" "github.com/cs3org/reva/pkg/registry" "github.com/cs3org/reva/pkg/registry/memory" "github.com/golang/protobuf/proto" @@ -364,3 +366,9 @@ func HasPublicShareRole(u *userpb.User) (string, bool) { } return "", false } + +func IsLightweithAccountInCtx(ctx context.Context) bool { + user := ctxpkg.ContextMustGetUser(ctx) + return user.Id.Type == userpb.UserType_USER_TYPE_FEDERATED || + user.Id.Type == userpb.UserType_USER_TYPE_LIGHTWEIGHT +}