Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Commit

Permalink
fix update storage spaces for admins (cs3org#2195)
Browse files Browse the repository at this point in the history
This is a quick fix until we have a better permission system. Admins can't list other spaces yet so we just return the space from the request.
  • Loading branch information
David Christofas authored and root committed Oct 25, 2021
1 parent ba0f9e0 commit f52002f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
1 change: 1 addition & 0 deletions changelog/unreleased/update-storage-spaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ Enhancement: Implement the UpdateStorageSpace method
Added the UpdateStorageSpace method to the decomposedfs.

https://github.com/cs3org/reva/pull/2162
https://github.com/cs3org/reva/pull/2195
10 changes: 2 additions & 8 deletions pkg/storage/utils/decomposedfs/spaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ func (fs *Decomposedfs) UpdateStorageSpace(ctx context.Context, req *provider.Up
}

if len(matches) != 1 {
return nil, errors.New("multiple spaces found")
return nil, fmt.Errorf("update space failed: found %d matching spaces", len(matches))
}

target, err := os.Readlink(matches[0])
Expand All @@ -279,15 +279,9 @@ func (fs *Decomposedfs) UpdateStorageSpace(ctx context.Context, req *provider.Up
}
}

spaceType := filepath.Base(filepath.Dir(matches[0]))
updated, err := fs.storageSpaceFromNode(ctx, node, matches[0], spaceType)
if err != nil {
return nil, err
}

return &provider.UpdateStorageSpaceResponse{
Status: &v1beta11.Status{Code: v1beta11.Code_CODE_OK},
StorageSpace: updated,
StorageSpace: space,
}, nil
}

Expand Down

0 comments on commit f52002f

Please sign in to comment.