diff --git a/changelog/unreleased/fix-spase-share-update-ocs.md b/changelog/unreleased/fix-spase-share-update-ocs.md new file mode 100644 index 0000000000..b9c0b32e67 --- /dev/null +++ b/changelog/unreleased/fix-spase-share-update-ocs.md @@ -0,0 +1,6 @@ +Bugfix: Fix space share update for ocs + +We fixed the space share update for ocs. + +https://github.com/cs3org/reva/pull/4661 +https://github.com/owncloud/ocis/issues/8905 diff --git a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/spaces.go b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/spaces.go index f3def1ca59..35ccf7a65b 100644 --- a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/spaces.go +++ b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/spaces.go @@ -41,6 +41,7 @@ import ( "github.com/cs3org/reva/v2/pkg/storagespace" "github.com/cs3org/reva/v2/pkg/utils" "github.com/pkg/errors" + "google.golang.org/protobuf/types/known/fieldmaskpb" ) func (h *Handler) getGrantee(ctx context.Context, name string) (provider.Grantee, error) { @@ -108,8 +109,10 @@ func (h *Handler) addSpaceMember(w http.ResponseWriter, r *http.Request, info *p // The viewer role doesn't have the ListGrants permission so we set it here. permissions.ListGrants = true + fieldmask := []string{} expireDate := r.PostFormValue("expireDate") var expirationTs *types.Timestamp + fieldmask = append(fieldmask, "expiration") if expireDate != "" { expiration, err := time.Parse(_iso8601, expireDate) if err != nil { @@ -125,6 +128,7 @@ func (h *Handler) addSpaceMember(w http.ResponseWriter, r *http.Request, info *p Seconds: uint64(expiration.UnixNano() / int64(time.Second)), Nanos: uint32(expiration.UnixNano() % int64(time.Second)), } + fieldmask = append(fieldmask, "expiration") } ref := provider.Reference{ResourceId: info.GetId()} @@ -154,6 +158,9 @@ func (h *Handler) addSpaceMember(w http.ResponseWriter, r *http.Request, info *p // we have to send the update request to the gateway to give it a chance to invalidate its cache // TODO the gateway no longer should cache stuff because invalidation is to expensive. The decomposedfs already has a better cache. if granteeExists(lgRes.Grants, grantee) { + if permissions != nil { + fieldmask = append(fieldmask, "permissions") + } updateShareReq := &collaborationv1beta1.UpdateShareRequest{ // TODO: change CS3 APIs Opaque: &types.Opaque{ @@ -169,6 +176,9 @@ func (h *Handler) addSpaceMember(w http.ResponseWriter, r *http.Request, info *p Grantee: &grantee, Expiration: expirationTs, }, + UpdateMask: &fieldmaskpb.FieldMask{ + Paths: fieldmask, + }, } updateShareReq.Opaque = utils.AppendPlainToOpaque(updateShareReq.Opaque, "spacetype", info.GetSpace().GetSpaceType()) updateShareRes, err := client.UpdateShare(ctx, updateShareReq)