Skip to content

Commit

Permalink
added test to update role to existing roles after assigned role is di…
Browse files Browse the repository at this point in the history
…sabled
  • Loading branch information
PrajwolAmatya committed Jan 9, 2025
1 parent 6c95f19 commit 211dfd2
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/acceptance/bootstrap/SharingNgContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2119,4 +2119,22 @@ public function userGetsFederatedPermissionsListForFileOfTheSpaceUsingTheGraphAp
$this->getPermissionsList($user, $fileOrFolder, $space, $resource, $query)
);
}

/**
* @Then the updated permissions role of the last share should be :permissionsRole
*
* @param string $permissionsRole
*
* @return void
*/
public function theUpdatedPermissionsRoleOfTheLastShareShouldBe(string $permissionsRole): void {
$responseBody = $this->featureContext->getJsonDecodedResponseBodyContent();
$actualRoleId = $responseBody->roles[0];
$expectedRoleId = GraphHelper::getPermissionsRoleIdByName($permissionsRole);
Assert::assertEquals(
$actualRoleId,
$expectedRoleId,
"Expected permissions role id to be $expectedRoleId but found $actualRoleId"
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -547,3 +547,112 @@ Feature: enable disable permissions role
| oc:name | new-space |
| oc:permissions | DNVCK |
And user "Brian" should be able to download file "textfile1.txt" from space "new-space"


Scenario Outline: update share role of a file to an existing role after assigned share role Secure Viewer is disabled (Personal Space)
Given using spaces DAV path
And the administrator has enabled the permissions role "Secure Viewer"
And user "Alice" has uploaded file with content "some content" to "textfile.txt"
And user "Alice" has created folder "folderToShare"
And user "Alice" has uploaded file with content "hello world" to "folderToShare/textfile1.txt"
And user "Alice" has sent the following resource share invitation:
| resource | <resource> |
| space | Personal |
| sharee | Brian |
| shareType | user |
| permissionsRole | Secure Viewer |
And user "Brian" has a share "<resource>" synced
And the administrator has disabled the permissions role "Secure Viewer"
When user "Alice" updates the last resource share with the following properties using the Graph API:
| permissionsRole | <permissions-role> |
| space | Personal |
| resource | <resource> |
Then the HTTP status code should be "200"
And the updated permissions role of the last share should be "<permissions-role>"
And user "Brian" should have a share "<resource>" shared by user "Alice" from space "Personal"
When user "Brian" sends PROPFIND request from the space "Shares" to the resource "<resource>" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And as user "Brian" the PROPFIND response should contain a resource "<resource>" with these key and value pairs:
| key | value |
| oc:name | <resource> |
| oc:permissions | <permissions> |
And user "Brian" should be able to download file "<resource-to-download>" from space "Shares"
Examples:
| resource | permissions-role | permissions | resource-to-download |
| textfile.txt | File Editor | SNVW | textfile.txt |
| textfile.txt | Viewer | S | textfile.txt |
| folderToShare | Uploader | SCK | folderToShare/textfile1.txt |
| folderToShare | Editor | SDNVCK | folderToShare/textfile1.txt |
| folderToShare | Viewer | S | folderToShare/textfile1.txt |


Scenario Outline: update share role of a file to an existing role after assigned share role Secure Viewer is disabled (Project Space)
Given using spaces DAV path
And the administrator has enabled the permissions role "Secure Viewer"
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Alice" has created a space "new-space" with the default quota using the Graph API
And user "Alice" has uploaded a file inside space "new-space" with content "some content" to "textfile.txt"
And user "Alice" has created a folder "folderToShare" in space "new-space"
And user "Alice" has uploaded a file inside space "new-space" with content "hello world" to "folderToShare/textfile1.txt"
And user "Alice" has sent the following resource share invitation:
| resource | <resource> |
| space | new-space |
| sharee | Brian |
| shareType | user |
| permissionsRole | Secure Viewer |
And user "Brian" has a share "<resource>" synced
And the administrator has disabled the permissions role "Secure Viewer"
When user "Alice" updates the last resource share with the following properties using the Graph API:
| permissionsRole | <permissions-role> |
| space | new-space |
| resource | <resource> |
Then the HTTP status code should be "200"
And the updated permissions role of the last share should be "<permissions-role>"
And user "Brian" should have a share "<resource>" shared by user "Alice" from space "new-space"
When user "Brian" sends PROPFIND request from the space "Shares" to the resource "<resource>" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And as user "Brian" the PROPFIND response should contain a resource "<resource>" with these key and value pairs:
| key | value |
| oc:name | <resource> |
| oc:permissions | <permissions> |
And user "Brian" should be able to download file "<resource-to-download>" from space "Shares"
Examples:
| resource | permissions-role | permissions | resource-to-download |
| textfile.txt | File Editor | SNVW | textfile.txt |
| textfile.txt | Viewer | S | textfile.txt |
| folderToShare | Uploader | SCK | folderToShare/textfile1.txt |
| folderToShare | Editor | SDNVCK | folderToShare/textfile1.txt |
| folderToShare | Viewer | S | folderToShare/textfile1.txt |


Scenario Outline: update share role of a project space to an existing role after assigned share role is disabled
Given using spaces DAV path
And the administrator has enabled the permissions role "Space Editor Without Versions"
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Alice" has created a space "new-space" with the default quota using the Graph API
And user "Alice" has uploaded a file inside space "new-space" with content "some content" to "textfile.txt"
And user "Alice" has sent the following space share invitation:
| space | new-space |
| sharee | Brian |
| shareType | user |
| permissionsRole | Space Editor Without Versions |
And the administrator has disabled the permissions role "Space Editor Without Versions"
When user "Alice" updates the last drive share with the following using root endpoint of the Graph API:
| permissionsRole | <permissions-role> |
| space | new-space |
| shareType | user |
| sharee | Brian |
Then the HTTP status code should be "200"
And the updated permissions role of the last share should be "<permissions-role>"
When user "Brian" sends PROPFIND request to space "new-space" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And as user "Brian" the PROPFIND response should contain a space "new-space" with these key and value pairs:
| key | value |
| oc:name | new-space |
| oc:permissions | <permissions> |
And user "Brian" should be able to download file "textfile.txt" from space "new-space"
Examples:
| permissions-role | permissions |
| Space Viewer | |
| Space Editor | DNVCK |
| Manager | RDNVCKZP |

0 comments on commit 211dfd2

Please sign in to comment.