diff --git a/go.mod b/go.mod index f51638ba1a..e38c23f13b 100644 --- a/go.mod +++ b/go.mod @@ -68,7 +68,7 @@ require ( github.com/open-policy-agent/opa v1.21.1 github.com/opencloud-eu/icap-client v0.0.0-20250930132611-28a2afe62d89 github.com/opencloud-eu/libre-graph-api-go v1.0.9-0.20261119152805-1a7a500a264e - github.com/opencloud-eu/reva/v3 v3.0.2-0.20261120162312-20c6e78244d3 + github.com/opencloud-eu/reva/v3 v3.0.2-0.20261123180324-2b2b8732790b github.com/opensearch-project/opensearch-go/v4 v4.7.3 github.com/orcaman/concurrent-map v1.0.0 github.com/pkg/errors v0.9.1 diff --git a/go.sum b/go.sum index 56ce3a7239..57cd718b2f 100644 --- a/go.sum +++ b/go.sum @@ -761,8 +761,8 @@ github.com/opencloud-eu/icap-client v0.0.0-20250930132611-28a2afe62d89 h1:W1ms+l github.com/opencloud-eu/icap-client v0.0.0-20250930132611-28a2afe62d89/go.mod h1:vigJkNss1N2QEceCuNw/ullDehncuJNFB6mEnzfq9UI= github.com/opencloud-eu/libre-graph-api-go v1.0.9-0.20261119152805-1a7a500a264e h1:5sf3dNw/eYuuvDL8+3c4pbPSX+Pblw6lsylGtq+cw30= github.com/opencloud-eu/libre-graph-api-go v1.0.9-0.20261119152805-1a7a500a264e/go.mod h1:lTM8JeGblNpoMySTW7Lui2+c5TTLI95mwxtdUIHHrhU= -github.com/opencloud-eu/reva/v3 v3.0.2-0.20261120162312-20c6e78244d3 h1:lB4loaAtlU4J5OzZBcIOFDUozjRiltnMJZpqy9gonI0= -github.com/opencloud-eu/reva/v3 v3.0.2-0.20261120162312-20c6e78244d3/go.mod h1:oqi8rN/Nt2v+Gn/dmY9p2Zct3VHrdvnYtqZWHrjij7M= +github.com/opencloud-eu/reva/v3 v3.0.2-0.20261123180324-2b2b8732790b h1:4ltltng9ieAVaoIRa+VgKoZp1L0Ta6vj6B5noh+UktE= +github.com/opencloud-eu/reva/v3 v3.0.2-0.20261123180324-2b2b8732790b/go.mod h1:oqi8rN/Nt2v+Gn/dmY9p2Zct3VHrdvnYtqZWHrjij7M= github.com/opencloud-eu/secure v0.0.0-20260312082735-b6f5cb2244e4 h1:l2oB/RctH+t8r7QBj5p8thfEHCM/jF35aAY3WQ3hADI= github.com/opencloud-eu/secure v0.0.0-20260312082735-b6f5cb2244e4/go.mod h1:BmF5hyM6tXczk3MpQkFf1hpKSRqCyhqcbiQtiAF7+40= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= diff --git a/vendor/github.com/opencloud-eu/reva/v3/internal/grpc/services/gateway/appprovider.go b/vendor/github.com/opencloud-eu/reva/v3/internal/grpc/services/gateway/appprovider.go index cdf01f21b2..00459a9d9d 100644 --- a/vendor/github.com/opencloud-eu/reva/v3/internal/grpc/services/gateway/appprovider.go +++ b/vendor/github.com/opencloud-eu/reva/v3/internal/grpc/services/gateway/appprovider.go @@ -188,8 +188,9 @@ func (s *svc) openLocalResources(ctx context.Context, ri *storageprovider.Resour } func buildOpenInAppRequest(ctx context.Context, ri *storageprovider.ResourceInfo, vm gateway.OpenInAppRequest_ViewMode, tokenmgr token.Manager, accessToken string, opaque *typespb.Opaque) (*providerpb.OpenInAppRequest, error) { - // in case of a view only mode and a stat permission we need to create a view only token - if vm == gateway.OpenInAppRequest_VIEW_MODE_VIEW_ONLY && ri.GetPermissionSet().GetStat() { + // in view only mode, a user who may stat but not download the resource gets a view only token, + // users who may download it open it with their own access token + if vm == gateway.OpenInAppRequest_VIEW_MODE_VIEW_ONLY && ri.GetPermissionSet().GetStat() && !ri.GetPermissionSet().GetInitiateFileDownload() { // Limit scope to the resource scope, err := scope.AddResourceInfoScope(ri, providerv1beta1.Role_ROLE_VIEWER, nil) if err != nil { diff --git a/vendor/github.com/opencloud-eu/reva/v3/internal/grpc/services/ocmcore/ocmcore.go b/vendor/github.com/opencloud-eu/reva/v3/internal/grpc/services/ocmcore/ocmcore.go index 067e238ea3..7d1f5891e3 100644 --- a/vendor/github.com/opencloud-eu/reva/v3/internal/grpc/services/ocmcore/ocmcore.go +++ b/vendor/github.com/opencloud-eu/reva/v3/internal/grpc/services/ocmcore/ocmcore.go @@ -41,6 +41,7 @@ import ( "github.com/opencloud-eu/reva/v3/pkg/utils/cfg" "github.com/rs/zerolog" "google.golang.org/grpc" + "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/fieldmaskpb" ) @@ -208,12 +209,15 @@ func (s *service) UpdateOCMCoreShare(ctx context.Context, req *ocmcore.UpdateOCM fileMask := &fieldmaskpb.FieldMask{Paths: []string{"protocols"}} user := &userpb.User{Id: ocmuser.DecodeRemoteUserFederatedID(&userpb.UserId{OpaqueId: grantee})} - _, err := s.repo.UpdateReceivedShare(ctx, user, &ocm.ReceivedShare{ - Id: &ocm.ShareId{ - OpaqueId: req.GetOcmShareId(), - }, - Protocols: req.Protocols, - }, fileMask) + protocols, err := s.mergeWebDAVPermissions(ctx, user, req.GetOcmShareId(), req.Protocols) + if err == nil { + _, err = s.repo.UpdateReceivedShare(ctx, user, &ocm.ReceivedShare{ + Id: &ocm.ShareId{ + OpaqueId: req.GetOcmShareId(), + }, + Protocols: protocols, + }, fileMask) + } res := &ocmcore.UpdateOCMCoreShareResponse{} if err == nil { res.Status = status.NewOK(ctx) @@ -228,6 +232,39 @@ func (s *service) UpdateOCMCoreShare(ctx context.Context, req *ocmcore.UpdateOCM return res, nil } +// mergeWebDAVPermissions takes only the webdav permissions from a permission change notification, +// so a notification cannot replace the uri, the shared secret or other protocols of the stored share +func (s *service) mergeWebDAVPermissions(ctx context.Context, user *userpb.User, shareID string, notified []*ocm.Protocol) ([]*ocm.Protocol, error) { + rs, err := s.repo.GetReceivedShare(ctx, user, &ocm.ShareReference{ + Spec: &ocm.ShareReference_Id{ + Id: &ocm.ShareId{ + OpaqueId: shareID, + }, + }, + }) + if err != nil { + return nil, err + } + + var permissions *ocm.SharePermissions + for _, p := range notified { + if wd := p.GetWebdavOptions(); wd != nil { + permissions = wd.GetPermissions() + break + } + } + + protocols := make([]*ocm.Protocol, 0, len(rs.GetProtocols())) + for _, p := range rs.GetProtocols() { + if p.GetWebdavOptions() != nil && permissions != nil { + p = proto.Clone(p).(*ocm.Protocol) + p.GetWebdavOptions().Permissions = permissions + } + protocols = append(protocols, p) + } + return protocols, nil +} + func (s *service) DeleteOCMCoreShare(ctx context.Context, req *ocmcore.DeleteOCMCoreShareRequest) (*ocmcore.DeleteOCMCoreShareResponse, error) { grantee := utils.ReadPlainFromOpaque(req.GetOpaque(), "grantee") if grantee == "" { diff --git a/vendor/modules.txt b/vendor/modules.txt index 0e89c95e35..3bb66b1edc 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1360,7 +1360,7 @@ github.com/opencloud-eu/icap-client # github.com/opencloud-eu/libre-graph-api-go v1.0.9-0.20261119152805-1a7a500a264e ## explicit; go 1.23 github.com/opencloud-eu/libre-graph-api-go -# github.com/opencloud-eu/reva/v3 v3.0.2-0.20261120162312-20c6e78244d3 +# github.com/opencloud-eu/reva/v3 v3.0.2-0.20261123180324-2b2b8732790b ## explicit; go 1.26.0 github.com/opencloud-eu/reva/v3/cmd/revad/internal/grace github.com/opencloud-eu/reva/v3/cmd/revad/runtime