Skip to content

Commit

Permalink
fix space share update
Browse files Browse the repository at this point in the history
  • Loading branch information
2403905 committed Apr 23, 2024
1 parent 51ab765 commit 62a5a7b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
6 changes: 6 additions & 0 deletions changelog/unreleased/fix-spase-share-update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Fix space share update

We fixed the permission check for updating the space shares when update an expirationDateTime only.

https://github.com/cs3org/reva/pull/4656
https://github.com/owncloud/ocis/issues/8905
18 changes: 17 additions & 1 deletion internal/grpc/services/gateway/usershareprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,24 @@ func (s *svc) updateSpaceShare(ctx context.Context, req *collaboration.UpdateSha
if err != nil {
return nil, errors.Wrap(err, "gateway: error denying grant in storage")
}
} else if grant.GetPermissions() == nil && grant.GetGrantee() != nil {
listGrantRes, err := s.listGrants(ctx, req.GetShare().GetResourceId())
if err != nil {
return nil, errors.Wrap(err, "gateway: error getting grant to remove from storage")
}
for _, g := range listGrantRes.Grants {
if isEqualGrantee(g.Grantee, grant.GetGrantee()) {
grant.Permissions = g.Permissions
req.Share.Permissions = &collaboration.SharePermissions{Permissions: g.Permissions}
break
}
}
st, err = s.updateGrant(ctx, req.GetShare().GetResourceId(), grant, opaque)
if err != nil {
return nil, errors.Wrap(err, "gateway: error adding grant to storage")
}
} else {
if !grant.Permissions.RemoveGrant {
if !grant.GetPermissions().GetRemoveGrant() {
// this request might remove Manager Permissions so we need to
// check if there is at least one manager remaining of the
// resource.
Expand Down

0 comments on commit 62a5a7b

Please sign in to comment.