Skip to content

Commit

Permalink
Merge pull request #10510 from rhafer/issue/10488
Browse files Browse the repository at this point in the history
fix(graph/ocm): Fix ocm share creation when user is in cache
  • Loading branch information
kobergj authored Nov 7, 2024
2 parents 72bd8ef + c463559 commit 0b26d45
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions services/graph/pkg/service/v0/api_driveitem_permissions.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,9 @@ func (s DriveItemPermissionsService) Invite(ctx context.Context, resourceId *sto
shareid = createShareResponse.GetShare().GetId().GetOpaqueId()
expiration = createShareResponse.GetShare().GetExpiration()
default:
federated := false
user, err := s.identityCache.GetUser(ctx, objectID)
if errors.Is(err, identity.ErrNotFound) && s.config.IncludeOCMSharees {
user, err = s.identityCache.GetAcceptedUser(ctx, objectID)
federated = true
if err == nil && IsSpaceRoot(statResponse.GetInfo().GetId()) {
return libregraph.Permission{}, errorcode.New(errorcode.InvalidRequest, "federated user can not become a space member")
}
Expand All @@ -189,7 +187,7 @@ func (s DriveItemPermissionsService) Invite(ctx context.Context, resourceId *sto
},
}

if federated {
if user.GetUserType() == identity.UserTypeFederated {
if len(user.Identities) < 1 {
return libregraph.Permission{}, errorcode.New(errorcode.InvalidRequest, "user has no federated identity")
}
Expand Down

0 comments on commit 0b26d45

Please sign in to comment.