From 419619041be305097d6428a254109898b6c80713 Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Wed, 13 Dec 2023 12:58:25 +0100 Subject: [PATCH] graph sharing: Avoid usage for deprecated CS3 Request attributes The sharereference attribute in the CS3 UpdateShareRequest is deprecated. Set the shareid via the Share.ID attribute. --- services/graph/pkg/service/v0/driveitems.go | 9 +++------ services/graph/pkg/service/v0/driveitems_test.go | 8 ++++---- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/services/graph/pkg/service/v0/driveitems.go b/services/graph/pkg/service/v0/driveitems.go index 4f9432c55..67125781c 100644 --- a/services/graph/pkg/service/v0/driveitems.go +++ b/services/graph/pkg/service/v0/driveitems.go @@ -800,14 +800,11 @@ func (g Graph) updateUserShare(ctx context.Context, permissionID string, oldPerm } cs3UpdateShareReq := &collaboration.UpdateShareRequest{ - Ref: &collaboration.ShareReference{ - Spec: &collaboration.ShareReference_Id{ - Id: &collaboration.ShareId{ - OpaqueId: permissionID, - }, + Share: &collaboration.Share{ + Id: &collaboration.ShareId{ + OpaqueId: permissionID, }, }, - Share: &collaboration.Share{}, } fieldmask := []string{} if expiration, ok := newPermission.GetExpirationDateTimeOk(); ok { diff --git a/services/graph/pkg/service/v0/driveitems_test.go b/services/graph/pkg/service/v0/driveitems_test.go index 0fbca67f9..fc10596fe 100644 --- a/services/graph/pkg/service/v0/driveitems_test.go +++ b/services/graph/pkg/service/v0/driveitems_test.go @@ -597,7 +597,7 @@ var _ = Describe("Driveitems", func() { updateShareMock := gatewayClient.On("UpdateShare", mock.Anything, mock.MatchedBy(func(req *collaboration.UpdateShareRequest) bool { - if req.GetRef().GetId().GetOpaqueId() == "permissionid" { + if req.GetShare().GetId().GetOpaqueId() == "permissionid" { return expiration.Equal(utils.TSToTime(req.GetShare().GetExpiration())) } return false @@ -628,7 +628,7 @@ var _ = Describe("Driveitems", func() { updateShareMock := gatewayClient.On("UpdateShare", mock.Anything, mock.MatchedBy(func(req *collaboration.UpdateShareRequest) bool { - if req.GetRef().GetId().GetOpaqueId() == "permissionid" { + if req.GetShare().GetId().GetOpaqueId() == "permissionid" { return true } return false @@ -659,7 +659,7 @@ var _ = Describe("Driveitems", func() { updateShareMock := gatewayClient.On("UpdateShare", mock.Anything, mock.MatchedBy(func(req *collaboration.UpdateShareRequest) bool { - return req.GetRef().GetId().GetOpaqueId() == "permissionid" + return req.GetShare().GetId().GetOpaqueId() == "permissionid" }), ) updateShareMock.Return(updateShareMockResponse, nil) @@ -687,7 +687,7 @@ var _ = Describe("Driveitems", func() { updateShareMock := gatewayClient.On("UpdateShare", mock.Anything, mock.MatchedBy(func(req *collaboration.UpdateShareRequest) bool { - return req.GetRef().GetId().GetOpaqueId() == "permissionid" + return req.GetShare().GetId().GetOpaqueId() == "permissionid" }), ) updateShareMockResponse.Share.Permissions = &collaboration.SharePermissions{