From 5383e55612e8daadd6ee059f87b14817a74c1cb7 Mon Sep 17 00:00:00 2001 From: pradip Date: Mon, 2 Dec 2024 17:10:32 +0545 Subject: [PATCH] test: change share role Denied to-and-fro role in Personal and Project space --- tests/acceptance/bootstrap/SpacesContext.php | 7 +- .../apiSharingNg1/sharedWithMe.feature | 107 ++++++++++++++++++ 2 files changed, 112 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/bootstrap/SpacesContext.php b/tests/acceptance/bootstrap/SpacesContext.php index c5d6810988..a6565fe297 100644 --- a/tests/acceptance/bootstrap/SpacesContext.php +++ b/tests/acceptance/bootstrap/SpacesContext.php @@ -2058,15 +2058,18 @@ class SpacesContext implements Context { * @return void * @throws GuzzleException */ - public function userShouldNotBeAbleToDownloadFileInsideSpace( + public function userShouldOrShouldNotBeAbleToDownloadFileFromSpace( string $user, string $fileName, string $spaceName ): void { + $spaceId = $this->getSpaceIdByName($user, $spaceName); $response = $this->featureContext->downloadFileAsUserUsingPassword( $user, $fileName, - $this->featureContext->getPasswordForUser($user) + $this->featureContext->getPasswordForUser($user), + null, + $spaceId ); Assert::assertGreaterThanOrEqual( 400, diff --git a/tests/acceptance/features/apiSharingNg1/sharedWithMe.feature b/tests/acceptance/features/apiSharingNg1/sharedWithMe.feature index e42c064d81..0fec4d0735 100755 --- a/tests/acceptance/features/apiSharingNg1/sharedWithMe.feature +++ b/tests/acceptance/features/apiSharingNg1/sharedWithMe.feature @@ -5268,3 +5268,110 @@ Feature: an user gets the resources shared to them Then the HTTP status code should be "200" And user "Brian" should not have a share "FolderToShare" shared by user "Alice" from space "NewSpace" And user "Brian" should not be able to download file "FolderToShare/lorem.txt" from space "Shares" + + @env-config + Scenario Outline: check share access after updating the permission role of a shared folder from other roles to Denied (Personal Space) + Given using spaces DAV path + And the administrator has enabled the permissions role "Denied" + And user "Alice" has created folder "FolderToShare" + And user "Alice" has uploaded file with content "hello world" to "FolderToShare/lorem.txt" + And user "Alice" has sent the following resource share invitation: + | resource | FolderToShare | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | | + And user "Alice" has updated the last resource share with the following properties: + | permissionsRole | Denied | + | space | Personal | + | resource | FolderToShare | + When user "Brian" lists the shares shared with him using the Graph API + Then the HTTP status code should be "200" + And user "Brian" should not have a share "FolderToShare" shared by user "Alice" from space "Personal" + And user "Brian" should not be able to download file "FolderToShare/lorem.txt" from space "Shares" + Examples: + | permissions-role | + | Editor | + | Viewer | + | Uploader | + + @env-config + Scenario Outline: check share access after updating the permission role of a shared folder from Denied to other roles (Personal Space) + Given using spaces DAV path + And the administrator has enabled the permissions role "Denied" + And user "Alice" has created folder "FolderToShare" + And user "Alice" has uploaded file with content "hello world" to "FolderToShare/lorem.txt" + And user "Alice" has sent the following resource share invitation: + | resource | FolderToShare | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Denied | + And user "Alice" has updated the last resource share with the following properties: + | permissionsRole | | + | space | Personal | + | resource | FolderToShare | + When user "Brian" lists the shares shared with him using the Graph API + Then the HTTP status code should be "200" + And user "Brian" should have a share "FolderToShare" shared by user "Alice" from space "Personal" + And for user "Brian" the content of the file "FolderToShare/lorem.txt" of the space "Shares" should be "hello world" + Examples: + | permissions-role | + | Editor | + | Viewer | + | Uploader | + + @env-config + Scenario Outline: check share access after updating the permission role of a shared folder from other roles to Denied (Project Space) + Given using spaces DAV path + And the administrator has enabled the permissions role "Denied" + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "NewSpace" with the default quota using the Graph API + And user "Alice" has created a folder "FolderToShare" in space "NewSpace" + And user "Alice" has uploaded a file inside space "NewSpace" with content "hello world" to "FolderToShare/lorem.txt" + And user "Alice" has sent the following resource share invitation: + | resource | FolderToShare | + | space | NewSpace | + | sharee | Brian | + | shareType | user | + | permissionsRole | | + And user "Alice" has updated the last resource share with the following properties: + | permissionsRole | Denied | + | space | NewSpace | + | resource | FolderToShare | + When user "Brian" lists the shares shared with him using the Graph API + Then the HTTP status code should be "200" + And user "Brian" should not have a share "FolderToShare" shared by user "Alice" from space "NewSpace" + Examples: + | permissions-role | + | Editor | + | Viewer | + | Uploader | + + @env-config + Scenario Outline: check share access after updating the permission role of a shared folder from Denied to other roles (Project Space) + Given using spaces DAV path + And the administrator has enabled the permissions role "Denied" + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "NewSpace" with the default quota using the Graph API + And user "Alice" has created a folder "FolderToShare" in space "NewSpace" + And user "Alice" has uploaded a file inside space "NewSpace" with content "hello world" to "FolderToShare/lorem.txt" + And user "Alice" has sent the following resource share invitation: + | resource | FolderToShare | + | space | NewSpace | + | sharee | Brian | + | shareType | user | + | permissionsRole | Denied | + And user "Alice" has updated the last resource share with the following properties: + | permissionsRole | | + | space | NewSpace | + | resource | FolderToShare | + When user "Brian" lists the shares shared with him using the Graph API + Then the HTTP status code should be "200" + And user "Brian" should have a share "FolderToShare" shared by user "Alice" from space "NewSpace" + And for user "Brian" the content of the file "FolderToShare/lorem.txt" of the space "Shares" should be "hello world" + Examples: + | permissions-role | + | Editor | + | Viewer | + | Uploader |