From 1fbdbbb0bff3a8d178e75aa5c1e6b569b37ea6f7 Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Tue, 5 Dec 2023 17:22:32 +0100 Subject: [PATCH] Fix UpdateUserShare when just the expiration date is updated 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. --- changelog/unreleased/fix-update-userhare.md | 6 ++++++ internal/grpc/services/gateway/usershareprovider.go | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 changelog/unreleased/fix-update-userhare.md diff --git a/changelog/unreleased/fix-update-userhare.md b/changelog/unreleased/fix-update-userhare.md new file mode 100644 index 0000000000..2c51dfbfb7 --- /dev/null +++ b/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 diff --git a/internal/grpc/services/gateway/usershareprovider.go b/internal/grpc/services/gateway/usershareprovider.go index bbcfbf0bc4..fd5a57f9e9 100644 --- a/internal/grpc/services/gateway/usershareprovider.go +++ b/internal/grpc/services/gateway/usershareprovider.go @@ -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)