mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-07 21:00:30 -06:00
forbid adding the federated users as members of the space via items invite
This commit is contained in:
6
changelog/unreleased/fix-ocm-space-sharing.md
Normal file
6
changelog/unreleased/fix-ocm-space-sharing.md
Normal file
@@ -0,0 +1,6 @@
|
||||
Bugfix: Forbid the ocm space sharing
|
||||
|
||||
We forbid adding the federated users as members of the space via items invite.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/10287
|
||||
https://github.com/owncloud/ocis/issues/10051
|
||||
@@ -173,6 +173,9 @@ func (s DriveItemPermissionsService) Invite(ctx context.Context, resourceId *sto
|
||||
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")
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
s.logger.Debug().Err(err).Interface("userId", objectID).Msg("failed user lookup")
|
||||
@@ -325,14 +328,6 @@ 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.InvalidRequest, "federated user can not become a space member")
|
||||
}
|
||||
}
|
||||
|
||||
rootResourceID := space.GetRoot()
|
||||
return s.Invite(ctx, rootResourceID, invite)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user