From 89baa049b7dd42c9d0504e4aba90a05143f7eabe Mon Sep 17 00:00:00 2001 From: Niraj Acharya Date: Wed, 4 Dec 2024 10:12:14 +0545 Subject: [PATCH] adding test for listing permission of a folder in personal and project space with denied role enabled --- tests/acceptance/TestHelpers/GraphHelper.php | 1 + .../apiSharingNg1/listPermissions.feature | 191 ++++++++++++++++++ 2 files changed, 192 insertions(+) diff --git a/tests/acceptance/TestHelpers/GraphHelper.php b/tests/acceptance/TestHelpers/GraphHelper.php index c0f8df597db..21aaeacb68c 100644 --- a/tests/acceptance/TestHelpers/GraphHelper.php +++ b/tests/acceptance/TestHelpers/GraphHelper.php @@ -43,6 +43,7 @@ class GraphHelper { public const ADDITIONAL_PERMISSIONS_ROLES = [ 'Secure Viewer' => 'aa97fe03-7980-45ac-9e50-b325749fd7e6', 'Space Editor Without Versions' => '3284f2d5-0070-4ad8-ac40-c247f7c1fb27', + 'Denied' => '63e64e19-8d43-42ec-a738-2b6af2610efa', ]; /** diff --git a/tests/acceptance/features/apiSharingNg1/listPermissions.feature b/tests/acceptance/features/apiSharingNg1/listPermissions.feature index 72f627f524f..7b78789ff7a 100644 --- a/tests/acceptance/features/apiSharingNg1/listPermissions.feature +++ b/tests/acceptance/features/apiSharingNg1/listPermissions.feature @@ -2392,3 +2392,194 @@ Feature: List a sharing permissions } } """ + + @env-config + Scenario: user lists permissions of a folder after enabling 'Denied' role + Given the administrator has enabled the permissions role "Denied" + And user "Alice" has created folder "folder" + 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 the JSON data of the response should match + """ + { + "type": "object", + "required": [ + "@libre.graph.permissions.actions.allowedValues", + "@libre.graph.permissions.roles.allowedValues" + ], + "properties": { + "@libre.graph.permissions.roles.allowedValues": { + "type": "array", + "minItems": 4, + "maxItems": 4, + "uniqueItems": true, + "items": { + "oneOf": [ + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "@libre.graph.weight": { + "const": 1 + }, + "description": { + "const": "Deny all access." + }, + "displayName": { + "const": "Cannot access" + }, + "id": { + "const": "63e64e19-8d43-42ec-a738-2b6af2610efa" + } + } + }, + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "displayName": { + "const": "Can view" + } + } + }, + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "displayName": { + "const": "Can upload" + } + } + }, + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "displayName": { + "const": "Can edit" + } + } + } + ] + } + } + } + } + """ + + @env-config + Scenario: user lists permissions of a folder inside a space after enabling 'Denied' role + 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 "new-space" with the default quota using the Graph API + And user "Alice" has created a folder "folder" in space "new-space" + 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 the JSON data of the response should match + """ + { + "type": "object", + "required": [ + "@libre.graph.permissions.actions.allowedValues", + "@libre.graph.permissions.roles.allowedValues" + ], + "properties": { + "@libre.graph.permissions.roles.allowedValues": { + "type": "array", + "minItems": 4, + "maxItems": 4, + "uniqueItems": true, + "items": { + "oneOf": [ + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "@libre.graph.weight": { + "const": 1 + }, + "description": { + "const": "Deny all access." + }, + "displayName": { + "const": "Cannot access" + }, + "id": { + "const": "63e64e19-8d43-42ec-a738-2b6af2610efa" + } + } + }, + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "displayName": { + "const": "Can view" + } + } + }, + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "displayName": { + "const": "Can upload" + } + } + }, + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "displayName": { + "const": "Can edit" + } + } + } + ] + } + } + } + } + """ \ No newline at end of file