Skip to content

Commit

Permalink
add check lightweight account method
Browse files Browse the repository at this point in the history
  • Loading branch information
gmgigi96 committed Oct 11, 2022
1 parent e1a4817 commit 79ee54c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package utils

import (
"context"
"fmt"
"math/rand"
"net"
Expand All @@ -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"
Expand Down Expand Up @@ -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
}

0 comments on commit 79ee54c

Please sign in to comment.