From 2628061329f30031ee5547056e217ebe7cf376f1 Mon Sep 17 00:00:00 2001 From: Niraj Acharya Date: Fri, 16 Feb 2024 17:19:07 +0545 Subject: [PATCH] adding test for listing filae and folder permissions in personal and project space --- ...ected-failures-localAPI-on-OCIS-storage.md | 4 + .../apiSharingNg/listPermissions.feature | 332 +++++++++++++++++- 2 files changed, 335 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md index 9e32b785ba9..96ea1d9168f 100644 --- a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md @@ -254,6 +254,10 @@ The expected failures in this file are from features in the owncloud/ocis repo. - [apiSharingNg/deletePermissions.feature:141](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/deletePermissions.feature#L141) - [apiSharingNg/deletePermissions.feature:161](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/deletePermissions.feature#L161) - [apiSharingNg/deletePermissions.feature:179](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/deletePermissions.feature#L179) +- [apiSharingNg/listPermissions.feature:10](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/listPermissions.feature#L10) +- [apiSharingNg/listPermissions.feature:166](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/listPermissions.feature#L166) +- [apiSharingNg/listPermissions.feature:283](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/listPermissions.feature#L283) +- [apiSharingNg/listPermissions.feature:431](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/listPermissions.feature#L431) ### [sharee (editor role) MOVE a file by file-id into same shared folder returns 403](https://github.com/owncloud/ocis/issues/7617) diff --git a/tests/acceptance/features/apiSharingNg/listPermissions.feature b/tests/acceptance/features/apiSharingNg/listPermissions.feature index 5efcbb718c7..7b8ff2b874d 100644 --- a/tests/acceptance/features/apiSharingNg/listPermissions.feature +++ b/tests/acceptance/features/apiSharingNg/listPermissions.feature @@ -7,7 +7,7 @@ Feature: List a sharing permissions | Alice | - Scenario: user lists permissions via the Graph API + Scenario: user lists permissions of a folder in personal space via the Graph API Given 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" @@ -560,3 +560,333 @@ Feature: List a sharing permissions } } """ + + + @issues-8331 + Scenario: user lists permissions of a file in personal space via the Graph API + Given user "Alice" has uploaded file with content "hello world" to "/textfile0.txt" + When user "Alice" gets permissions list for file "textfile0.txt" 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.actions.allowedValues": { + "type": "array", + "enum": [ + [ + "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": 2, + "maxItems": 2, + "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": "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" + } + } + }, + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "@libre.graph.weight": { + "const": 2 + }, + "description": { + "const": "View, download and edit." + }, + "displayName": { + "const": "Can edit" + }, + "id": { + "const": "2d00ce52-1fc2-4dbc-8b95-a73b73395f5a" + } + } + } + ] + } + } + } + } + """ + + @issues-8331 + Scenario: user lists permissions of a folder in project space via the Graph API + 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 "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.actions.allowedValues": { + "type": "array", + "enum": [ + [ + "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": "View, download and upload." + }, + "displayName": { + "const": "Can upload" + }, + "id": { + "const": "1c996275-f1c9-4e71-abdf-a42f6495e960" + } + } + }, + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "@libre.graph.weight": { + "const": 2 + }, + "description": { + "const": "View and download." + }, + "displayName": { + "const": "Can view" + }, + "id": { + "const": "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" + } + } + }, + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "@libre.graph.weight": { + "const": 3 + }, + "description": { + "const": "View, download, upload, edit, add and delete." + }, + "displayName": { + "const": "Can edit" + }, + "id": { + "const": "fb6c3e19-e378-47e5-b277-9732f9de6e21" + } + } + } + ] + } + } + } + } + """ + + @issues-8331 + Scenario: user lists permissions of a file in project space via the Graph API + 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 "Alice" has uploaded a file inside space "new-space" with content "hello world" to "textfile0.txt" + When user "Alice" gets permissions list for folder "textfile0.txt" 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.actions.allowedValues": { + "type": "array", + "enum": [ + [ + "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": 2, + "maxItems": 2, + "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": "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" + } + } + }, + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "@libre.graph.weight": { + "const": 2 + }, + "description": { + "const": "View, download and edit." + }, + "displayName": { + "const": "Can edit" + }, + "id": { + "const": "2d00ce52-1fc2-4dbc-8b95-a73b73395f5a" + } + } + } + ] + } + } + } + } + """ \ No newline at end of file