diff --git a/changelog/unreleased/space-owner.md b/changelog/unreleased/space-owner.md new file mode 100644 index 0000000000..ff41e37bac --- /dev/null +++ b/changelog/unreleased/space-owner.md @@ -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 diff --git a/go.sum b/go.sum index 92811f459c..a3d9fbc1d7 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/services/graph/pkg/service/v0/drives.go b/services/graph/pkg/service/v0/drives.go index fd8c257093..dfe702240a 100644 --- a/services/graph/pkg/service/v0/drives.go +++ b/services/graph/pkg/service/v0/drives.go @@ -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()) diff --git a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md index 0e74c2fda2..53ea58b38f 100644 --- a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md @@ -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) diff --git a/tests/acceptance/features/apiSpaces/editPublicLinkOfSpace.feature b/tests/acceptance/features/apiSpaces/editPublicLinkOfSpace.feature index e359dac65f..764d0f63e5 100644 --- a/tests/acceptance/features/apiSpaces/editPublicLinkOfSpace.feature +++ b/tests/acceptance/features/apiSpaces/editPublicLinkOfSpace.feature @@ -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 | | - | share_type | public_link | - | displayname_file_owner | %displayname% | - | displayname_owner | %displayname% | - | uid_file_owner | %username% | - | uid_owner | %username% | - | name | | - | expiration | | + | item_type | folder | + | mimetype | httpd/unix-directory | + | file_target | / | + | path | / | + | permissions | | + | share_type | public_link | + | displayname_owner | %displayname% | + | name | | + | expiration | | 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 "" 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 diff --git a/tests/acceptance/features/apiSpaces/shareSpacesViaLink.feature b/tests/acceptance/features/apiSpaces/shareSpacesViaLink.feature index 8260c4a52f..643157df97 100644 --- a/tests/acceptance/features/apiSpaces/shareSpacesViaLink.feature +++ b/tests/acceptance/features/apiSpaces/shareSpacesViaLink.feature @@ -32,9 +32,7 @@ Feature: Share spaces via link | path | / | | permissions | | | share_type | public_link | - | displayname_file_owner | %displayname% | | displayname_owner | %displayname% | - | uid_file_owner | %username% | | uid_owner | %username% | | name | | 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 "" @@ -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 | diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index be50ff8677..b95f252295 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -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");