Skip to content

Commit

Permalink
non personal spaces need virtual owner
Browse files Browse the repository at this point in the history
  • Loading branch information
micbar committed Jul 21, 2022
1 parent ec605be commit 5c1fe2b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions changelog/unreleased/space-owner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Project spaces need no real owner

Make it possible to use a non existing user as a space owner.

https://github.com/cs3org/reva/pull/3091
2 changes: 1 addition & 1 deletion pkg/storage/utils/decomposedfs/grants.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (fs *Decomposedfs) AddGrant(ctx context.Context, ref *provider.Reference, g
// When the owner is empty but grants are set then we do want to check the grants.
// However, if we are trying to edit an existing grant we do not have to check for permission if the user owns the grant
// TODO: find a better to check this
if !(len(grants) == 0 && (owner == nil || owner.OpaqueId == "")) {
if !(len(grants) == 0 && (owner == nil || owner.OpaqueId == utils.VirtualSpaceOwner.Id.GetOpaqueId())) {
ok, err := fs.p.HasPermission(ctx, node, func(rp *provider.ResourcePermissions) bool {
return rp.AddGrant
})
Expand Down
2 changes: 2 additions & 0 deletions pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ var (
PublicStorageProviderID = "7993447f-687f-490d-875c-ac95e89a62a4"
// PublicStorageSpaceID is the space id used by the sharestorageprovider
PublicStorageSpaceID = "7993447f-687f-490d-875c-ac95e89a62a4"
// VirtualSpaceOwner is the non-existing user which is needed for public share impersonation
VirtualSpaceOwner = userpb.User{Id: &userpb.UserId{OpaqueId: "dbdf733d-427f-4ac3-8093-2cba5c307e4c", Type: userpb.UserType_USER_TYPE_INVALID}}

// SpaceGrant is used to signal the storageprovider that the grant is on a space
SpaceGrant struct{}
Expand Down

0 comments on commit 5c1fe2b

Please sign in to comment.