From baaf63015e9c9affee047ef57e0a6f9020d59948 Mon Sep 17 00:00:00 2001 From: nirajacharya2 <122071597+nirajacharya2@users.noreply.github.com> Date: Thu, 25 Apr 2024 12:26:07 +0545 Subject: [PATCH] adding test for listing permission of a project drive by a member with viewer permission (#8910) --- .../apiSharingNg/listPermissions.feature | 169 +++++++++++++++++- .../features/bootstrap/SharingNgContext.php | 2 +- 2 files changed, 168 insertions(+), 3 deletions(-) diff --git a/tests/acceptance/features/apiSharingNg/listPermissions.feature b/tests/acceptance/features/apiSharingNg/listPermissions.feature index 6c00151600..22bb086151 100644 --- a/tests/acceptance/features/apiSharingNg/listPermissions.feature +++ b/tests/acceptance/features/apiSharingNg/listPermissions.feature @@ -171,7 +171,7 @@ Feature: List a sharing permissions And user "Brian" has been created with default attributes and without skeleton files 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 - When user "Alice" lists the permissions of space "new-space" using the Graph API + 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 the JSON data of the response should match """ @@ -304,7 +304,7 @@ Feature: List a sharing permissions | permissionsRole | view | | password | %public% | | resource | new-space | - When user "Alice" lists the permissions of space "new-space" using the Graph API + 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 the JSON data of the response should match """ @@ -1136,3 +1136,168 @@ Feature: List a sharing permissions } } """ + + + Scenario: member with viewer role lists the permissions of a project space using permissions endpoint + Given using spaces DAV path + And user "Brian" has been created with default attributes and without skeleton files + 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 sent the following share invitation: + | space | new-space | + | sharee | Brian | + | shareType | user | + | permissionsRole | Space Viewer | + When user "Brian" lists the permissions of space "new-space" using permissions endpoint of the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": [ + "@libre.graph.permissions.actions.allowedValues", + "@libre.graph.permissions.roles.allowedValues", + "value" + ], + "properties": { + "@libre.graph.permissions.actions.allowedValues": { + "const": [ + "libre.graph/driveItem/path/read", + "libre.graph/driveItem/quota/read", + "libre.graph/driveItem/content/read", + "libre.graph/driveItem/permissions/read", + "libre.graph/driveItem/children/read", + "libre.graph/driveItem/deleted/read", + "libre.graph/driveItem/basic/read" + ] + }, + "@libre.graph.permissions.roles.allowedValues": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "uniqueItems": true, + "items": { + "oneOf": [ + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "@libre.graph.weight": { + "const": 1 + }, + "description": { + "const": "View and download." + }, + "displayName": { + "const": "Can view" + }, + "id": { + "const": "a8d5fe5e-96e3-418d-825b-534dbdf22b99" + } + } + } + ] + } + }, + "value": { + "type": "array", + "minItems": 2, + "maxItems": 2, + "uniqueItems": true, + "items": { + "oneOf":[ + { + "type": "object", + "required": [ + "grantedToV2", + "id", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["displayName","id"], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "displayName": { + "const": "Brian Murphy" + } + } + } + } + }, + "id": { + "type": "string", + "pattern": "^u:%user_id_pattern%$" + }, + "roles": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "string", + "pattern": "^%role_id_pattern%$" + } + } + } + }, + { + "type": "object", + "required": [ + "grantedToV2", + "id", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["displayName","id"], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "displayName": { + "const": "Alice Hansen" + } + } + } + } + }, + "id": { + "type": "string", + "pattern": "^u:%user_id_pattern%$" + }, + "roles": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "string", + "pattern": "^%role_id_pattern%$" + } + } + } + } + ] + } + } + } + } + """ \ No newline at end of file diff --git a/tests/acceptance/features/bootstrap/SharingNgContext.php b/tests/acceptance/features/bootstrap/SharingNgContext.php index b996dba39c..4f7f4d9831 100644 --- a/tests/acceptance/features/bootstrap/SharingNgContext.php +++ b/tests/acceptance/features/bootstrap/SharingNgContext.php @@ -138,7 +138,7 @@ class SharingNgContext implements Context { } /** - * @When /^user "([^"]*)" lists the permissions of space "([^"]*)" using the Graph API$/ + * @When /^user "([^"]*)" lists the permissions of space "([^"]*)" using permissions endpoint of the Graph API$/ * * @param string $user * @param string $space