diff --git a/tests/acceptance/features/apiSpacesShares/shareSpaces.feature b/tests/acceptance/features/apiSpacesShares/shareSpaces.feature index 035871cf48..75b03955c7 100644 --- a/tests/acceptance/features/apiSpacesShares/shareSpaces.feature +++ b/tests/acceptance/features/apiSpacesShares/shareSpaces.feature @@ -60,7 +60,7 @@ Feature: Share spaces | name | share space | When user "Alice" unshares a space "share space" to user "Brian" Then the HTTP status code should be "200" - Then the user "Brian" should not have a space called "share space" + And the user "Brian" should not have a space called "share space" Scenario Outline: Owner of a space cannot see the space after removing his access to the space @@ -188,3 +188,44 @@ Feature: Share spaces | manager | | editor | | viewer | + + + Scenario Outline: The user has no access to the space if access for the group has been removed + Given group "group2" has been created + And the administrator has added a user "Brian" to the group "group2" using GraphApi + And user "Alice" has shared a space "share space" to group "group2" with role "" + When user "Alice" unshares a space "share space" to group "group2" + Then the HTTP status code should be "200" + And the user "Brian" should not have a space called "share space" + Examples: + | role | + | manager | + | editor | + | viewer | + + + Scenario: The user has no access to the space if he has been removed from the group + Given group "group2" has been created + And the administrator has added a user "Brian" to the group "group2" using GraphApi + And the administrator has added a user "Bob" to the group "group2" using GraphApi + And user "Alice" has shared a space "share space" to group "group2" with role "editor" + When the administrator removes the following users from the following groups using the Graph API + | username | groupname | + | Brian | group2 | + Then the HTTP status code of responses on all endpoints should be "204" + And the user "Brian" should not have a space called "share space" + But the user "Bob" should have a space called "share space" with these key and value pairs: + | key | value | + | driveType | project | + | name | share space | + + + Scenario: Users don't have access to the space if the group has been deleted + Given group "group2" has been created + And the administrator has added a user "Brian" to the group "group2" using GraphApi + And the administrator has added a user "Bob" to the group "group2" using GraphApi + And user "Alice" has shared a space "share space" to group "group2" with role "editor" + When the administrator deletes group "group2" using the Graph API + Then the HTTP status code should be "204" + And the user "Brian" should not have a space called "share space" + And the user "Bob" should not have a space called "share space" \ No newline at end of file diff --git a/tests/acceptance/features/bootstrap/GraphContext.php b/tests/acceptance/features/bootstrap/GraphContext.php index 92b857452f..4d48836667 100644 --- a/tests/acceptance/features/bootstrap/GraphContext.php +++ b/tests/acceptance/features/bootstrap/GraphContext.php @@ -1021,7 +1021,7 @@ class GraphContext implements Context { * * @return void */ - public function userDeletesGroupUsingTheGraphApi(string $group, ?string $user): void { + public function userDeletesGroupUsingTheGraphApi(string $group, ?string $user = null): void { $groupId = $this->featureContext->getAttributeOfCreatedGroup($group, "id"); $response = $this->userDeletesGroupWithGroupId($groupId, $user); $this->featureContext->setResponse($response); diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index c4d77784ee..7d1e0d7e7d 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -2040,11 +2040,11 @@ class SpacesContext implements Context { } /** - * @Given /^user "([^"]*)" has shared a space "([^"]*)" to user "([^"]*)" with role "([^"]*)"$/ + * @Given /^user "([^"]*)" has shared a space "([^"]*)" to (?:user|group) "([^"]*)" with role "([^"]*)"$/ * * @param string $user * @param string $spaceName - * @param string $userRecipient + * @param string $recipient * @param string $role * * @return void @@ -2053,10 +2053,10 @@ class SpacesContext implements Context { public function userHasSharedSpace( string $user, string $spaceName, - string $userRecipient, + string $recipient, string $role ): void { - $this->sendShareSpaceRequest($user, $spaceName, $userRecipient, $role); + $this->sendShareSpaceRequest($user, $spaceName, $recipient, $role); $expectedHTTPStatus = "200"; $this->featureContext->theHTTPStatusCodeShouldBe( $expectedHTTPStatus, @@ -2067,11 +2067,11 @@ class SpacesContext implements Context { } /** - * @When /^user "([^"]*)" unshares a space "([^"]*)" to user "([^"]*)"$/ + * @When /^user "([^"]*)" unshares a space "([^"]*)" to (?:user|group) "([^"]*)"$/ * * @param string $user * @param string $spaceName - * @param string $userRecipient + * @param string $recipient * * @return void * @throws GuzzleException @@ -2079,10 +2079,10 @@ class SpacesContext implements Context { public function sendUnshareSpaceRequest( string $user, string $spaceName, - string $userRecipient + string $recipient ): void { $space = $this->getSpaceByName($user, $spaceName); - $fullUrl = $this->baseUrl . $this->ocsApiUrl . "/" . $space['id'] . "?shareWith=" . $userRecipient; + $fullUrl = $this->baseUrl . $this->ocsApiUrl . "/" . $space['id'] . "?shareWith=" . $recipient; $this->featureContext->setResponse( HttpRequestHelper::delete(