From b52e46693581aaac66cefd1e66d96d33a84d7709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Wed, 21 Feb 2024 16:29:16 +0100 Subject: [PATCH] bump reva for unnecessary-grant-exists-check (#8502) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- ...reva-for-unnecessary-grant-exists-check.md | 5 ++ go.mod | 2 +- go.sum | 4 +- .../handlers/apps/sharing/shares/shares.go | 51 ------------------- vendor/modules.txt | 2 +- 5 files changed, 9 insertions(+), 55 deletions(-) create mode 100644 changelog/unreleased/bump-reva-for-unnecessary-grant-exists-check.md diff --git a/changelog/unreleased/bump-reva-for-unnecessary-grant-exists-check.md b/changelog/unreleased/bump-reva-for-unnecessary-grant-exists-check.md new file mode 100644 index 0000000000..db1a6ebbf0 --- /dev/null +++ b/changelog/unreleased/bump-reva-for-unnecessary-grant-exists-check.md @@ -0,0 +1,5 @@ +Enhancement: bump reva + +We have bumped reva to drop the unnecessary grants exists check when creating shares. + +https://github.com/owncloud/ocis/pull/8502 diff --git a/go.mod b/go.mod index 8c468281a1..d6e12b3382 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/cenkalti/backoff v2.2.1+incompatible github.com/coreos/go-oidc/v3 v3.9.0 github.com/cs3org/go-cs3apis v0.0.0-20231023073225-7748710e0781 - github.com/cs3org/reva/v2 v2.18.1-0.20240221104842-3fb1ef6dc93a + github.com/cs3org/reva/v2 v2.18.1-0.20240221133359-3c387bebd755 github.com/dhowden/tag v0.0.0-20230630033851-978a0926ee25 github.com/disintegration/imaging v1.6.2 github.com/dutchcoders/go-clamd v0.0.0-20170520113014-b970184f4d9e diff --git a/go.sum b/go.sum index d74ea38218..9d9a2d2e9b 100644 --- a/go.sum +++ b/go.sum @@ -1019,8 +1019,8 @@ github.com/crewjam/saml v0.4.14 h1:g9FBNx62osKusnFzs3QTN5L9CVA/Egfgm+stJShzw/c= github.com/crewjam/saml v0.4.14/go.mod h1:UVSZCf18jJkk6GpWNVqcyQJMD5HsRugBPf4I1nl2mME= github.com/cs3org/go-cs3apis v0.0.0-20231023073225-7748710e0781 h1:BUdwkIlf8IS2FasrrPg8gGPHQPOrQ18MS1Oew2tmGtY= github.com/cs3org/go-cs3apis v0.0.0-20231023073225-7748710e0781/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY= -github.com/cs3org/reva/v2 v2.18.1-0.20240221104842-3fb1ef6dc93a h1:iD9HJRGtIqBxEl9AM9U8t1rd+SCtNyst+uotSwEebT4= -github.com/cs3org/reva/v2 v2.18.1-0.20240221104842-3fb1ef6dc93a/go.mod h1:GRUrOp5HbFVwZTgR9bVrMZ/MvVy+Jhxw1PdMmhhKP9E= +github.com/cs3org/reva/v2 v2.18.1-0.20240221133359-3c387bebd755 h1:b0gZrGE6WKCdOwSOKX5wTzr3xPjGkreSSjOvllxKY7M= +github.com/cs3org/reva/v2 v2.18.1-0.20240221133359-3c387bebd755/go.mod h1:GRUrOp5HbFVwZTgR9bVrMZ/MvVy+Jhxw1PdMmhhKP9E= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= diff --git a/vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go b/vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go index 4ce0c5bf8f..6ebcaf37f7 100644 --- a/vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go +++ b/vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go @@ -1516,24 +1516,6 @@ func (h *Handler) getResourceInfo(ctx context.Context, client gateway.GatewayAPI func (h *Handler) createCs3Share(ctx context.Context, w http.ResponseWriter, r *http.Request, client gateway.GatewayAPIClient, req *collaboration.CreateShareRequest) (*collaboration.Share, *ocsError) { logger := appctx.GetLogger(ctx) - exists, err := h.granteeExists(ctx, req.Grant.Grantee, req.ResourceInfo.Id) - if err != nil { - return nil, &ocsError{ - Code: response.MetaServerError.StatusCode, - Message: "error sending a grpc list shares request", - Error: err, - } - } - - if exists { - // the grantee already has a share - should we jump to UpdateShare? - // for now - lets error - return nil, &ocsError{ - Code: response.MetaBadRequest.StatusCode, - Message: "grantee already has a share on this item", - Error: nil, - } - } expiry := r.PostFormValue("expireDate") if expiry != "" { @@ -1662,39 +1644,6 @@ func (h *Handler) getHomeNamespace(u *userpb.User) string { return templates.WithUser(u, h.homeNamespace) } -func (h *Handler) granteeExists(ctx context.Context, g *provider.Grantee, rid *provider.ResourceId) (bool, error) { - client, err := h.getClient() - if err != nil { - return false, err - } - - lsreq := collaboration.ListSharesRequest{ - Filters: []*collaboration.Filter{ - { - Type: collaboration.Filter_TYPE_RESOURCE_ID, - Term: &collaboration.Filter_ResourceId{ - ResourceId: rid, - }, - }, - }, - } - lsres, err := client.ListShares(ctx, &lsreq) - if err != nil { - return false, err - } - if lsres.GetStatus().GetCode() != rpc.Code_CODE_OK { - return false, fmt.Errorf("unexpected status code from ListShares: %v", lsres.GetStatus()) - } - - for _, s := range lsres.GetShares() { - if utils.GranteeEqual(g, s.GetGrantee()) { - return true, nil - } - } - - return false, nil -} - func publicPwdEnforced(c *config.Config) passwordEnforced { enf := passwordEnforced{} if c == nil || diff --git a/vendor/modules.txt b/vendor/modules.txt index b3a33e5229..0783179d21 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -359,7 +359,7 @@ github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1 github.com/cs3org/go-cs3apis/cs3/storage/registry/v1beta1 github.com/cs3org/go-cs3apis/cs3/tx/v1beta1 github.com/cs3org/go-cs3apis/cs3/types/v1beta1 -# github.com/cs3org/reva/v2 v2.18.1-0.20240221104842-3fb1ef6dc93a +# github.com/cs3org/reva/v2 v2.18.1-0.20240221133359-3c387bebd755 ## explicit; go 1.21 github.com/cs3org/reva/v2/cmd/revad/internal/grace github.com/cs3org/reva/v2/cmd/revad/runtime