mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-06 20:29:54 -06:00
bump reva for unnecessary-grant-exists-check (#8502)
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
committed by
GitHub
parent
8909b5307b
commit
b52e466935
@@ -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
|
||||
2
go.mod
2
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
|
||||
|
||||
4
go.sum
4
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=
|
||||
|
||||
@@ -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 ||
|
||||
|
||||
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user