Merge pull request #4244 from owncloud/space-owner

[full-ci] set no owner on non-personal spaces
This commit is contained in:
Michael Barz
2022-08-01 17:45:17 +02:00
committed by GitHub
7 changed files with 30 additions and 44 deletions

View File

@@ -0,0 +1,5 @@
Bugfix: Space Creators can hand over spaces
Set no owner on non personal spaces to be able to pass the space manager role to a new user.
https://github.com/owncloud/ocis/pull/4244

2
go.sum
View File

@@ -285,8 +285,6 @@ github.com/crewjam/saml v0.4.6 h1:XCUFPkQSJLvzyl4cW9OvpWUbRf0gE7VUpU8ZnilbeM4=
github.com/crewjam/saml v0.4.6/go.mod h1:ZBOXnNPFzB3CgOkRm7Nd6IVdkG+l/wF+0ZXLqD96t1A=
github.com/cs3org/go-cs3apis v0.0.0-20220711084433-8f71d4e812a3 h1:QSQ2DGKPMChB4vHSs1Os9TnOJl21BrzKX9D5EtQfDog=
github.com/cs3org/go-cs3apis v0.0.0-20220711084433-8f71d4e812a3/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY=
github.com/cs3org/reva/v2 v2.7.3-0.20220727111802-29f9f53c2f19 h1:Pu08T+aUlr/MTxBlqdoJx/i8ujtg5zSxGkulBbp89J8=
github.com/cs3org/reva/v2 v2.7.3-0.20220727111802-29f9f53c2f19/go.mod h1:9FpnWdVFw7ld3iOiuzHHQeCyVH/Ct9h03PZV9ZRplPM=
github.com/cs3org/reva/v2 v2.7.3-0.20220729123357-51c6d5d0c041 h1:ObeKsyxTeYJoPyKqjz6qBjd9Q4kDjT1Fht3lGzOOfdc=
github.com/cs3org/reva/v2 v2.7.3-0.20220729123357-51c6d5d0c041/go.mod h1:9FpnWdVFw7ld3iOiuzHHQeCyVH/Ct9h03PZV9ZRplPM=
github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8 h1:Z9lwXumT5ACSmJ7WGnFl+OMLLjpz5uR2fyz7dC255FI=

View File

