Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add space name during listStorageSpaces on decomposedfs #2090

Merged
merged 1 commit into from
Sep 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/unreleased/add-space-name-attribute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Return space name during list storage spaces

In the decomposedfs we return now the space name in the response which is stored in the extended attributes.

https://github.com/cs3org/reva/issues/2090
15 changes: 11 additions & 4 deletions pkg/storage/utils/decomposedfs/spaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,21 @@ func (fs *Decomposedfs) ListStorageSpaces(ctx context.Context, filter []*provide
// Mtime is set either as node.tmtime or as fi.mtime below
}

if space.SpaceType == "share" {
switch space.SpaceType {
case "share":
if utils.UserEqual(u.Id, owner) {
// do not list shares as spaces for the owner
continue
}
} else {
space.Name = "root" // do not expose the id as name, this is the root of a space
// TODO read from extended attribute for project / group spaces
case "project":
sname, err := xattr.Get(n.InternalPath(), xattrs.SpaceNameAttr)
if err != nil {
appctx.GetLogger(ctx).Error().Err(err).Interface("node", n).Msg("could not read space name, attribute not found")
continue
}
space.Name = string(sname)
default:
space.Name = "root"
}

// filter out spaces user cannot access (currently based on stat permission)
Expand Down