From 5403f5287551bdf8b089bba3195f1df8e4d6c793 Mon Sep 17 00:00:00 2001 From: nirajacharya2 <122071597+nirajacharya2@users.noreply.github.com> Date: Thu, 21 Mar 2024 14:41:24 +0545 Subject: [PATCH] adding test for listing permissions of a project space after the space is shared to a user (#8491) --- .../apiSharingNg/listPermissions.feature | 491 ++++++++++++++---- 1 file changed, 382 insertions(+), 109 deletions(-) diff --git a/tests/acceptance/features/apiSharingNg/listPermissions.feature b/tests/acceptance/features/apiSharingNg/listPermissions.feature index 1ea0c11e7..f573dcdf1 100644 --- a/tests/acceptance/features/apiSharingNg/listPermissions.feature +++ b/tests/acceptance/features/apiSharingNg/listPermissions.feature @@ -209,116 +209,389 @@ Feature: List a sharing permissions When user "Alice" lists the permissions of 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.actions.allowedValues": { - "const": [ - "libre.graph/driveItem/permissions/create", - "libre.graph/driveItem/children/create", - "libre.graph/driveItem/standard/delete", - "libre.graph/driveItem/path/read", - "libre.graph/driveItem/quota/read", - "libre.graph/driveItem/content/read", - "libre.graph/driveItem/upload/create", - "libre.graph/driveItem/permissions/read", - "libre.graph/driveItem/children/read", - "libre.graph/driveItem/versions/read", - "libre.graph/driveItem/deleted/read", - "libre.graph/driveItem/path/update", - "libre.graph/driveItem/permissions/delete", - "libre.graph/driveItem/deleted/delete", - "libre.graph/driveItem/versions/update", - "libre.graph/driveItem/deleted/update", - "libre.graph/driveItem/basic/read", - "libre.graph/driveItem/permissions/update", - "libre.graph/driveItem/permissions/deny" - ] - }, - "@libre.graph.permissions.roles.allowedValues": { - "type": "array", - "minItems": 3, - "maxItems": 3, - "uniqueItems": true, - "items": { - "oneOf": [ - { - "type": "object", - "required": [ - "@libre.graph.weight", - "description", - "displayName", - "id" - ], - "properties": { - "@libre.graph.weight": { - "const": 1 - }, - "description": { - "const": "Allows reading the shared space" - }, - "displayName": { - "const": "Space Viewer" - }, - "id": { - "const": "a8d5fe5e-96e3-418d-825b-534dbdf22b99" - } - } - }, - { - "type": "object", - "required": [ - "@libre.graph.weight", - "description", - "displayName", - "id" - ], - "properties": { - "@libre.graph.weight": { - "const": 2 - }, - "description": { - "const": "Allows creating, reading, updating and deleting file or folder in the shared space" - }, - "displayName": { - "const": "Space Editor" - }, - "id": { - "const": "58c63c02-1d89-4572-916a-870abc5a1b7d" - } - } - }, - { - "type": "object", - "required": [ - "@libre.graph.weight", - "description", - "displayName", - "id" - ], - "properties": { - "@libre.graph.weight": { - "const": 3 - }, - "description": { - "const": "Grants manager permissions on a resource. Semantically equivalent to co-owner" - }, - "displayName": { - "const": "Manager" - }, - "id": { - "const": "312c0871-5ef7-4b3a-85b6-0e4074c64049" - } - } - } + """ + { + "type": "object", + "required": [ + "@libre.graph.permissions.actions.allowedValues", + "@libre.graph.permissions.roles.allowedValues" + ], + "properties": { + "@libre.graph.permissions.actions.allowedValues": { + "const": [ + "libre.graph/driveItem/permissions/create", + "libre.graph/driveItem/children/create", + "libre.graph/driveItem/standard/delete", + "libre.graph/driveItem/path/read", + "libre.graph/driveItem/quota/read", + "libre.graph/driveItem/content/read", + "libre.graph/driveItem/upload/create", + "libre.graph/driveItem/permissions/read", + "libre.graph/driveItem/children/read", + "libre.graph/driveItem/versions/read", + "libre.graph/driveItem/deleted/read", + "libre.graph/driveItem/path/update", + "libre.graph/driveItem/permissions/delete", + "libre.graph/driveItem/deleted/delete", + "libre.graph/driveItem/versions/update", + "libre.graph/driveItem/deleted/update", + "libre.graph/driveItem/basic/read", + "libre.graph/driveItem/permissions/update", + "libre.graph/driveItem/permissions/deny" ] + }, + "@libre.graph.permissions.roles.allowedValues": { + "type": "array", + "minItems": 3, + "maxItems": 3, + "uniqueItems": true, + "items": { + "oneOf": [ + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "@libre.graph.weight": { + "const": 1 + }, + "description": { + "const": "Allows reading the shared space" + }, + "displayName": { + "const": "Space Viewer" + }, + "id": { + "const": "a8d5fe5e-96e3-418d-825b-534dbdf22b99" + } + } + }, + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "@libre.graph.weight": { + "const": 2 + }, + "description": { + "const": "Allows creating, reading, updating and deleting file or folder in the shared space" + }, + "displayName": { + "const": "Space Editor" + }, + "id": { + "const": "58c63c02-1d89-4572-916a-870abc5a1b7d" + } + } + }, + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "@libre.graph.weight": { + "const": 3 + }, + "description": { + "const": "Grants manager permissions on a resource. Semantically equivalent to co-owner" + }, + "displayName": { + "const": "Manager" + }, + "id": { + "const": "312c0871-5ef7-4b3a-85b6-0e4074c64049" + } + } + } + ] + } } } } - } - """ + """ + + @issues-8352 + Scenario: sharer lists permissions of a shared project space + 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 | + And user "Alice" has created the following link share: + | space | new-space | + | permissionsRole | view | + | password | %public% | + | resource | new-space | + When user "Alice" lists the permissions of 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", + "value" + ], + "properties": { + "@libre.graph.permissions.actions.allowedValues": { + "const": [ + "libre.graph/driveItem/permissions/create", + "libre.graph/driveItem/children/create", + "libre.graph/driveItem/standard/delete", + "libre.graph/driveItem/path/read", + "libre.graph/driveItem/quota/read", + "libre.graph/driveItem/content/read", + "libre.graph/driveItem/upload/create", + "libre.graph/driveItem/permissions/read", + "libre.graph/driveItem/children/read", + "libre.graph/driveItem/versions/read", + "libre.graph/driveItem/deleted/read", + "libre.graph/driveItem/path/update", + "libre.graph/driveItem/permissions/delete", + "libre.graph/driveItem/deleted/delete", + "libre.graph/driveItem/versions/update", + "libre.graph/driveItem/deleted/update", + "libre.graph/driveItem/basic/read", + "libre.graph/driveItem/permissions/update", + "libre.graph/driveItem/permissions/deny" + ] + }, + "@libre.graph.permissions.roles.allowedValues": { + "type": "array", + "minItems": 3, + "maxItems": 3, + "uniqueItems": true, + "items": { + "oneOf": [ + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "@libre.graph.weight": { + "const": 1 + }, + "description": { + "const": "Allows reading the shared space" + }, + "displayName": { + "const": "Space Viewer" + }, + "id": { + "const": "a8d5fe5e-96e3-418d-825b-534dbdf22b99" + } + } + }, + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "@libre.graph.weight": { + "const": 2 + }, + "description": { + "const": "Allows creating, reading, updating and deleting file or folder in the shared space" + }, + "displayName": { + "const": "Space Editor" + }, + "id": { + "const": "58c63c02-1d89-4572-916a-870abc5a1b7d" + } + } + }, + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "@libre.graph.weight": { + "const": 3 + }, + "description": { + "const": "Grants manager permissions on a resource. Semantically equivalent to co-owner" + }, + "displayName": { + "const": "Manager" + }, + "id": { + "const": "312c0871-5ef7-4b3a-85b6-0e4074c64049" + } + } + } + ] + } + }, + "value": { + "type": "array", + "minItems": 3, + "maxItems": 3, + "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%$" + } + } + } + }, + { + "type": "object", + "required": [ + "hasPassword", + "id", + "link" + ], + "properties": { + "hasPassword": { + "const": true + }, + "id": { + "type": "string", + "pattern": "^[a-zA-Z]{15}$" + }, + "link": { + "type": "object", + "required": [ + "@libre.graph.displayName", + "@libre.graph.quickLink", + "preventsDownload", + "type", + "webUrl" + ], + "properties": { + "@libre.graph.displayName": { + "const": "" + }, + "@libre.graph.quickLink": { + "const": false + }, + "preventsDownload": { + "const": false + }, + "type": { + "const": "view" + }, + "webUrl": { + "type": "string", + "pattern": "^%base_url%\/s\/[a-zA-Z]{15}$" + } + } + } + } + } + ] + } + } + } + } + """ \ No newline at end of file