@@ -223,7 +223,6 @@ func (g Graph) CreateDrive(w http.ResponseWriter, r *http.Request) {
}
csr := storageprovider.CreateStorageSpaceRequest{
Owner: us,
Type: driveType,
Name: spaceName,
Quota: getQuota(drive.Quota, g.config.Spaces.DefaultQuota),
@@ -237,6 +236,10 @@ func (g Graph) CreateDrive(w http.ResponseWriter, r *http.Request) {
csr.Opaque = utils.AppendPlainToOpaque(csr.Opaque, "spaceAlias", *drive.DriveAlias)
}
if driveType == "personal" {
csr.Owner = us
}
resp, err := client.CreateStorageSpace(r.Context(), &csr)
if err != nil {
errorcode.GeneralException.Render(w, r, http.StatusInternalServerError, err.Error())

View File

@@ -22,10 +22,6 @@ The expected failures in this file are from features in the owncloud/ocis repo.
### [Search by shares jail works incorrect](https://github.com/owncloud/ocis/issues/4014)
- [apiSpaces/search.feature:43](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/search.feature#L43)
### [Space Admin still has access to the project despite being removed from it](https://github.com/owncloud/ocis/issues/4127)
- [apiSpaces/shareSpaces.feature:77](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/shareSpaces.feature#L77)
- [apiSpaces/shareSpaces.feature:78](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/shareSpaces.feature#L78)
### [Depth infinity not supported for space Shares Jail](https://github.com/owncloud/ocis/issues/4188)
- [apiSpaces/copySpaces.feature:112](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/copySpaces.feature#L112)
- [apiSpaces/copySpaces.feature:113](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/copySpaces.feature#L113)
@@ -43,9 +39,6 @@ The expected failures in this file are from features in the owncloud/ocis repo.
- [apiSpaces/moveSpaces.feature:186](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/moveSpaces.feature#L186)
- [apiSpaces/moveSpaces.feature:189](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/moveSpaces.feature#L189)
### [A space manager cannot see the public links of another manager](https://github.com/owncloud/ocis/issues/4260)
- [apiSpaces/editPublicLinkOfSpace.feature:67](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/editPublicLinkOfSpace.feature#L67)
### [User without space manager role cannot restore space](https://github.com/owncloud/ocis/issues/4027)
- [apiSpaces/restoreSpaces.feature:63](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/restoreSpaces.feature#L63)
- [apiSpaces/restoreSpaces.feature:64](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/restoreSpaces.feature#L64)

View File

@@ -35,18 +35,15 @@ Feature: A manager of the space can edit public link
And the OCS status code should be "200"
And the OCS status message should be "OK"
And the fields of the last response to user "Alice" should include
| item_type | folder |
| mimetype | httpd/unix-directory |
| file_target | / |
| path | / |
| permissions | <expectedPermissions> |
| share_type | public_link |
| displayname_file_owner | %displayname% |
| displayname_owner | %displayname% |
| uid_file_owner | %username% |
| uid_owner | %username% |
| name | <linkName> |
| expiration | <expireDate> |
| item_type | folder |
| mimetype | httpd/unix-directory |
| file_target | / |
| path | / |
| permissions | <expectedPermissions> |
| share_type | public_link |
| displayname_owner | %displayname% |
| name | <linkName> |
| expiration | <expireDate> |
And the public should be able to download file "/test.txt" from inside the last public link shared folder using the new public WebDAV API with password "<password>"
And the downloaded content should be "some content"
Examples:
@@ -65,8 +62,8 @@ Feature: A manager of the space can edit public link
Examples:
| role | shouldOrNot |
| manager | should |
| editor | should not |
| viewer | should not |
| editor | should |
| viewer | should |
Scenario Outline: Members of the space try to edit a public link

View File

@@ -32,9 +32,7 @@ Feature: Share spaces via link
| path | / |
| permissions | <expectedPermissions> |
| share_type | public_link |
| displayname_file_owner | %displayname% |
| displayname_owner | %displayname% |
| uid_file_owner | %username% |
| uid_owner | %username% |
| name | <linkName> |
And the public should be able to download file "/test.txt" from inside the last public link shared folder using the new public WebDAV API with password "<password>"
@@ -57,17 +55,15 @@ Feature: Share spaces via link
And the OCS status code should be "200"
And the OCS status message should be "OK"
And the fields of the last response to user "Alice" should include
| item_type | folder |
| mimetype | httpd/unix-directory |
| file_target | / |
| path | / |
| permissions | create |
| share_type | public_link |
| displayname_file_owner | %displayname% |
| displayname_owner | %displayname% |
| uid_file_owner | %username% |
| uid_owner | %username% |
| name | forUpload |
| item_type | folder |
| mimetype | httpd/unix-directory |
| file_target | / |
| path | / |
| permissions | create |
| share_type | public_link |
| displayname_owner | %displayname% |
| uid_owner | %username% |
| name | forUpload |
And the public should be able to upload file "lorem.txt" into the last public link shared folder using the new public WebDAV API with password "123"
And for user "Alice" the space "share space" should contain these entries:
| lorem.txt |

View File

@@ -2843,18 +2843,12 @@ class SpacesContext implements Context {
string $shouldOrNot
): void {
$space = $this->getSpaceByName($user, $spaceName);
$url = "/apps/files_sharing/api/v1/shares";
$bodyTable = new TableNode([
["space_ref", $space['id']],
["reshares", true],
]);
$url = "/apps/files_sharing/api/v1/shares?reshares=true&space_ref=" . $space['id'];
$this->ocsContext->userSendsHTTPMethodToOcsApiEndpointWithBody(
$user,
'GET',
$url,
$bodyTable
);
$should = ($shouldOrNot !== "not");