Merge pull request #10172 from owncloud/fix-sharejail-stat-id

[full-ci] bump reva to 02af5a266
This commit is contained in:
Jörn Friedrich Dreyer
2024-09-30 14:49:06 +02:00
committed by GitHub
8 changed files with 49 additions and 16 deletions
+1
View File
@@ -2,5 +2,6 @@ Enhancement: Bump reva
Bumps reva version Bumps reva version
https://github.com/owncloud/ocis/pull/10172
https://github.com/owncloud/ocis/pull/10157 https://github.com/owncloud/ocis/pull/10157
https://github.com/owncloud/ocis/pull/9817 https://github.com/owncloud/ocis/pull/9817
+1 -1
View File
@@ -15,7 +15,7 @@ require (
github.com/cenkalti/backoff v2.2.1+incompatible github.com/cenkalti/backoff v2.2.1+incompatible
github.com/coreos/go-oidc/v3 v3.11.0 github.com/coreos/go-oidc/v3 v3.11.0
github.com/cs3org/go-cs3apis v0.0.0-20240724121416-062c4e3046cb github.com/cs3org/go-cs3apis v0.0.0-20240724121416-062c4e3046cb
github.com/cs3org/reva/v2 v2.24.2-0.20240926082340-b5c3c6781528 github.com/cs3org/reva/v2 v2.24.2-0.20240930121615-c33c803283ee
github.com/dhowden/tag v0.0.0-20230630033851-978a0926ee25 github.com/dhowden/tag v0.0.0-20230630033851-978a0926ee25
github.com/dutchcoders/go-clamd v0.0.0-20170520113014-b970184f4d9e github.com/dutchcoders/go-clamd v0.0.0-20170520113014-b970184f4d9e
github.com/egirna/icap-client v0.1.1 github.com/egirna/icap-client v0.1.1
+2 -2
View File
@@ -255,8 +255,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/crewjam/saml v0.4.14/go.mod h1:UVSZCf18jJkk6GpWNVqcyQJMD5HsRugBPf4I1nl2mME=
github.com/cs3org/go-cs3apis v0.0.0-20240724121416-062c4e3046cb h1:KmYZDReplv/yfwc1LNYpDcVhVujC3Pasv6WjXx1haSU= github.com/cs3org/go-cs3apis v0.0.0-20240724121416-062c4e3046cb h1:KmYZDReplv/yfwc1LNYpDcVhVujC3Pasv6WjXx1haSU=
github.com/cs3org/go-cs3apis v0.0.0-20240724121416-062c4e3046cb/go.mod h1:yyP8PRo0EZou3nSH7H4qjlzQwaydPeIRNgX50npQHpE= github.com/cs3org/go-cs3apis v0.0.0-20240724121416-062c4e3046cb/go.mod h1:yyP8PRo0EZou3nSH7H4qjlzQwaydPeIRNgX50npQHpE=
github.com/cs3org/reva/v2 v2.24.2-0.20240926082340-b5c3c6781528 h1:sNq9lYNXQeqGGGe8m9zGdzBiw2QYs4fe0zXYTFfD++g= github.com/cs3org/reva/v2 v2.24.2-0.20240930121615-c33c803283ee h1:+1sYiuA9LRQIznBNG1AFQoIGdCUCqQT1Dof2rTTsDm8=
github.com/cs3org/reva/v2 v2.24.2-0.20240926082340-b5c3c6781528/go.mod h1:p7CHBXcg6sSqB+0JMNDfC1S7TSh9FghXkw1kTV3KcJI= github.com/cs3org/reva/v2 v2.24.2-0.20240930121615-c33c803283ee/go.mod h1:p7CHBXcg6sSqB+0JMNDfC1S7TSh9FghXkw1kTV3KcJI=
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= 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 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
+6
View File
@@ -86,6 +86,9 @@ func (g Graph) AssignTags(w http.ResponseWriter, r *http.Request) {
return return
} }
// use resource id from stat response to work on the actual resource and not a share jail item
rid = *sres.GetInfo().GetId()
pm := sres.GetInfo().GetPermissionSet() pm := sres.GetInfo().GetPermissionSet()
if pm == nil { if pm == nil {
g.logger.Error().Err(err).Msg("no permissionset on file") g.logger.Error().Err(err).Msg("no permissionset on file")
@@ -185,6 +188,9 @@ func (g Graph) UnassignTags(w http.ResponseWriter, r *http.Request) {
return return
} }
// use resource id from stat response to work on the actual resource and not a share jail item
rid = *sres.GetInfo().GetId()
pm := sres.GetInfo().GetPermissionSet() pm := sres.GetInfo().GetPermissionSet()
if pm == nil { if pm == nil {
g.logger.Error().Err(err).Msg("no permissionset on file") g.logger.Error().Err(err).Msg("no permissionset on file")
@@ -49,7 +49,7 @@ Feature: propfind a shares
| textfile.txt | textfile (1).txt | | textfile.txt | textfile (1).txt |
| folderToShare | folderToShare (1) | | folderToShare | folderToShare (1) |
@issue-4421 @issue-4421 @issue-9933 @skip
Scenario Outline: sharee PROPFIND same name shares shared by multiple users using new dav path Scenario Outline: sharee PROPFIND same name shares shared by multiple users using new dav path
Given using <dav-path-version> DAV path Given using <dav-path-version> DAV path
And user "Alice" has uploaded file with content "to share" to "textfile.txt" And user "Alice" has uploaded file with content "to share" to "textfile.txt"
@@ -93,7 +93,7 @@ Feature: propfind a shares
| new | textfile.txt | textfile (1).txt | | new | textfile.txt | textfile (1).txt |
| new | folderToShare | folderToShare (1) | | new | folderToShare | folderToShare (1) |
@issue-4421 @issue-4421 @issue-9933 @skip
Scenario: sharee PROPFIND shares with bracket in the name Scenario: sharee PROPFIND shares with bracket in the name
Given using spaces DAV path Given using spaces DAV path
And user "Alice" has created folder "folderToShare" And user "Alice" has created folder "folderToShare"
@@ -789,21 +789,26 @@ func (s *service) Stat(ctx context.Context, req *provider.StatRequest) (*provide
return nil, err return nil, err
} }
// TODO return reference? statRes, err := gatewayClient.Stat(ctx, &provider.StatRequest{
return gatewayClient.Stat(ctx, &provider.StatRequest{
Opaque: req.Opaque, Opaque: req.Opaque,
Ref: buildReferenceInShare(req.Ref, receivedShare), Ref: buildReferenceInShare(req.Ref, receivedShare),
ArbitraryMetadataKeys: req.ArbitraryMetadataKeys, ArbitraryMetadataKeys: req.ArbitraryMetadataKeys,
}) })
if err != nil {
return nil, err
}
// FIXME when stating a share jail child we need to rewrite the id and use the share // when stating a share jail mountpoint we need to rewrite the id and use the share
// jail space id as the mountpoint has a different id than the grant // jail space id as the mountpoint has a different id than the grant
// but that might be problematic for eg. wopi because it needs the correct id? ... if statRes.GetStatus().GetCode() == rpc.Code_CODE_OK && receivedShare.MountPoint.Path == strings.TrimPrefix(req.Ref.Path, "./") && statRes.Info != nil {
// ... but that should stat the grant anyway statRes.Info.Id = &provider.ResourceId{
StorageId: utils.ShareStorageProviderID,
// FIXME when navigating via /dav/spaces/a0ca6a90-a365-4782-871e-d44447bbc668 the web ui seems SpaceId: utils.ShareStorageSpaceID,
// to continue navigating based on the id of resources, causing the path to change. Is that related to WOPI? OpaqueId: receivedShare.GetShare().GetId().GetOpaqueId(),
}
}
return statRes, nil
} }
func (s *service) ListContainerStream(req *provider.ListContainerStreamRequest, ss provider.ProviderAPI_ListContainerStreamServer) error { func (s *service) ListContainerStream(req *provider.ListContainerStreamRequest, ss provider.ProviderAPI_ListContainerStreamServer) error {
+23 -2
View File
@@ -22,6 +22,7 @@ import (
"bytes" "bytes"
"context" "context"
"errors" "errors"
"fmt"
"io" "io"
"net/http" "net/http"
"os" "os"
@@ -107,6 +108,27 @@ func (cs3 *CS3) Init(ctx context.Context, spaceid string) (err error) {
if err != nil { if err != nil {
return err return err
} }
lsRes, err := client.ListStorageSpaces(ctx, &provider.ListStorageSpacesRequest{
Filters: []*provider.ListStorageSpacesRequest_Filter{
{
Type: provider.ListStorageSpacesRequest_Filter_TYPE_ID,
Term: &provider.ListStorageSpacesRequest_Filter_Id{
Id: &provider.StorageSpaceId{OpaqueId: spaceid + "!" + spaceid},
},
},
},
})
switch {
case err != nil:
return err
case lsRes.Status.Code == rpc.Code_CODE_OK && len(lsRes.StorageSpaces) > 0:
if len(lsRes.StorageSpaces) > 0 {
cs3.SpaceRoot = lsRes.StorageSpaces[0].Root
return nil
}
}
// FIXME change CS3 api to allow sending a space id // FIXME change CS3 api to allow sending a space id
cssr, err := client.CreateStorageSpace(ctx, &provider.CreateStorageSpaceRequest{ cssr, err := client.CreateStorageSpace(ctx, &provider.CreateStorageSpaceRequest{
Opaque: &types.Opaque{ Opaque: &types.Opaque{
@@ -127,8 +149,7 @@ func (cs3 *CS3) Init(ctx context.Context, spaceid string) (err error) {
case cssr.Status.Code == rpc.Code_CODE_OK: case cssr.Status.Code == rpc.Code_CODE_OK:
cs3.SpaceRoot = cssr.StorageSpace.Root cs3.SpaceRoot = cssr.StorageSpace.Root
case cssr.Status.Code == rpc.Code_CODE_ALREADY_EXISTS: case cssr.Status.Code == rpc.Code_CODE_ALREADY_EXISTS:
// TODO make CreateStorageSpace return existing space? return errtypes.AlreadyExists(fmt.Sprintf("user %s does not have access to metadata space %s, but it exists", cs3.serviceUser.Id.OpaqueId, spaceid))
cs3.SpaceRoot = &provider.ResourceId{SpaceId: spaceid, OpaqueId: spaceid}
default: default:
return errtypes.NewErrtypeFromStatus(cssr.Status) return errtypes.NewErrtypeFromStatus(cssr.Status)
} }
+1 -1
View File
@@ -367,7 +367,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/storage/registry/v1beta1
github.com/cs3org/go-cs3apis/cs3/tx/v1beta1 github.com/cs3org/go-cs3apis/cs3/tx/v1beta1
github.com/cs3org/go-cs3apis/cs3/types/v1beta1 github.com/cs3org/go-cs3apis/cs3/types/v1beta1
# github.com/cs3org/reva/v2 v2.24.2-0.20240926082340-b5c3c6781528 # github.com/cs3org/reva/v2 v2.24.2-0.20240930121615-c33c803283ee
## explicit; go 1.21 ## explicit; go 1.21
github.com/cs3org/reva/v2/cmd/revad/internal/grace github.com/cs3org/reva/v2/cmd/revad/internal/grace
github.com/cs3org/reva/v2/cmd/revad/runtime github.com/cs3org/reva/v2/cmd/revad/runtime