mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-02-28 17:38:59 -06:00
[tests-only][full-ci] List permission and share a project space with allowed roles (#8959)
* List permission and share a project space with allowed roles Signed-off-by: sagargurung1001@gmail.com <sagargurung1001@gmail.com> * Review addres Signed-off-by: sagargurung1001@gmail.com <sagargurung1001@gmail.com> --------- Signed-off-by: sagargurung1001@gmail.com <sagargurung1001@gmail.com>
This commit is contained in:
@@ -1668,8 +1668,14 @@ class GraphHelper {
|
||||
return 'File Editor';
|
||||
case '1c996275-f1c9-4e71-abdf-a42f6495e960':
|
||||
return 'Uploader';
|
||||
case 'a8d5fe5e-96e3-418d-825b-534dbdf22b99':
|
||||
return 'Space Viewer';
|
||||
case '58c63c02-1d89-4572-916a-870abc5a1b7d':
|
||||
return 'Space Editor';
|
||||
case '312c0871-5ef7-4b3a-85b6-0e4074c64049':
|
||||
return 'Manager';
|
||||
default:
|
||||
throw new \Exception('Role ' . $permissionsRoleId . ' not found');
|
||||
throw new \Exception('Permission role id: ' . $permissionsRoleId . ' not found');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -896,7 +896,7 @@ Feature: List a sharing permissions
|
||||
And user "Brian" has been created with default attributes and without skeleton files
|
||||
When user "Alice" gets permissions list for file "textfile.txt" of the space "Personal" using the Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And user "Alice" should be able to send share invitation with all allowed permission roles
|
||||
And user "Alice" should be able to send share the following invitation with all allowed permission roles
|
||||
| resource | textfile.txt |
|
||||
| space | Personal |
|
||||
| sharee | Brian |
|
||||
@@ -908,7 +908,7 @@ Feature: List a sharing permissions
|
||||
And user "Brian" has been created with default attributes and without skeleton files
|
||||
When user "Alice" gets permissions list for folder "folder" of the space "Personal" using the Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And user "Alice" should be able to send share invitation with all allowed permission roles
|
||||
And user "Alice" should be able to send share the following invitation with all allowed permission roles
|
||||
| resource | folder |
|
||||
| space | Personal |
|
||||
| sharee | Brian |
|
||||
@@ -1081,6 +1081,19 @@ Feature: List a sharing permissions
|
||||
| Shares |
|
||||
|
||||
|
||||
Scenario: space admin invites to a project space with all allowed roles
|
||||
Given using spaces DAV path
|
||||
And the administrator has assigned the role "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 "Brian" has been created with default attributes and without skeleton files
|
||||
When user "Alice" lists the permissions of space "new-space" using permissions endpoint of the Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And user "Alice" should be able to send share the following invitation with all allowed permission roles
|
||||
| space | new-space |
|
||||
| sharee | Brian |
|
||||
| shareType | user |
|
||||
|
||||
|
||||
Scenario: user sends share invitation with all allowed roles for a file in project space
|
||||
Given using spaces DAV path
|
||||
And the administrator has assigned the role "Admin" to user "Alice" using the Graph API
|
||||
@@ -1089,7 +1102,7 @@ Feature: List a sharing permissions
|
||||
And user "Brian" has been created with default attributes and without skeleton files
|
||||
When user "Alice" gets permissions list for file "textfile.txt" of the space "new-space" using the Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And user "Alice" should be able to send share invitation with all allowed permission roles
|
||||
And user "Alice" should be able to send share the following invitation with all allowed permission roles
|
||||
| resource | textfile.txt |
|
||||
| space | new-space |
|
||||
| sharee | Brian |
|
||||
@@ -1311,7 +1324,7 @@ Feature: List a sharing permissions
|
||||
And user "Brian" has been created with default attributes and without skeleton files
|
||||
When user "Alice" gets permissions list for folder "folder" of the space "new-space" using the Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And user "Alice" should be able to send share invitation with all allowed permission roles
|
||||
And user "Alice" should be able to send share the following invitation with all allowed permission roles
|
||||
| resource | folder |
|
||||
| space | new-space |
|
||||
| sharee | Brian |
|
||||
|
||||
@@ -800,7 +800,7 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then user :user should be able to send share invitation with all allowed permission roles
|
||||
* @Then user :user should be able to send share the following invitation with all allowed permission roles
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $table
|
||||
@@ -809,7 +809,7 @@ class SharingNgContext implements Context {
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function userShouldBeAbleToSendShareInvitationWithAllAllowedPermissionRoles(string $user, TableNode $table): void {
|
||||
public function userShouldBeAbleToSendShareTheFollowingInvitationWithAllAllowedPermissionRoles(string $user, TableNode $table): void {
|
||||
$listPermissionResponse = $this->featureContext->getJsonDecodedResponseBodyContent();
|
||||
if (!isset($listPermissionResponse->{'@libre.graph.permissions.roles.allowedValues'})) {
|
||||
Assert::fail(
|
||||
@@ -825,9 +825,12 @@ class SharingNgContext implements Context {
|
||||
$shareInvitationRequestResult = "From the given allowed role lists from the permissions:\n";
|
||||
$areAllSendInvitationSuccessFullForAllowedRoles = true;
|
||||
$rows = $table->getRowsHash();
|
||||
$resource = $rows['resource'];
|
||||
// when sending share invitation for a project space, the resource to be shared is project space itself. So resource can be put as empty
|
||||
$resource = $rows['resource'] ?? '';
|
||||
$shareType = $rows['shareType'];
|
||||
$space = $rows['space'];
|
||||
//this details is needed for result logging purpose to determine whether the resource shared is a resource or a project space
|
||||
$resourceDetail = ($resource) ? "resource '" . $resource : "space '" . $space;
|
||||
foreach ($allowedPermissionRoles as $role) {
|
||||
//we should be able to send share invitation for each of the role allowed for the files/folders which are listed in permissions (allowed)
|
||||
$roleAllowed = GraphHelper::getPermissionNameByPermissionRoleId($role->id);
|
||||
@@ -840,7 +843,7 @@ class SharingNgContext implements Context {
|
||||
Assert::assertEquals(204, $removePermissionsResponse->getStatusCode());
|
||||
} else {
|
||||
$areAllSendInvitationSuccessFullForAllowedRoles = false;
|
||||
$shareInvitationRequestResult .= "\tShare invitation for resource '" . $resource . "' with role '" . $roleAllowed . "' failed and was not allowed.\n";
|
||||
$shareInvitationRequestResult .= "\tShare invitation for " . $resourceDetail . "' with role '" . $roleAllowed . "' failed and was not allowed.\n";
|
||||
}
|
||||
}
|
||||
Assert::assertTrue($areAllSendInvitationSuccessFullForAllowedRoles, $shareInvitationRequestResult);
|
||||
|
||||
Reference in New Issue
Block a user