Skip to content

Commit

Permalink
Fix UpdateUserShare when just the expiration date is updated
Browse files Browse the repository at this point in the history
When updating the Grant we need to use the Share as returned in the UpdateUserShareResponse.
The Share from the incoming request might just contain a subset of the attributes.
  • Loading branch information
rhafer committed Dec 5, 2023
1 parent b9486a8 commit 1fbdbbb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/fix-update-userhare.md
@@ -0,0 +1,6 @@
Bugfix: Allow UpdateUserShare() to update just the expiration date

The UpdateUserShare Request now works if it just contains an update of the
expiration date.

https://github.com/cs3org/reva/pull/4388
6 changes: 3 additions & 3 deletions internal/grpc/services/gateway/usershareprovider.go
Expand Up @@ -123,9 +123,9 @@ func (s *svc) updateShare(ctx context.Context, req *collaboration.UpdateShareReq
if s.c.CommitShareToStorageGrant {
creator := ctxpkg.ContextMustGetUser(ctx)
grant := &provider.Grant{
Grantee: req.GetShare().GetGrantee(),
Permissions: req.GetShare().GetPermissions().GetPermissions(),
Expiration: req.GetShare().GetExpiration(),
Grantee: res.GetShare().GetGrantee(),
Permissions: res.GetShare().GetPermissions().GetPermissions(),
Expiration: res.GetShare().GetExpiration(),
Creator: creator.GetId(),
}
updateGrantStatus, err := s.updateGrant(ctx, res.GetShare().GetResourceId(), grant, nil)
Expand Down

0 comments on commit 1fbdbbb

Please sign in to comment.