Skip to content

Commit

Permalink
fix update storage spaces for admins (#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 Oct 22, 2021
1 parent 60760bd commit 84a5191
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 84a5191

Please sign in to comment.