From 38f9698973ed6b3f2ab2e2ac9291429bb4577a64 Mon Sep 17 00:00:00 2001 From: Roman Perekhod Date: Mon, 8 Apr 2024 21:53:21 +0200 Subject: [PATCH] fix removing groups from space --- .../unreleased/fix-remove-group-from-share.md | 6 ++++++ services/graph/pkg/service/v0/driveitems.go | 17 +++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 changelog/unreleased/fix-remove-group-from-share.md diff --git a/changelog/unreleased/fix-remove-group-from-share.md b/changelog/unreleased/fix-remove-group-from-share.md new file mode 100644 index 0000000000..d027fed1af --- /dev/null +++ b/changelog/unreleased/fix-remove-group-from-share.md @@ -0,0 +1,6 @@ +Bugfix: Fix removing groups from space + +We fixed a bug when unable to remove groups from space via graph + +https://github.com/owncloud/ocis/pull/8803 +https://github.com/owncloud/ocis/issues/8768 diff --git a/services/graph/pkg/service/v0/driveitems.go b/services/graph/pkg/service/v0/driveitems.go index 582d6f666d..c503e680e5 100644 --- a/services/graph/pkg/service/v0/driveitems.go +++ b/services/graph/pkg/service/v0/driveitems.go @@ -15,6 +15,7 @@ import ( "time" gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1" + grouppb "github.com/cs3org/go-cs3apis/cs3/identity/group/v1beta1" userpb "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" cs3rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1" storageprovider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" @@ -359,17 +360,21 @@ func spacePermissionIdToCS3Grantee(permissionID string) (storageprovider.Grantee switch parts[0] { case "u": grantee.Type = storageprovider.GranteeType_GRANTEE_TYPE_USER + grantee.Id = &storageprovider.Grantee_UserId{ + UserId: &userpb.UserId{ + OpaqueId: parts[1], + }, + } case "g": grantee.Type = storageprovider.GranteeType_GRANTEE_TYPE_GROUP + grantee.Id = &storageprovider.Grantee_GroupId{ + GroupId: &grouppb.GroupId{ + OpaqueId: parts[1], + }, + } default: return grantee, errorcode.New(errorcode.InvalidRequest, "invalid space permission id") } - - grantee.Id = &storageprovider.Grantee_UserId{ - UserId: &userpb.UserId{ - OpaqueId: parts[1], - }, - } return grantee, nil }