From 71351989578fa124c3205c0e878430ab2a67bf85 Mon Sep 17 00:00:00 2001 From: prashant-gurung899 Date: Wed, 27 Nov 2024 12:51:20 +0545 Subject: [PATCH] add tests to remove access of shared resource to federated user Signed-off-by: prashant-gurung899 --- .../acceptance/bootstrap/SharingNgContext.php | 12 ++++-- .../acceptance/features/apiOcm/share.feature | 42 +++++++++++++++++++ 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/tests/acceptance/bootstrap/SharingNgContext.php b/tests/acceptance/bootstrap/SharingNgContext.php index 8d49ba3959f..804938112a3 100644 --- a/tests/acceptance/bootstrap/SharingNgContext.php +++ b/tests/acceptance/bootstrap/SharingNgContext.php @@ -1808,16 +1808,22 @@ public function checkIfShareExists(string $share, string $sharee, string $sharer } /** - * @Then user :sharee should have a share :share shared by user :sharer + * @Then /^user "([^"]*)" should (not |)have a share "([^"]*)" shared by user "([^"]*)"$/ * * @param string $sharee + * @param string $shouldOrNot * @param string $share * @param string $sharer * * @return void + * @throws Exception */ - public function userShouldHaveShare(string $sharee, string $share, string $sharer): void { - $this->checkIfShareExists($share, $sharee, $sharer); + public function userShouldHaveShare(string $sharee, string $shouldOrNot, string $share, string $sharer): void { + if (trim($shouldOrNot) === "not") { + Assert::assertFalse($this->checkIfShareExists($share, $sharee, $sharer), "Share $share should not be available for a user"); + } else { + Assert::assertTrue($this->checkIfShareExists($share, $sharee, $sharer), "Space $share should be available for a user '$sharee' but not found"); + } } /** diff --git a/tests/acceptance/features/apiOcm/share.feature b/tests/acceptance/features/apiOcm/share.feature index 5ce6bbcca16..58410890fab 100755 --- a/tests/acceptance/features/apiOcm/share.feature +++ b/tests/acceptance/features/apiOcm/share.feature @@ -776,3 +776,45 @@ Feature: an user shares resources using ScienceMesh application And for user "Brian" the content of file "textfile.txt" of federated share "textfile.txt" should be "this is a new content" And using server "LOCAL" And for user "Alice" the content of the file "textfile.txt" of the space "Personal" should be "this is a new content" + + @issue-10213 + Scenario: local user deletes access of shared resource to federated user + Given using spaces DAV path + And using server "REMOTE" + And "Brian" has created the federation share invitation + And using server "LOCAL" + And "Alice" has accepted invitation + And user "Alice" has created a folder "FOLDER" in space "Personal" + And user "Alice" has sent the following resource share invitation to federated user: + | resource | FOLDER | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Editor | + When user "Alice" removes the access of user "Brian" from resource "FOLDER" of space "Personal" using the Graph API + Then the HTTP status code should be "204" + When using server "REMOTE" + And user "Brian" lists the shares shared with him without retry using the Graph API + Then the HTTP status code should be "200" + And user "Brian" should have a share "FOLDER" shared by user "Alice" + + @issue-10213 + Scenario: federation user deletes access of shared resource to local user + Given using spaces DAV path + And using server "LOCAL" + And "Alice" has created the federation share invitation + And using server "REMOTE" + And "Brian" has accepted invitation + And user "Brian" has created a folder "FOLDER" in space "Personal" + And user "Brian" has sent the following resource share invitation to federated user: + | resource | FOLDER | + | space | Personal | + | sharee | Alice | + | shareType | user | + | permissionsRole | Editor | + When user "Brian" removes the access of user "Alice" from resource "FOLDER" of space "Personal" using the Graph API + Then the HTTP status code should be "204" + When using server "LOCAL" + And user "Alice" lists the shares shared with her without retry using the Graph API + Then the HTTP status code should be "200" + And user "Alice" should not have a share "FOLDER" shared by user "Brian"