Skip to content

Commit

Permalink
add space name during listStorageSpaces on decomposedfs (#2090)
Browse files Browse the repository at this point in the history
  • Loading branch information
micbar authored Sep 21, 2021
1 parent 912cd44 commit ce466cb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
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

0 comments on commit ce466cb

Please sign in to comment.