diff --git a/CHANGELOG.md b/CHANGELOG.md index 02aed5fdba..89a390b8a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -153,11 +153,11 @@ Details https://github.com/owncloud/reva/issues/3080 - * Enhancement #4072: Add user filter + * Enhancement #3046: Add user filter This PR adds the ability to filter spaces by user-id - https://github.com/owncloud/ocis/pull/4072 + https://github.com/cs3org/reva/pull/3046 Changelog for reva 2.6.1 (2022-06-27) diff --git a/changelog/2.7.1_2022-07-15/add-user-filter.md b/changelog/2.7.1_2022-07-15/add-user-filter.md index 9f8ebe91b0..664e550283 100644 --- a/changelog/2.7.1_2022-07-15/add-user-filter.md +++ b/changelog/2.7.1_2022-07-15/add-user-filter.md @@ -2,4 +2,4 @@ Enhancement: Add user filter This PR adds the ability to filter spaces by user-id -https://github.com/owncloud/ocis/pull/4072 \ No newline at end of file +https://github.com/cs3org/reva/pull/3046 \ No newline at end of file diff --git a/changelog/NOTE.md b/changelog/NOTE.md index 0db0828f9a..992af6e0b3 100644 --- a/changelog/NOTE.md +++ b/changelog/NOTE.md @@ -20,10 +20,10 @@ Details https://github.com/owncloud/reva/issues/3080 - * Enhancement #4072: Add user filter + * Enhancement #3046: Add user filter This PR adds the ability to filter spaces by user-id - https://github.com/owncloud/ocis/pull/4072 + https://github.com/cs3org/reva/pull/3046 diff --git a/changelog/unreleased/fix-can-list-all-spaces-permission.md b/changelog/unreleased/fix-can-list-all-spaces-permission.md new file mode 100644 index 0000000000..2d2d841ebb --- /dev/null +++ b/changelog/unreleased/fix-can-list-all-spaces-permission.md @@ -0,0 +1,5 @@ +Bugfix: spaces relatated permissions and providerid cleanup + +Following the CS3 resource id refactoring we reverted a logic check when checking the list all spaces permission, fixed some typos and made the storageprovider fill in a missing storage provider id. + +https://github.com/cs3org/reva/pull/3084 diff --git a/docs/content/en/docs/changelog/2.7.1/_index.md b/docs/content/en/docs/changelog/2.7.1/_index.md index 2ce37e68e6..16493e8a6e 100644 --- a/docs/content/en/docs/changelog/2.7.1/_index.md +++ b/docs/content/en/docs/changelog/2.7.1/_index.md @@ -29,10 +29,10 @@ Details https://github.com/owncloud/reva/issues/3080 - * Enhancement #4072: Add user filter + * Enhancement #3046: Add user filter This PR adds the ability to filter spaces by user-id - https://github.com/owncloud/ocis/pull/4072 + https://github.com/cs3org/reva/pull/3046 diff --git a/internal/grpc/services/storageprovider/storageprovider.go b/internal/grpc/services/storageprovider/storageprovider.go index 950e55f441..5676cf3ef7 100644 --- a/internal/grpc/services/storageprovider/storageprovider.go +++ b/internal/grpc/services/storageprovider/storageprovider.go @@ -265,6 +265,10 @@ func (s *service) InitiateFileDownload(ctx context.Context, req *provider.Initia protocol := &provider.FileDownloadProtocol{Expose: s.conf.ExposeDataServer} if utils.IsRelativeReference(req.Ref) { + // fill in storage provider id if it is missing + if req.GetRef().GetResourceId().GetStorageId() == "" { + req.GetRef().GetResourceId().StorageId = s.conf.MountID + } protocol.Protocol = "spaces" u.Path = path.Join(u.Path, "spaces", storagespace.FormatResourceID(*req.Ref.ResourceId), req.Ref.Path) } else { diff --git a/pkg/rhttp/datatx/utils/download/download.go b/pkg/rhttp/datatx/utils/download/download.go index aa34bd73dd..bf9cd76dd6 100644 --- a/pkg/rhttp/datatx/utils/download/download.go +++ b/pkg/rhttp/datatx/utils/download/download.go @@ -80,6 +80,11 @@ func GetOrHeadFile(w http.ResponseWriter, r *http.Request, fs storage.FS, spaceI return } + // fill in storage provider id if it is missing + if spaceID != "" && md.GetId().GetStorageId() == "" { + md.Id.StorageId = ref.ResourceId.StorageId + } + var ranges []HTTPRange if r.Header.Get("Range") != "" { diff --git a/pkg/storage/utils/decomposedfs/spaces.go b/pkg/storage/utils/decomposedfs/spaces.go index 2491f782fb..7e93404b90 100644 --- a/pkg/storage/utils/decomposedfs/spaces.go +++ b/pkg/storage/utils/decomposedfs/spaces.go @@ -282,7 +282,7 @@ func (fs *Decomposedfs) ListStorageSpaces(ctx context.Context, filter []*provide return nil, errtypes.PermissionDenied(fmt.Sprintf("user %s is not allowed to list spaces of other users", ctxpkg.ContextMustGetUser(ctx).GetId().GetOpaqueId())) } - checkNodePermissions := !canListAllSpaces && !unrestricted + checkNodePermissions := !canListAllSpaces || !unrestricted spaces := []*provider.StorageSpace{} // build the glob path, eg. diff --git a/pkg/storage/utils/decomposedfs/tree/tree.go b/pkg/storage/utils/decomposedfs/tree/tree.go index bea5b8b399..71c3c586b2 100644 --- a/pkg/storage/utils/decomposedfs/tree/tree.go +++ b/pkg/storage/utils/decomposedfs/tree/tree.go @@ -154,7 +154,7 @@ func (t *Tree) moveSpaceType(spaceType string) error { Str("space", spaceType). Str("nodes", child.Name()). Str("oldLink", old). - Msg("could not read old symplink") + Msg("could not read old symlink") continue } newDir := filepath.Join(t.root, "indexes", "by-type", spaceType) @@ -163,7 +163,7 @@ func (t *Tree) moveSpaceType(spaceType string) error { Str("space", spaceType). Str("nodes", child.Name()). Str("targetDir", newDir). - Msg("could not read old symplink") + Msg("could not read old symlink") } newLink := filepath.Join(newDir, child.Name()) if err := os.Symlink(filepath.Join("..", target), newLink); err != nil {