prevent adding the federated users as members of the space

This commit is contained in:
Roman Perekhod
2024-09-16 09:39:34 +02:00
parent e40c5be699
commit 9792c45365
2 changed files with 14 additions and 0 deletions
@@ -0,0 +1,6 @@
Bugfix: fix ocm space sharing
We prevent adding the federated users as members of the space.
https://github.com/owncloud/ocis/pull/10060
https://github.com/owncloud/ocis/issues/10051
@@ -325,6 +325,14 @@ func (s DriveItemPermissionsService) SpaceRootInvite(ctx context.Context, driveI
return libregraph.Permission{}, errorcode.New(errorcode.InvalidRequest, "unsupported space type")
}
if s.config.IncludeOCMSharees && len(invite.GetRecipients()) > 0 {
objectID := invite.GetRecipients()[0].GetObjectId()
_, err := s.identityCache.GetAcceptedUser(ctx, objectID)
if err == nil {
return libregraph.Permission{}, errorcode.New(errorcode.NotAllowed, "federated user can not become a space member")
}
}
rootResourceID := space.GetRoot()
return s.Invite(ctx, rootResourceID, invite)
}