diff --git a/tests/acceptance/bootstrap/OcisConfigContext.php b/tests/acceptance/bootstrap/OcisConfigContext.php index bec736a9580..a871d917af4 100644 --- a/tests/acceptance/bootstrap/OcisConfigContext.php +++ b/tests/acceptance/bootstrap/OcisConfigContext.php @@ -120,6 +120,37 @@ class OcisConfigContext implements Context { $this->setEnabledPermissionsRoles($defaultRoles); } + /** + * @Given the administrator has enabled the following share permissions roles: + * + * @param TableNode $table + * + * @return void + */ + public function theAdministratorHasEnabledTheFollowingShareRoles(TableNode $table): void { + $defaultRoles = array_values(GraphHelper::DEFAULT_PERMISSIONS_ROLES); + $roles = []; + foreach ($table->getHash() as $row) { + $roles[] = $row['role']; + $roleId = GraphHelper::getPermissionsRoleIdByName($row['role']); + if (!\in_array($roleId, $defaultRoles)) { + $defaultRoles[] = $roleId; + } + } + + $envs = [ + "GRAPH_AVAILABLE_ROLES" => implode(',', $defaultRoles), + ]; + $response = OcisConfigHelper::reConfigureOcis($envs); + + Assert::assertEquals( + 200, + $response->getStatusCode(), + "Failed to enable roles: " . implode(', ', $roles) + ); + $this->setEnabledPermissionsRoles($defaultRoles); + } + /** * @Given the administrator has disabled the permissions role :role * diff --git a/tests/acceptance/features/apiSharingNgAdditionalShareRole/editorWithVersions.feature b/tests/acceptance/features/apiSharingNgAdditionalShareRole/editorWithVersions.feature index f047501f53f..6ed6f19a02d 100644 --- a/tests/acceptance/features/apiSharingNgAdditionalShareRole/editorWithVersions.feature +++ b/tests/acceptance/features/apiSharingNgAdditionalShareRole/editorWithVersions.feature @@ -9,11 +9,14 @@ Feature: an user shares resources | username | | Alice | | Brian | + And the administrator has enabled the following share permissions roles: + | role | + | File Editor With Versions | + | Editor With Versions | Scenario: sharee checks version of a file shared with FileEditorWithVersions role - Given the administrator has enabled the permissions role "File Editor With Versions" - And user "Alice" has uploaded file with content "to share" to "textfile.txt" + Given user "Alice" has uploaded file with content "to share" to "textfile.txt" And we save it into "FILEID" When user "Alice" sends the following resource share invitation using the Graph API: | resource | textfile.txt | @@ -93,8 +96,7 @@ Feature: an user shares resources Scenario: sharee checks version of a file inside a folder shared with EditorWithVersions role - Given the administrator has enabled the permissions role "Editor With Versions" - And user "Alice" has created folder "folderToShare" + Given user "Alice" has created folder "folderToShare" And user "Alice" has uploaded file with content "to share" to "folderToShare/textfile.txt" And we save it into "FILEID" When user "Alice" sends the following resource share invitation using the Graph API: @@ -175,8 +177,7 @@ Feature: an user shares resources Scenario: user lists permissions of a file in personal space after enabling FileEditorWithVersions role - Given the administrator has enabled the permissions role "File Editor With Versions" - And user "Alice" has uploaded file with content "hello world" to "textfile0.txt" + 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 @@ -189,27 +190,10 @@ Feature: an user shares resources ], "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" - ] + "type": "array", + "minItems": 19, + "maxItems": 19, + "uniqueItems": true }, "@libre.graph.permissions.roles.allowedValues": { "type": "array", @@ -222,10 +206,7 @@ Feature: an user shares resources "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" } + "displayName": { "const": "Can view" } } }, { @@ -242,10 +223,7 @@ Feature: an user shares resources "type": "object", "required": ["@libre.graph.weight", "description", "displayName", "id"], "properties": { - "@libre.graph.weight": { "const": 3 }, - "description": { "const": "View, download, edit and show all invited people, show all versions." }, - "displayName": { "const": "Can edit" }, - "id": { "const": "b173329d-cf2e-42f0-a595-ee410645d840" } + "displayName": { "const": "Can edit" } } } ] @@ -258,7 +236,6 @@ Feature: an user shares resources Scenario: user lists permissions of a file in project space after enabling FileEditorWithVersions role Given using spaces DAV path - And the administrator has enabled the permissions role "File Editor With Versions" 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" @@ -274,27 +251,10 @@ Feature: an user shares resources ], "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" - ] + "type": "array", + "minItems": 19, + "maxItems": 19, + "uniqueItems": true }, "@libre.graph.permissions.roles.allowedValues": { "type": "array", @@ -307,10 +267,7 @@ Feature: an user shares resources "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" } + "displayName": { "const": "Can view" } } }, { @@ -327,10 +284,7 @@ Feature: an user shares resources "type": "object", "required": ["@libre.graph.weight", "description", "displayName", "id"], "properties": { - "@libre.graph.weight": { "const": 3 }, - "description": { "const": "View, download, edit and show all invited people, show all versions." }, - "displayName": { "const": "Can edit" }, - "id": { "const": "b173329d-cf2e-42f0-a595-ee410645d840" } + "displayName": { "const": "Can edit" } } } ] @@ -342,8 +296,7 @@ Feature: an user shares resources Scenario: user lists permissions of a folder in personal space after enabling EditorWithVersions role - Given the administrator has enabled the permissions role "Editor With Versions" - And user "Alice" has created folder "folderToShare" + Given user "Alice" has created folder "folderToShare" When user "Alice" gets permissions list for folder "folderToShare" 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 @@ -356,27 +309,10 @@ Feature: an user shares resources ], "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" - ] + "type": "array", + "minItems": 19, + "maxItems": 19, + "uniqueItems": true }, "@libre.graph.permissions.roles.allowedValues": { "type": "array", @@ -389,20 +325,14 @@ Feature: an user shares resources "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" } + "displayName": { "const": "Can view" } } }, { "type": "object", "required": ["@libre.graph.weight", "description", "displayName", "id"], "properties": { - "@libre.graph.weight": { "const": 2 }, - "description": { "const": "View, download and upload." }, - "displayName": { "const": "Can upload" }, - "id": { "const": "1c996275-f1c9-4e71-abdf-a42f6495e960" } + "displayName": { "const": "Can upload" } } }, { @@ -419,10 +349,7 @@ Feature: an user shares resources "type": "object", "required": ["@libre.graph.weight", "description", "displayName", "id"], "properties": { - "@libre.graph.weight": { "const": 4 }, - "description": { "const": "View, download, upload, edit, delete and show all invited people, show all versions." }, - "displayName": { "const": "Can edit" }, - "id": { "const": "0911d62b-1e3f-4778-8b1b-903b7e4e8476" } + "displayName": { "const": "Can edit" } } } ] @@ -435,7 +362,6 @@ Feature: an user shares resources Scenario: user lists permissions of a folder in project space after enabling EditorWithVersions role Given using spaces DAV path - And the administrator has enabled the permissions role "Editor With Versions" 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" @@ -451,27 +377,10 @@ Feature: an user shares resources ], "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" - ] + "type": "array", + "minItems": 19, + "maxItems": 19, + "uniqueItems": true }, "@libre.graph.permissions.roles.allowedValues": { "type": "array", @@ -484,20 +393,14 @@ Feature: an user shares resources "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" } + "displayName": { "const": "Can view" } } }, { "type": "object", "required": ["@libre.graph.weight", "description", "displayName", "id"], "properties": { - "@libre.graph.weight": { "const": 2 }, - "description": { "const": "View, download and upload." }, - "displayName": { "const": "Can upload" }, - "id": { "const": "1c996275-f1c9-4e71-abdf-a42f6495e960" } + "displayName": { "const": "Can upload" } } }, { @@ -514,10 +417,7 @@ Feature: an user shares resources "type": "object", "required": ["@libre.graph.weight", "description", "displayName", "id"], "properties": { - "@libre.graph.weight": { "const": 4 }, - "description": { "const": "View, download, upload, edit, delete and show all invited people, show all versions." }, - "displayName": { "const": "Can edit" }, - "id": { "const": "0911d62b-1e3f-4778-8b1b-903b7e4e8476" } + "displayName": { "const": "Can edit" } } } ] @@ -528,177 +428,235 @@ Feature: an user shares resources """ - Scenario: sharee lists the file share shared with FileEditorWithVersions permission role (Personal Space) - Given the administrator has enabled the permissions role "File Editor With Versions" - And user "Alice" has uploaded file with content "hello world" to "textfile.txt" + Scenario: sharee lists the received shares (Personal Space) + Given user "Alice" has uploaded file with content "hello world" to "textfile.txt" + And user "Alice" has created folder "folder" And user "Alice" has sent the following resource share invitation: | resource | textfile.txt | | space | Personal | | sharee | Brian | | shareType | user | | permissionsRole | File Editor With Versions | + And user "Alice" has sent the following resource share invitation: + | resource | folder | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Editor With Versions | When user "Brian" lists the shares shared with him using the Graph API Then the HTTP status code should be "200" - And the JSON data of the response should match + And the JSON data of the response should contain resource "textfile.txt" with the following data: """ { "type": "object", - "required": ["value"], + "required": ["@UI.Hidden","@client.synchronize","createdBy","eTag","file","id", + "lastModifiedDateTime","name","parentReference","remoteItem","size"], "properties": { - "value": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": { - "type": "object", - "required": [ - "@UI.Hidden", - "@client.synchronize", - "createdBy", - "eTag", - "file", - "id", - "lastModifiedDateTime", - "name", - "parentReference", - "remoteItem", - "size" - ], - "properties": { - "@UI.Hidden": { "const": false }, - "@client.synchronize": { "const": true }, - "createdBy": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["displayName", "id"], - "properties": { - "displayName": { "const": "Alice Hansen" }, - "id": { "pattern": "^%user_id_pattern%$" } - } + "@UI.Hidden": { "const": false }, + "@client.synchronize": { "const": true }, + "eTag": { "pattern": "%etag_pattern%" }, + "file": { + "type": "object", + "required": ["mimeType"], + "properties": { "mimeType": { "const": "text/plain" } } + }, + "id": { "pattern": "^%share_id_pattern%$" }, + "name": { "const": "textfile.txt" }, + "remoteItem": { + "type": "object", + "required": ["createdBy","eTag","file","id","lastModifiedDateTime","name", + "parentReference","permissions","size"], + "properties": { + "createdBy": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["id", "displayName"], + "properties": { + "id": { "pattern": "^%user_id_pattern%$" }, + "displayName": { "const": "Alice Hansen" } } } - }, - "eTag": { "pattern": "%etag_pattern%" }, - "file": { + } + }, + "eTag": { "pattern": "%etag_pattern%" }, + "file": { + "type": "object", + "required": ["mimeType"], + "properties": { + "mimeType": { "const": "text/plain" } + } + }, + "id": { "pattern": "^%file_id_pattern%$" }, + "name": { "const": "textfile.txt" }, + "parentReference": { + "type": "object", + "required": ["driveId", "driveType"], + "properties": { + "driveId": { "pattern": "^%file_id_pattern%$" }, + "driveType": { "const": "personal" } + } + }, + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { "type": "object", - "required": ["mimeType"], - "properties": { "mimeType": { "const": "text/plain" } } - }, - "id": { "pattern": "^%share_id_pattern%$" }, - "name": { "const": "textfile.txt" }, - "parentReference": { - "type": "object", - "required": ["driveId", "driveType", "id"], + "required": ["grantedToV2", "id", "invitation", "roles"], "properties": { - "driveId": { "pattern": "^%space_id_pattern%$" }, - "driveType": { "const": "virtual" }, - "id": { "pattern": "^%file_id_pattern%$" } - } - }, - "remoteItem": { - "type": "object", - "required": [ - "createdBy", - "eTag", - "file", - "id", - "lastModifiedDateTime", - "name", - "parentReference", - "permissions", - "size" - ], - "properties": { - "createdBy": { + "id": { "pattern": "^%permissions_id_pattern%$" }, + "grantedToV2": { "type": "object", "required": ["user"], "properties": { "user": { "type": "object", - "required": ["id", "displayName"], + "required": ["displayName", "id"], "properties": { - "id": { "pattern": "^%user_id_pattern%$" }, - "displayName": { "const": "Alice Hansen" } + "displayName": { "const": "Brian Murphy" }, + "id": { "pattern": "^%user_id_pattern%$" } } } } }, - "eTag": { "pattern": "%etag_pattern%" }, - "file": { + "invitation": { "type": "object", - "required": ["mimeType"], "properties": { - "mimeType": { "const": "text/plain" } - } + "invitedBy": { + "type": "object", + "properties": { + "user": { + "type": "object", + "properties": { + "displayName": { "const": "Alice Hansen" }, + "id": { "pattern": "^%user_id_pattern%$" } + }, + "required": ["displayName", "id"] + } + }, + "required": ["user"] + } + }, + "required": ["invitedBy"] }, - "id": { "pattern": "^%file_id_pattern%$" }, - "name": { "const": "textfile.txt" }, - "parentReference": { - "type": "object", - "required": ["driveId", "driveType"], - "properties": { - "driveId": { "pattern": "^%file_id_pattern%$" }, - "driveType": { "const": "personal" } - } - }, - "permissions": { + "roles": { "type": "array", "minItems": 1, "maxItems": 1, - "items": { - "type": "object", - "required": ["grantedToV2", "id", "invitation", "roles"], - "properties": { - "id": { "pattern": "^%permissions_id_pattern%$" }, - "grantedToV2": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["displayName", "id"], - "properties": { - "displayName": { "const": "Brian Murphy" }, - "id": { "pattern": "^%user_id_pattern%$" } - } - } - } - }, - "invitation": { - "type": "object", - "properties": { - "invitedBy": { - "type": "object", - "properties": { - "user": { - "type": "object", - "properties": { - "displayName": { "const": "Alice Hansen" }, - "id": { "pattern": "^%user_id_pattern%$" } - }, - "required": ["displayName", "id"] - } - }, - "required": ["user"] - } - }, - "required": ["invitedBy"] - }, - "roles": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": { "const": "b173329d-cf2e-42f0-a595-ee410645d840" } - } - } - } + "items": { "const": "b173329d-cf2e-42f0-a595-ee410645d840" } } } - }, - "size": { "const": 11 } + } + } + } + }, + "size": { "const": 11 } + } + } + """ + And the JSON data of the response should contain resource "folder" with the following data: + """ + { + "type": "object", + "required": ["@UI.Hidden","@client.synchronize","createdBy","eTag","folder","id", + "lastModifiedDateTime","name","parentReference","remoteItem"], + "properties": { + "@UI.Hidden": { "const": false }, + "@client.synchronize": { "const": true }, + "eTag": { "pattern": "%etag_pattern%" }, + "id": { "pattern": "^%share_id_pattern%$" }, + "name": { "const": "folder" }, + "remoteItem": { + "type": "object", + "required": ["createdBy","eTag","folder","id","lastModifiedDateTime", + "name","parentReference","permissions"], + "properties": { + "createdBy": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["id", "displayName"], + "properties": { + "id": { "pattern": "^%user_id_pattern%$" }, + "displayName": { "const": "Alice Hansen" } + } + } + } + }, + "eTag": { "pattern": "%etag_pattern%" }, + "file": { + "type": "object", + "required": ["mimeType"], + "properties": { + "mimeType": { "const": "text/plain" } + } + }, + "id": { "pattern": "^%file_id_pattern%$" }, + "name": { "const": "folder" }, + "parentReference": { + "type": "object", + "required": ["driveId", "driveType"], + "properties": { + "driveId": { "pattern": "^%file_id_pattern%$" }, + "driveType": { "const": "personal" } + } + }, + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": ["grantedToV2", "id", "invitation", "roles"], + "properties": { + "id": { "pattern": "^%permissions_id_pattern%$" }, + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "properties": { + "displayName": { "const": "Brian Murphy" }, + "id": { "pattern": "^%user_id_pattern%$" } + }, + "required": ["displayName", "id"] + } + } + }, + "invitation": { + "type": "object", + "properties": { + "invitedBy": { + "type": "object", + "properties": { + "user": { + "type": "object", + "properties": { + "displayName": { "const": "Alice Hansen" }, + "id": { "pattern": "^%user_id_pattern%$" } + }, + "required": ["displayName", "id"] + } + }, + "required": ["user"] + } + }, + "required": ["invitedBy"] + }, + "roles": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { "const": "0911d62b-1e3f-4778-8b1b-903b7e4e8476" } + } + } + } } } } @@ -707,354 +665,18 @@ Feature: an user shares resources """ - Scenario: sharee lists the file share shared with FileEditorWithVersions permission role (Project Space) + Scenario: sharee lists the received shares (Project Space) Given using spaces DAV path - And the administrator has enabled the permissions role "File Editor With Versions" 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 uploaded a file inside space "new-space" with content "some content" to "testfile.txt" + And user "Alice" has created a folder "folder" in space "new-space" And user "Alice" has sent the following resource share invitation: | resource | testfile.txt | | space | new-space | | sharee | Brian | | shareType | user | | permissionsRole | File Editor With Versions | - When user "Brian" lists the shares shared with him using the Graph API - Then the HTTP status code should be "200" - And the JSON data of the response should match - """ - { - "type": "object", - "required": ["value"], - "properties": { - "value": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": { - "type": "object", - "required": [ - "@UI.Hidden", - "@client.synchronize", - "eTag", - "file", - "id", - "lastModifiedDateTime", - "name", - "parentReference", - "remoteItem", - "size" - ], - "properties": { - "@UI.Hidden": { "const": false }, - "@client.synchronize": { "const": true }, - "eTag": { "pattern": "%etag_pattern%" }, - "file": { - "type": "object", - "required": ["mimeType"], - "properties": { "mimeType": { "const": "text/plain" } } - }, - "id": { "pattern": "^%share_id_pattern%$" }, - "name": { "const": "testfile.txt" }, - "parentReference": { - "type": "object", - "required": ["driveId", "driveType"], - "properties": { - "driveId": { "pattern": "^%space_id_pattern%$" }, - "driveType": { "const": "virtual" }, - "id": { "pattern": "^%file_id_pattern%$" } - } - }, - "remoteItem": { - "type": "object", - "required": [ - "eTag", - "file", - "id", - "lastModifiedDateTime", - "name", - "parentReference", - "permissions", - "size" - ], - "properties": { - "createdBy": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["id", "displayName"], - "properties": { - "id": { "pattern": "^%user_id_pattern%$" }, - "displayName": { "const": "Alice Hansen" } - } - } - } - }, - "eTag": { "pattern": "%etag_pattern%" }, - "file": { - "type": "object", - "required": ["mimeType"], - "properties": { - "mimeType": { "const": "text/plain" } - } - }, - "id": { "pattern": "^%file_id_pattern%$" }, - "name": { "const": "testfile.txt" }, - "parentReference": { - "type": "object", - "required": ["driveId", "driveType"], - "properties": { - "driveId": { "pattern": "^%file_id_pattern%$" }, - "driveType": { "const": "project" } - } - }, - "permissions": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": { - "type": "object", - "required": ["grantedToV2", "id", "invitation", "roles"], - "properties": { - "id": { "pattern": "^%permissions_id_pattern%$" }, - "grantedToV2": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["displayName", "id"], - "properties": { - "displayName": { "const": "Brian Murphy" }, - "id": { "pattern": "^%user_id_pattern%$" } - } - } - } - }, - "invitation": { - "type": "object", - "properties": { - "invitedBy": { - "type": "object", - "properties": { - "user": { - "type": "object", - "properties": { - "displayName": { "const": "Alice Hansen" }, - "id": { "pattern": "^%user_id_pattern%$" } - }, - "required": ["displayName", "id"] - } - }, - "required": ["user"] - } - }, - "required": ["invitedBy"] - }, - "roles": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": { "const": "b173329d-cf2e-42f0-a595-ee410645d840" } - } - } - } - } - } - }, - "size": { "const": 12 } - } - } - } - } - } - """ - - - Scenario: sharee lists the folder share shared with EditorWithVersions permission role (Personal Space) - Given the administrator has enabled the permissions role "Editor With Versions" - And user "Alice" has created folder "folder" - And user "Alice" has sent the following resource share invitation: - | resource | folder | - | space | Personal | - | sharee | Brian | - | shareType | user | - | permissionsRole | Editor With Versions | - When user "Brian" lists the shares shared with him using the Graph API - Then the HTTP status code should be "200" - And the JSON data of the response should match - """ - { - "type": "object", - "required": [ - "value" - ], - "properties": { - "value": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": { - "type": "object", - "required": [ - "@UI.Hidden", - "@client.synchronize", - "createdBy", - "eTag", - "folder", - "id", - "lastModifiedDateTime", - "name", - "parentReference", - "remoteItem" - ], - "properties": { - "@UI.Hidden": { "const": false }, - "@client.synchronize": { "const": true }, - "createdBy": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["displayName", "id"], - "properties": { - "displayName": { "const": "Alice Hansen" }, - "id": { "pattern": "^%user_id_pattern%$" } - } - } - } - }, - "eTag": { "pattern": "%etag_pattern%" }, - "folder": { - "const": {} - }, - "id": { "pattern": "^%share_id_pattern%$" }, - "name": { "const": "folder" }, - "parentReference": { - "type": "object", - "required": ["driveId", "driveType", "id"], - "properties": { - "driveId": { "pattern": "^%space_id_pattern%$" }, - "driveType": { "const": "virtual" }, - "id": { "pattern": "^%file_id_pattern%$" } - } - }, - "remoteItem": { - "type": "object", - "required": [ - "createdBy", - "eTag", - "folder", - "id", - "lastModifiedDateTime", - "name", - "parentReference", - "permissions" - ], - "properties": { - "createdBy": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["id", "displayName"], - "properties": { - "id": { "pattern": "^%user_id_pattern%$" }, - "displayName": { "const": "Alice Hansen" } - } - } - } - }, - "eTag": { "pattern": "%etag_pattern%" }, - "file": { - "type": "object", - "required": ["mimeType"], - "properties": { - "mimeType": { "const": "text/plain" } - } - }, - "id": { "pattern": "^%file_id_pattern%$" }, - "name": { "const": "folder" }, - "parentReference": { - "type": "object", - "required": ["driveId", "driveType"], - "properties": { - "driveId": { "pattern": "^%file_id_pattern%$" }, - "driveType": { "const": "personal" } - } - }, - "permissions": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": { - "type": "object", - "required": ["grantedToV2", "id", "invitation", "roles"], - "properties": { - "id": { "pattern": "^%permissions_id_pattern%$" }, - "grantedToV2": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "properties": { - "displayName": { "const": "Brian Murphy" }, - "id": { "pattern": "^%user_id_pattern%$" } - }, - "required": ["displayName", "id"] - } - } - }, - "invitation": { - "type": "object", - "properties": { - "invitedBy": { - "type": "object", - "properties": { - "user": { - "type": "object", - "properties": { - "displayName": { "const": "Alice Hansen" }, - "id": { "pattern": "^%user_id_pattern%$" } - }, - "required": ["displayName", "id"] - } - }, - "required": ["user"] - } - }, - "required": ["invitedBy"] - }, - "roles": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": { "const": "0911d62b-1e3f-4778-8b1b-903b7e4e8476" } - } - } - } - } - } - } - } - } - } - } - } - """ - - - Scenario: sharee lists the folder share shared with EditorWithVersions permission role (Project Space) - Given using spaces DAV path - And the administrator has enabled the permissions role "Editor With Versions" - 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" And user "Alice" has sent the following resource share invitation: | resource | folder | | space | new-space | @@ -1063,130 +685,196 @@ Feature: an user shares resources | permissionsRole | Editor With Versions | When user "Brian" lists the shares shared with him using the Graph API Then the HTTP status code should be "200" - And the JSON data of the response should match + And the JSON data of the response should contain resource "textfile.txt" with the following data: """ { "type": "object", - "required": [ - "value" - ], + "required": ["@UI.Hidden","@client.synchronize","eTag","file","id", + "lastModifiedDateTime","name","parentReference","remoteItem","size"], "properties": { - "value": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": { - "type": "object", - "required": [ - "@UI.Hidden", - "@client.synchronize", - "eTag", - "folder", - "id", - "lastModifiedDateTime", - "name", - "parentReference", - "remoteItem" - ], - "properties": { - "@UI.Hidden": { "const": false }, - "@client.synchronize": { "const": true }, - "eTag": { "pattern": "%etag_pattern%" }, - "folder": { - "const": {} - }, - "id": { "pattern": "^%share_id_pattern%$" }, - "name": { "const": "folder" }, - "parentReference": { - "type": "object", - "required": ["driveId", "driveType", "id"], - "properties": { - "driveId": { "pattern": "^%space_id_pattern%$" }, - "driveType": { "const": "virtual" }, - "id": { "pattern": "^%file_id_pattern%$" } + "@UI.Hidden": { "const": false }, + "@client.synchronize": { "const": true }, + "eTag": { "pattern": "%etag_pattern%" }, + "id": { "pattern": "^%share_id_pattern%$" }, + "name": { "const": "testfile.txt" }, + "remoteItem": { + "type": "object", + "required": ["eTag","file","id","lastModifiedDateTime", + "name","parentReference","permissions","size"], + "properties": { + "createdBy": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["id", "displayName"], + "properties": { + "id": { "pattern": "^%user_id_pattern%$" }, + "displayName": { "const": "Alice Hansen" } + } } - }, - "remoteItem": { + } + }, + "eTag": { "pattern": "%etag_pattern%" }, + "file": { + "type": "object", + "required": ["mimeType"], + "properties": { + "mimeType": { "const": "text/plain" } + } + }, + "id": { "pattern": "^%file_id_pattern%$" }, + "name": { "const": "testfile.txt" }, + "parentReference": { + "type": "object", + "required": ["driveId", "driveType"], + "properties": { + "driveId": { "pattern": "^%file_id_pattern%$" }, + "driveType": { "const": "project" } + } + }, + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { "type": "object", - "required": [ - "eTag", - "folder", - "id", - "lastModifiedDateTime", - "name", - "parentReference", - "permissions" - ], + "required": ["grantedToV2", "id", "invitation", "roles"], "properties": { - "eTag": { "pattern": "%etag_pattern%" }, - "file": { + "id": { "pattern": "^%permissions_id_pattern%$" }, + "grantedToV2": { "type": "object", - "required": ["mimeType"], + "required": ["user"], "properties": { - "mimeType": { "const": "text/plain" } - } - }, - "id": { "pattern": "^%file_id_pattern%$" }, - "name": { "const": "folder" }, - "parentReference": { - "type": "object", - "required": ["driveId", "driveType"], - "properties": { - "driveId": { "pattern": "^%file_id_pattern%$" }, - "driveType": { "const": "project" } - } - }, - "permissions": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": { - "type": "object", - "required": ["grantedToV2", "id", "invitation", "roles"], - "properties": { - "id": { "pattern": "^%permissions_id_pattern%$" }, - "grantedToV2": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "properties": { - "displayName": { "const": "Brian Murphy" }, - "id": { "pattern": "^%user_id_pattern%$" } - }, - "required": ["displayName", "id"] - } - } - }, - "invitation": { - "type": "object", - "properties": { - "invitedBy": { - "type": "object", - "properties": { - "user": { - "type": "object", - "properties": { - "displayName": { "const": "Alice Hansen" }, - "id": { "pattern": "^%user_id_pattern%$" } - }, - "required": ["displayName", "id"] - } - }, - "required": ["user"] - } - }, - "required": ["invitedBy"] - }, - "roles": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": { "const": "0911d62b-1e3f-4778-8b1b-903b7e4e8476" } + "user": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { "const": "Brian Murphy" }, + "id": { "pattern": "^%user_id_pattern%$" } } } } + }, + "invitation": { + "type": "object", + "properties": { + "invitedBy": { + "type": "object", + "properties": { + "user": { + "type": "object", + "properties": { + "displayName": { "const": "Alice Hansen" }, + "id": { "pattern": "^%user_id_pattern%$" } + }, + "required": ["displayName", "id"] + } + }, + "required": ["user"] + } + }, + "required": ["invitedBy"] + }, + "roles": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { "const": "b173329d-cf2e-42f0-a595-ee410645d840" } + } + } + } + } + } + }, + "size": { "const": 12 } + } + } + """ + And the JSON data of the response should contain resource "folder" with the following data: + """ + { + "type": "object", + "required": ["@UI.Hidden","@client.synchronize","eTag","folder","id", + "lastModifiedDateTime","name","parentReference","remoteItem"], + "properties": { + "@UI.Hidden": { "const": false }, + "@client.synchronize": { "const": true }, + "eTag": { "pattern": "%etag_pattern%" }, + "id": { "pattern": "^%share_id_pattern%$" }, + "name": { "const": "folder" }, + "remoteItem": { + "type": "object", + "required": ["eTag","folder","id","lastModifiedDateTime", + "name","parentReference","permissions"], + "properties": { + "eTag": { "pattern": "%etag_pattern%" }, + "file": { + "type": "object", + "required": ["mimeType"], + "properties": { + "mimeType": { "const": "text/plain" } + } + }, + "id": { "pattern": "^%file_id_pattern%$" }, + "name": { "const": "folder" }, + "parentReference": { + "type": "object", + "required": ["driveId", "driveType"], + "properties": { + "driveId": { "pattern": "^%file_id_pattern%$" }, + "driveType": { "const": "project" } + } + }, + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": ["grantedToV2", "id", "invitation", "roles"], + "properties": { + "id": { "pattern": "^%permissions_id_pattern%$" }, + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "properties": { + "displayName": { "const": "Brian Murphy" }, + "id": { "pattern": "^%user_id_pattern%$" } + }, + "required": ["displayName", "id"] + } + } + }, + "invitation": { + "type": "object", + "properties": { + "invitedBy": { + "type": "object", + "properties": { + "user": { + "type": "object", + "properties": { + "displayName": { "const": "Alice Hansen" }, + "id": { "pattern": "^%user_id_pattern%$" } + }, + "required": ["displayName", "id"] + } + }, + "required": ["user"] + } + }, + "required": ["invitedBy"] + }, + "roles": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { "const": "0911d62b-1e3f-4778-8b1b-903b7e4e8476" } } } } @@ -1198,34 +886,45 @@ Feature: an user shares resources """ - Scenario Outline: sharee checks versions after updating the permission role of a shared file from other roles to FileEditorWithVersions (Personal Space) + Scenario: sharee checks file versions after updating the permission role to FileEditorWithVersions (Personal Space) Given using spaces DAV path - And the administrator has enabled the permissions role 'File Editor With Versions' + And user "Alice" has created folder "folderToShare" + And user "Alice" has uploaded file with content "to share" to "folderToShare/lorem.txt" And user "Alice" has uploaded file with content "to share" to "textfile.txt" - And we save it into "FILEID" And user "Alice" has sent the following resource share invitation: - | resource | textfile.txt | - | space | Personal | - | sharee | Brian | - | shareType | user | - | permissionsRole | | + | resource | textfile.txt | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + And user "Brian" has uploaded file with content "updated content" to "Shares/textfile.txt" + And user "Alice" has sent the following resource share invitation: + | resource | folderToShare | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Editor | + And user "Brian" has uploaded file with content "updated content" to "Shares/folderToShare/lorem.txt" And user "Alice" has updated the last resource share with the following properties: | permissionsRole | File Editor With Versions | | space | Personal | | resource | textfile.txt | - And user "Brian" has uploaded file with content "updated content" to "Shares/textfile.txt" - When user "Brian" gets the number of versions of file "textfile.txt" using file-id "<>" + And user "Alice" has updated the last resource share with the following properties: + | permissionsRole | Editor With Versions | + | space | Personal | + | resource | folderToShare | + When user "Brian" gets the number of versions of file "Shares/textfile.txt" + Then the HTTP status code should be "207" + And the number of versions should be "1" + When user "Brian" gets the number of versions of file "Shares/folderToShare/lorem.txt" Then the HTTP status code should be "207" And the number of versions should be "1" - Examples: - | permissions-role | - | File Editor | - | Viewer | - Scenario Outline: sharee tries to check versions after updating the permission role of a shared file from FileEditorWithVersions to other roles (Personal Space) + Scenario: sharee tries to check file versions after updating the permission role to other role (Personal Space) Given using spaces DAV path - And the administrator has enabled the permissions role 'File Editor With Versions' + And user "Alice" has created folder "folderToShare" + And user "Alice" has uploaded file with content "to share" to "folderToShare/lorem.txt" And user "Alice" has uploaded file with content "to share" to "textfile.txt" And user "Alice" has sent the following resource share invitation: | resource | textfile.txt | @@ -1234,98 +933,70 @@ Feature: an user shares resources | shareType | user | | permissionsRole | File Editor With Versions | And user "Brian" has uploaded file with content "updated content" to "Shares/textfile.txt" + And user "Alice" has sent the following resource share invitation: + | resource | folderToShare | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Editor With Versions | + And user "Brian" has uploaded file with content "updated content" to "Shares/folderToShare/lorem.txt" And user "Alice" has updated the last resource share with the following properties: - | permissionsRole | | - | space | Personal | - | resource | textfile.txt | + | permissionsRole | File Editor | + | space | Personal | + | resource | textfile.txt | + And user "Alice" has updated the last resource share with the following properties: + | permissionsRole | Editor | + | space | Personal | + | resource | folderToShare | When user "Brian" tries to get versions of file "textfile.txt" from "Alice" Then the HTTP status code should be "403" - Examples: - | permissions-role | - | File Editor | - | Viewer | - - - Scenario Outline: sharee checks versions after updating the permission role of the shared folder from other roles to EditorWithVersions (Personal Space) - Given the administrator has enabled the permissions role 'Editor With Versions' - And user "Alice" has created folder "folderToShare" - And user "Alice" has uploaded file with content "to share" to "folderToShare/textfile.txt" - And we save it into "FILEID" - And user "Alice" has sent the following resource share invitation: - | resource | folderToShare | - | space | Personal | - | sharee | Brian | - | shareType | user | - | permissionsRole | | - And user "Alice" has updated the last resource share with the following properties: - | permissionsRole | Editor With Versions | - | space | Personal | - | resource | folderToShare | - And user "Brian" has uploaded file with content "updated content" to "Shares/folderToShare/textfile.txt" - When user "Brian" gets the number of versions of file "textfile.txt" using file-id "<>" - Then the HTTP status code should be "207" - And the number of versions should be "1" - Examples: - | permissions-role | - | Editor | - | Viewer | - - - Scenario Outline: sharee tries to check versions after updating the permission role of the shared folder from EditorWithVersions to other roles (Personal Space) - Given the administrator has enabled the permissions role 'Editor With Versions' - And user "Alice" has created folder "folderToShare" - And user "Alice" has uploaded file with content "to share" to "folderToShare/textfile.txt" - And user "Alice" has sent the following resource share invitation: - | resource | folderToShare | - | space | Personal | - | sharee | Brian | - | shareType | user | - | permissionsRole | Editor With Versions | - And user "Brian" has uploaded file with content "updated content" to "Shares/folderToShare/textfile.txt" - And user "Alice" has updated the last resource share with the following properties: - | permissionsRole | | - | space | Personal | - | resource | folderToShare | - When user "Brian" tries to get versions of file "folderToShare/textfile.txt" from "Alice" + When user "Brian" tries to get versions of file "folderToShare/lorem.txt" from "Alice" Then the HTTP status code should be "403" - Examples: - | permissions-role | - | Editor | - | Viewer | - Scenario Outline: sharee checks versions after updating the permission role of a shared file from other roles to FileEditorWithVersions (Project Space) + Scenario: sharee checks file versions after updating the permission role to FileEditorWithVersions (Project Space) Given using spaces DAV path - And the administrator has enabled the permissions role 'File Editor With Versions' 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 "folderToShare" in space "new-space" + And user "Alice" has uploaded a file inside space "new-space" with content "to share" to "folderToShare/lorem.txt" And user "Alice" has uploaded a file inside space "new-space" with content "to share" to "textfile.txt" - And we save it into "FILEID" And user "Alice" has sent the following resource share invitation: - | resource | textfile.txt | - | space | new-space | - | sharee | Brian | - | shareType | user | - | permissionsRole | | + | resource | textfile.txt | + | space | new-space | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + And user "Brian" has uploaded file with content "updated content" to "Shares/textfile.txt" + And user "Alice" has sent the following resource share invitation: + | resource | folderToShare | + | space | new-space | + | sharee | Brian | + | shareType | user | + | permissionsRole | Editor | + And user "Brian" has uploaded file with content "updated content" to "Shares/folderToShare/lorem.txt" And user "Alice" has updated the last resource share with the following properties: | permissionsRole | File Editor With Versions | | space | new-space | | resource | textfile.txt | - And user "Brian" has uploaded file with content "updated content" to "Shares/textfile.txt" - When user "Brian" gets the number of versions of file "textfile.txt" using file-id "<>" + And user "Alice" has updated the last resource share with the following properties: + | permissionsRole | Editor With Versions | + | space | new-space | + | resource | folderToShare | + When user "Brian" gets the number of versions of file "Shares/textfile.txt" + Then the HTTP status code should be "207" + And the number of versions should be "1" + When user "Brian" gets the number of versions of file "Shares/folderToShare/lorem.txt" Then the HTTP status code should be "207" And the number of versions should be "1" - Examples: - | permissions-role | - | File Editor | - | Viewer | - Scenario Outline: sharee tries to check versions after updating the permission role of a shared file from FileEditorWithVersions to other roles (Project Space) + Scenario: sharee tries to check file versions after updating the permission role to other roles (Project Space) Given using spaces DAV path - And the administrator has enabled the permissions role 'File Editor With Versions' 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 "folderToShare" in space "new-space" + And user "Alice" has uploaded a file inside space "new-space" with content "to share" to "folderToShare/lorem.txt" And user "Alice" has uploaded a file inside space "new-space" with content "to share" to "textfile.txt" And we save it into "FILEID" And user "Alice" has sent the following resource share invitation: @@ -1335,68 +1006,22 @@ Feature: an user shares resources | shareType | user | | permissionsRole | File Editor With Versions | And user "Brian" has uploaded file with content "updated content" to "Shares/textfile.txt" - And user "Alice" has updated the last resource share with the following properties: - | permissionsRole | | - | space | new-space | - | resource | textfile.txt | - When user "Brian" gets the number of versions of file "textfile.txt" using file-id "<>" - Then the HTTP status code should be "403" - Examples: - | permissions-role | - | File Editor | - | Viewer | - - - Scenario Outline: sharee checks versions after updating the permission role of the shared folder from other roles to EditorWithVersions (Project Space) - Given using spaces DAV path - And the administrator has enabled the permissions role 'Editor With Versions' - 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 "folderToShare" in space "new-space" - And user "Alice" has uploaded a file inside space "new-space" with content "to share" to "folderToShare/textfile.txt" - And we save it into "FILEID" - And user "Alice" has sent the following resource share invitation: - | resource | folderToShare | - | space | new-space | - | sharee | Brian | - | shareType | user | - | permissionsRole | | - And user "Alice" has updated the last resource share with the following properties: - | permissionsRole | Editor With Versions | - | space | new-space | - | resource | folderToShare | - And user "Brian" has uploaded file with content "updated content" to "Shares/folderToShare/textfile.txt" - When user "Brian" gets the number of versions of file "textfile.txt" using file-id "<>" - Then the HTTP status code should be "207" - And the number of versions should be "1" - Examples: - | permissions-role | - | Editor | - | Viewer | - - - Scenario Outline: sharee tries to check versions after updating the permission role of the shared folder from EditorWithVersions to other roles (Project Space) - Given using spaces DAV path - And the administrator has enabled the permissions role 'Editor With Versions' - 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 "folderToShare" in space "new-space" - And user "Alice" has uploaded a file inside space "new-space" with content "to share" to "folderToShare/textfile.txt" - And we save it into "FILEID" And user "Alice" has sent the following resource share invitation: | resource | folderToShare | | space | new-space | | sharee | Brian | | shareType | user | | permissionsRole | Editor With Versions | - And user "Brian" has uploaded file with content "updated content" to "Shares/folderToShare/textfile.txt" + And user "Brian" has uploaded file with content "updated content" to "Shares/folderToShare/lorem.txt" And user "Alice" has updated the last resource share with the following properties: - | permissionsRole | | - | space | new-space | - | resource | folderToShare | - When user "Brian" gets the number of versions of file "textfile.txt" using file-id "<>" + | permissionsRole | Editor | + | space | new-space | + | resource | textfile.txt | + And user "Alice" has updated the last resource share with the following properties: + | permissionsRole | Editor | + | space | new-space | + | resource | folderToShare | + When user "Brian" tries to get versions of file "textfile.txt" from "Alice" + Then the HTTP status code should be "403" + When user "Brian" tries to get versions of file "folderToShare/lorem.txt" from "Alice" Then the HTTP status code should be "403" - Examples: - | permissions-role | - | Editor | - | Viewer | diff --git a/tests/acceptance/features/apiSharingNgAdditionalShareRole/listGrantsShareRole.feature b/tests/acceptance/features/apiSharingNgAdditionalShareRole/listGrantsShareRole.feature index 3a5a9f56b04..1d0bfe4e477 100644 --- a/tests/acceptance/features/apiSharingNgAdditionalShareRole/listGrantsShareRole.feature +++ b/tests/acceptance/features/apiSharingNgAdditionalShareRole/listGrantsShareRole.feature @@ -9,17 +9,22 @@ Feature: ListGrants role | username | | Alice | | Brian | + And the administrator has enabled the following share permissions roles: + | role | + | Viewer With ListGrants | + | File Editor With ListGrants | + | Editor With ListGrants | - Scenario Outline: user shares personal space file with ListGrants role - Given the administrator has enabled the permissions role "" + Scenario: user shares personal resources with ListGrants role + Given user "Alice" has created folder "FolderToShare" And user "Alice" has uploaded file with content "to share" to "textfile1.txt" When user "Alice" sends the following resource share invitation using the Graph API: - | resource | textfile1.txt | - | space | Personal | - | sharee | Brian | - | shareType | user | - | permissionsRole | | + | resource | textfile1.txt | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | File Editor With ListGrants | Then the HTTP status code should be "200" And the JSON data of the response should match """ @@ -64,26 +69,17 @@ Feature: ListGrants role } """ And for user "Brian" file "textfile1.txt" should have the following shares: - | sharee | shareType | permissionsRole | - | Brian | user | | + | sharee | shareType | permissionsRole | + | Brian | user | File Editor With ListGrants | And for user "Brian" file "textfile1.txt" of the space "Shares" should have the following activities: | {user} added {resource} to {folder} | | {user} shared {resource} with {sharee} | - Examples: - | permissions-role | - | Viewer With ListGrants | - | File Editor With ListGrants | - - - Scenario Outline: user shares personal space folder with ListGrants role - Given the administrator has enabled the permissions role "" - And user "Alice" has created folder "FolderToShare" When user "Alice" sends the following resource share invitation using the Graph API: - | resource | FolderToShare | - | space | Personal | - | sharee | Brian | - | shareType | user | - | permissionsRole | | + | resource | FolderToShare | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Editor With ListGrants | Then the HTTP status code should be "200" And the JSON data of the response should match """ @@ -128,96 +124,80 @@ Feature: ListGrants role } """ And for user "Brian" folder "FolderToShare" should have the following shares: - | sharee | shareType | permissionsRole | - | Brian | user | | + | sharee | shareType | permissionsRole | + | Brian | user | Editor With ListGrants | And for user "Brian" folder "FolderToShare" of the space "Shares" should have the following activities: | {user} added {resource} to {folder} | | {user} shared {resource} with {sharee} | - Examples: - | permissions-role | - | Viewer With ListGrants | - | Editor With ListGrants | - Scenario Outline: user shares project space file with ListGrants role - Given the administrator has enabled the permissions role "" - And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API - And using spaces DAV path - And user "Alice" has created a space "NewSpace" with the default quota using the Graph API - And user "Alice" has uploaded a file inside space "NewSpace" with content "share space items" to "textfile1.txt" - When user "Alice" sends the following resource share invitation using the Graph API: - | resource | textfile1.txt | - | space | NewSpace | - | sharee | Brian | - | shareType | user | - | permissionsRole | | - Then the HTTP status code should be "200" - And the JSON data of the response should match - """ - { - "type": "object", - "required": ["value"], - "properties": { - "value": { - "type": "array", - "maxItems": 1, - "minItems": 1, - "items": { - "type": "object", - "required": ["createdDateTime","id","roles","grantedToV2"], - "properties": { - "createdDateTime": { "format": "date-time" }, - "id": {"pattern": "^%permissions_id_pattern%$"}, - "roles": { - "type": "array", - "maxItems": 1, - "minItems": 1, - "items": {"pattern": "^%role_id_pattern%$"} - }, - "grantedToV2": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["id","displayName"], - "properties": { - "id": {"pattern": "^%user_id_pattern%$"}, - "displayName": {"const": "Brian Murphy"} - } - } - } - } - } - } - } - } - } - """ - And for user "Brian" file "textfile1.txt" should have the following shares: - | sharee | shareType | permissionsRole | - | Brian | user | | - And for user "Brian" file "textfile1.txt" of the space "Shares" should have the following activities: - | {user} added {resource} to {folder} | - | {user} shared {resource} with {sharee} | - Examples: - | permissions-role | - | Viewer With ListGrants | - | File Editor With ListGrants | - - - Scenario Outline: user shares project space folder with ListGrants role - Given the administrator has enabled the permissions role "" - And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + Scenario: user shares project resources with ListGrants role + Given the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API And using spaces DAV path And user "Alice" has created a space "NewSpace" with the default quota using the Graph API And user "Alice" has created a folder "FolderToShare" in space "NewSpace" + And user "Alice" has uploaded a file inside space "NewSpace" with content "share space items" to "textfile1.txt" When user "Alice" sends the following resource share invitation using the Graph API: - | resource | FolderToShare | - | space | NewSpace | - | sharee | Brian | - | shareType | user | - | permissionsRole | | + | resource | textfile1.txt | + | space | NewSpace | + | sharee | Brian | + | shareType | user | + | permissionsRole | File Editor With ListGrants | + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": ["value"], + "properties": { + "value": { + "type": "array", + "maxItems": 1, + "minItems": 1, + "items": { + "type": "object", + "required": ["createdDateTime","id","roles","grantedToV2"], + "properties": { + "createdDateTime": { "format": "date-time" }, + "id": {"pattern": "^%permissions_id_pattern%$"}, + "roles": { + "type": "array", + "maxItems": 1, + "minItems": 1, + "items": {"pattern": "^%role_id_pattern%$"} + }, + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["id","displayName"], + "properties": { + "id": {"pattern": "^%user_id_pattern%$"}, + "displayName": {"const": "Brian Murphy"} + } + } + } + } + } + } + } + } + } + """ + And for user "Brian" file "textfile1.txt" should have the following shares: + | sharee | shareType | permissionsRole | + | Brian | user | File Editor With ListGrants | + And for user "Brian" file "textfile1.txt" of the space "Shares" should have the following activities: + | {user} added {resource} to {folder} | + | {user} shared {resource} with {sharee} | + When user "Alice" sends the following resource share invitation using the Graph API: + | resource | FolderToShare | + | space | NewSpace | + | sharee | Brian | + | shareType | user | + | permissionsRole | Editor With ListGrants | Then the HTTP status code should be "200" And the JSON data of the response should match """ @@ -262,15 +242,11 @@ Feature: ListGrants role } """ And for user "Brian" folder "FolderToShare" should have the following shares: - | sharee | shareType | permissionsRole | - | Brian | user | | + | sharee | shareType | permissionsRole | + | Brian | user | Editor With ListGrants | And for user "Brian" folder "FolderToShare" of the space "Shares" should have the following activities: | {user} added {resource} to {folder} | | {user} shared {resource} with {sharee} | - Examples: - | permissions-role | - | Viewer With ListGrants | - | Editor With ListGrants | Scenario Outline: sharer updates shared file roles to ListGrants roles (Personal space) @@ -325,10 +301,8 @@ Feature: ListGrants role | {user} shared {resource} with {sharee} | Examples: | permissions-role | new-permissions-role | - | Viewer | Viewer With ListGrants | - | File Editor | Viewer With ListGrants | | Viewer | File Editor With ListGrants | - | File Editor | File Editor With ListGrants | + | File Editor | Viewer With ListGrants | Scenario Outline: sharer updates shared folder roles to ListGrants roles (Personal space) @@ -384,11 +358,7 @@ Feature: ListGrants role Examples: | permissions-role | new-permissions-role | | Viewer | Viewer With ListGrants | - | Editor | Viewer With ListGrants | - | Uploader | Viewer With ListGrants | - | Viewer | Editor With ListGrants | | Editor | Editor With ListGrants | - | Uploader | Editor With ListGrants | Scenario Outline: sharer updates shared file roles to ListGrants roles (Project space) @@ -448,8 +418,6 @@ Feature: ListGrants role Examples: | permissions-role | new-permissions-role | | Viewer | Viewer With ListGrants | - | File Editor | Viewer With ListGrants | - | Viewer | File Editor With ListGrants | | File Editor | File Editor With ListGrants | @@ -509,12 +477,8 @@ Feature: ListGrants role | {user} updated {field} for the {resource} | Examples: | permissions-role | new-permissions-role | - | Viewer | Viewer With ListGrants | | Editor | Viewer With ListGrants | - | Uploader | Viewer With ListGrants | | Viewer | Editor With ListGrants | - | Editor | Editor With ListGrants | - | Uploader | Editor With ListGrants | Scenario Outline: sharer updates shared file roles from ListGrants roles to other roles (Personal space) @@ -568,8 +532,6 @@ Feature: ListGrants role Examples: | permissions-role | new-permissions-role | | Viewer With ListGrants | Viewer | - | Viewer With ListGrants | File Editor | - | File Editor With ListGrants | Viewer | | File Editor With ListGrants | File Editor | @@ -623,12 +585,8 @@ Feature: ListGrants role And for user "Brian" folder "FolderToShare" of the space "Shares" should not have any activity Examples: | permissions-role | new-permissions-role | - | Viewer With ListGrants | Viewer | | Viewer With ListGrants | Editor | - | Viewer With ListGrants | Uploader | | Editor With ListGrants | Viewer | - | Editor With ListGrants | Editor | - | Editor With ListGrants | Uploader | Scenario Outline: sharer updates shared file roles from ListGrants roles to other roles (Project space) @@ -687,10 +645,8 @@ Feature: ListGrants role | {user} updated {field} for the {resource} | Examples: | new-permissions-role | permissions-role | - | Viewer With ListGrants | Viewer | | Viewer With ListGrants | File Editor | | File Editor With ListGrants | Viewer | - | File Editor With ListGrants | File Editor | Scenario Outline: sharer updates shared folder roles to ListGrants roles to other roles (Project space) @@ -750,22 +706,27 @@ Feature: ListGrants role Examples: | new-permissions-role | permissions-role | | Viewer With ListGrants | Viewer | - | Viewer With ListGrants | Editor | - | Viewer With ListGrants | Uploader | - | Editor With ListGrants | Viewer | - | Editor With ListGrants | Editor | | Editor With ListGrants | Uploader | - Scenario Outline: sharer lists shared-by-me (Personal space) - Given the administrator has enabled the permissions role "" + Scenario: sharer lists shared-by-me (Personal space) + Given the administrator has assigned the role "Admin" to user "Alice" using the Graph API And user "Alice" has created folder "folder" + And user "Alice" has uploaded file with content "to share" to "textfile.txt" + And user "Alice" has created a group "grp1" using the Graph API + And user "Brian" has been added to group "grp1" And user "Alice" has sent the following resource share invitation: - | resource | folder | - | space | Personal | - | sharee | Brian | - | shareType | user | - | permissionsRole | | + | resource | folder | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + And user "Alice" has sent the following resource share invitation: + | resource | textfile.txt | + | space | Personal | + | sharee | grp1 | + | shareType | group | + | permissionsRole | File Editor With ListGrants | When user "Alice" lists the shares shared by her using the Graph API Then the HTTP status code should be "200" And the JSON data of the response should contain resource "folder" with the following data: @@ -821,30 +782,6 @@ Feature: ListGrants role } } """ - Examples: - | permissions-role | - | Viewer With ListGrants | - | Editor With ListGrants | - - - Scenario Outline: sharer list share shared-by-me when same file is shared with multiple user(Personal space) - Given the administrator has enabled the permissions role "" - And user "Carol" has been created with default attributes - And user "Alice" has uploaded file with content "to share" to "textfile.txt" - And user "Alice" has sent the following resource share invitation: - | resource | textfile.txt | - | space | Personal | - | sharee | Brian | - | shareType | user | - | permissionsRole | | - And user "Alice" has sent the following resource share invitation: - | resource | textfile.txt | - | space | Personal | - | sharee | Carol | - | shareType | user | - | permissionsRole | | - When user "Alice" lists the shares shared by her using the Graph API - Then the HTTP status code should be "200" And the JSON data of the response should contain resource "textfile.txt" with the following data: """ { @@ -865,709 +802,225 @@ Feature: ListGrants role } }, "permissions": { - "type": "array", - "minItems": 2, - "maxItems": 2, - "uniqueItems": true, - "items": { - "oneOf": [ - { - "type": "object", - "required": ["createdDateTime","grantedToV2","id","roles","invitation"], - "properties": { - "createdDateTime": { "format": "date-time" }, - "id": {"pattern": "^%permissions_id_pattern%$"}, - "roles": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": {"pattern": "^%role_id_pattern%$"} - }, - "invitation": { - "type": "object", - "required": ["invitedBy"], - "properties": { - "invitedBy": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["displayName", "id", "@libre.graph.userType"], - "properties": { - "displayName": { "const": "Alice Hansen" }, - "id": { "pattern": "^%user_id_pattern%$" }, - "@libre.graph.userType": { "const": "Member" } - } - } - } - } - } - }, - "grantedToV2": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["displayName","id"], - "properties": { - "id": {"pattern": "^%user_id_pattern%$"}, - "displayName": {"const": "Brian Murphy"} - } - } - } - } - } - }, - { - "type": "object", - "required": ["createdDateTime","grantedToV2","id","roles","invitation"], - "properties": { - "createdDateTime": { "format": "date-time" }, - "id": {"pattern": "^%permissions_id_pattern%$"}, - "roles": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": {"pattern": "^%role_id_pattern%$"} - }, - "invitation": { - "type": "object", - "required": ["invitedBy"], - "properties": { - "invitedBy": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["displayName", "id", "@libre.graph.userType"], - "properties": { - "displayName": { "const": "Alice Hansen" }, - "id": { "pattern": "^%user_id_pattern%$" }, - "@libre.graph.userType": { "const": "Member" } - } - } - } - } - } - }, - "grantedToV2": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["displayName","id"], - "properties": { - "id": {"pattern": "^%user_id_pattern%$"}, - "displayName": {"const": "Carol King"} - } - } - } - } - } - } - ] - } - } - } - } - """ - Examples: - | permissions-role | - | Viewer With ListGrants | - | File Editor With ListGrants | - - - Scenario Outline: sharee list shared-with-me (Personal space) - Given the administrator has enabled the permissions role "" - And user "Alice" has uploaded file with content "to share" to "textfile.txt" - And user "Alice" has sent the following resource share invitation: - | resource | textfile.txt | - | space | Personal | - | sharee | Brian | - | shareType | user | - | permissionsRole | | - When user "Brian" lists the shares shared with him using the Graph API - Then the HTTP status code should be "200" - And the JSON data of the response should match - """ - { - "type": "object", - "required": ["value"], - "properties": { - "value": { "type": "array", "minItems": 1, "maxItems": 1, "items": { "type": "object", - "required": ["@UI.Hidden","@client.synchronize","createdBy","eTag","file", - "id","lastModifiedDateTime","name","parentReference","remoteItem","size"], + "required": ["createdDateTime","grantedToV2","id","roles","invitation"], "properties": { - "lastModifiedDateTime": { "format": "date-time" }, - "@UI.Hidden": {"const": false}, - "@client.synchronize": {"const": true}, - "createdBy": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["displayName", "id"], - "properties": { - "displayName": {"const": "Alice Hansen"}, - "id": {"pattern": "^%user_id_pattern%$"} - } - } - } - }, - "eTag": {"pattern": "%etag_pattern%"}, - "file": { - "type": "object", - "required": ["mimeType"], - "properties": { - "mimeType": {"const": "text/plain"} - } - }, - "id": {"pattern": "^%share_id_pattern%$"}, - "name": {"const": "textfile.txt"}, - "parentReference": { - "type": "object", - "required": ["driveId","driveType","id"], - "properties": { - "driveId": {"pattern": "^%space_id_pattern%$"}, - "driveType": {"const": "virtual"}, - "id": {"pattern": "^%file_id_pattern%$"} - } - }, - "remoteItem": { - "type": "object", - "required": ["createdBy","eTag","file","id","lastModifiedDateTime", - "name","parentReference","permissions","size" - ], - "properties": { - "createdBy": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["id","displayName"], - "properties": { - "id": {"pattern": "^%user_id_pattern%$"}, - "displayName": {"const": "Alice Hansen"} - } - } - } - }, - "eTag": {"pattern": "%etag_pattern%"}, - "file": { - "type": "object", - "required": ["mimeType"], - "properties": { - "mimeType": {"const": "text/plain"} - } - }, - "id": {"pattern": "^%file_id_pattern%$"}, - "name": {"const": "textfile.txt"}, - "parentReference": { - "type": "object", - "required": ["driveId","driveType"], - "properties": { - "driveId": {"pattern": "^%file_id_pattern%$"}, - "driveType": {"const": "personal"} - } - }, - "permissions": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": { - "type": "object", - "required": ["grantedToV2","id","invitation","roles"], - "properties": { - "id": {"pattern": "^%permissions_id_pattern%$"}, - "grantedToV2": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["displayName","id"], - "properties": { - "displayName": {"const": "Brian Murphy"}, - "id": {"pattern": "^%user_id_pattern%$"} - } - } - } - }, - "invitation": { - "type": "object", - "properties": { - "invitedBy": { - "type": "object", - "properties": { - "user": { - "type": "object", - "properties": { - "displayName": {"const": "Alice Hansen"}, - "id": {"pattern": "^%user_id_pattern%$"} - }, - "required": ["displayName","id"] - } - }, - "required": ["user"] - } - }, - "required": ["invitedBy"] - }, - "roles": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": {"pattern": "^%role_id_pattern%$"} - } - } - } - } - } - }, - "size": {"const": 8} - } - } - } - } - } - """ - Examples: - | permissions-role | - | Viewer With ListGrants | - | File Editor With ListGrants | - - - Scenario Outline: sharee lists same name shares received via user and group invitations (Personal space) - Given the administrator has enabled the permissions role "" - And the administrator has assigned the role "Admin" to user "Alice" using the Graph API - And user "Alice" has created folder "folder" - And user "Alice" has created a group "grp1" using the Graph API - And user "Brian" has been added to group "grp1" - And user "Alice" has sent the following resource share invitation: - | resource | folder | - | space | Personal | - | sharee | Brian | - | shareType | user | - | permissionsRole | Viewer | - And user "Alice" has sent the following resource share invitation: - | resource | folder | - | space | Personal | - | sharee | grp1 | - | shareType | group | - | permissionsRole | | - When user "Brian" lists the shares shared with him using the Graph API - Then the HTTP status code should be "200" - And the JSON data of the response should match - """ - { - "type": "object", - "required": ["value"], - "properties": { - "value": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": { - "type": "object", - "required": ["@UI.Hidden","@client.synchronize","createdBy","eTag","folder", - "id","lastModifiedDateTime","name","parentReference","remoteItem" - ], - "properties": { - "lastModifiedDateTime": { "format": "date-time" }, - "@UI.Hidden":{"const": false}, - "@client.synchronize":{"const": true}, - "createdBy": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["displayName", "id"], - "properties": { - "displayName": {"const": "Alice Hansen"}, - "id": {"pattern": "^%user_id_pattern%$"} - } - } - } - }, - "eTag": {"pattern": "%etag_pattern%"}, - "folder": {"const": {}}, - "id": {"pattern": "^%share_id_pattern%$"}, - "name": {"const": "folder"}, - "parentReference": { - "type": "object", - "required": ["driveId","driveType","id"], - "properties": { - "driveId": {"pattern": "^%space_id_pattern%$"}, - "driveType" : {"const": "virtual"}, - "id" : {"pattern": "%space_id_pattern%"} - } - }, - "remoteItem": { - "type": "object", - "required": ["createdBy","eTag","folder","id","lastModifiedDateTime", - "name","parentReference","permissions" - ], - "properties": { - "createdBy": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["id", "displayName"], - "properties": { - "id": {"pattern": "^%user_id_pattern%$"}, - "displayName": {"const": "Alice Hansen"} - } - } - } - }, - "eTag": {"pattern": "%etag_pattern%"}, - "file": {}, - "id": {"pattern": "^%file_id_pattern%$"}, - "name": {"const": "folder"}, - "parentReference": { - "type": "object", - "required": ["driveId","driveType"], - "properties": { - "driveId": {"pattern": "%space_id_pattern%"}, - "driveType" : {"const": "personal"} - } - }, - "permissions": { - "type": "array", - "minItems": 2, - "maxItems": 2, - "uniqueItems": true, - "items": { - "oneOf": [ - { - "type": "object", - "required": ["grantedToV2","id","invitation","roles"], - "properties": { - "grantedToV2": { - "type": "object", - "required": ["group"], - "properties":{ - "group": { - "type": "object", - "required": ["displayName","id"], - "properties": { - "displayName": {"const": "grp1"}, - "id": {"pattern": "^%user_id_pattern%$"} - } - } - } - }, - "id": {"pattern": "^%permissions_id_pattern%$"}, - "invitation": { - "type": "object", - "required": ["invitedBy"], - "properties": { - "user":{ - "type": "object", - "required": ["displayName","id"], - "properties": { - "displayName": {"const": "Alice Hansen"}, - "id": {"pattern": "^%user_id_pattern%$"} - } - } - } - }, - "roles": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": {"pattern": "^%role_id_pattern%$"} - } - } - }, - { - "type": "object", - "required": ["grantedToV2","id","invitation","roles"], - "properties": { - "grantedToV2": { - "type": "object", - "required": ["user"], - "properties":{ - "user": { - "type": "object", - "required": ["displayName","id"], - "properties": { - "displayName": {"const": "Brian Murphy"}, - "id": {"pattern": "^%user_id_pattern%$"} - } - } - } - }, - "id": {"pattern": "^%permissions_id_pattern%$"}, - "invitation": { - "type": "object", - "required": ["invitedBy"], - "properties": { - "user":{ - "type": "object", - "required": ["displayName","id"], - "properties": { - "displayName": {"const": "Alice Hansen"}, - "id": {"pattern": "^%user_id_pattern%$"} - } - } - } - }, - "roles": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": {"pattern": "^%role_id_pattern%$"} - } - } - } - ] - } - } - } - } - } - } - } - } - } - """ - And for user "Brian" folder "folder" should have the following shares: - | sharee | shareType | permissionsRole | - | Brian | user | Viewer | - | grp1 | group | | - And for user "Brian" folder "folder" of the space "Shares" should have the following activities: - | {user} added {resource} to {folder} | - | {user} shared {resource} with {sharee} | - Examples: - | permissions-role | - | Viewer With ListGrants | - | Editor With ListGrants | - - - Scenario Outline: sharer lists the file shared-by-me (Project space) - Given the administrator has enabled the permissions role "" - And using spaces DAV path - And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API - And user "Alice" has created a space "NewSpace" with the default quota using the Graph API - And user "Alice" has created a folder "FolderToShare" in space "NewSpace" - And user "Alice" has uploaded a file inside space "NewSpace" with content "hello world" to "FolderToShare/textfile.txt" - And user "Alice" has sent the following resource share invitation: - | resource | FolderToShare/textfile.txt | - | space | NewSpace | - | sharee | Brian | - | shareType | user | - | permissionsRole | | - When user "Alice" lists the shares shared by her using the Graph API - Then the HTTP status code should be "200" - And the JSON data of the response should contain resource "textfile.txt" with the following data: - """ - { - "type": "object", - "required": ["parentReference","permissions","name","size"], - "properties": { - "parentReference": { - "type": "object", - "required": ["driveId","driveType","path","name","id"], - "properties": { - "driveId": {"pattern": "^%space_id_pattern%$"}, - "driveType": {"const": "project"}, - "path": {"const": "/FolderToShare"}, - "name": {"const": "FolderToShare"}, - "id": {"pattern": "^%file_id_pattern%$"} - } - }, - "permissions": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": { - "type": "object", - "required": ["grantedToV2","id","roles"], - "properties": { - "grantedToV2": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["displayName","id"], - "properties": { - "id": {"pattern": "^%user_id_pattern%$"}, - "displayName": {"const": "Brian Murphy"} - } - } - } - }, + "createdDateTime": { "format": "date-time" }, "id": {"pattern": "^%permissions_id_pattern%$"}, "roles": { "type": "array", "minItems": 1, "maxItems": 1, "items": {"pattern": "^%role_id_pattern%$"} + }, + "invitation": { + "type": "object", + "required": ["invitedBy"], + "properties": { + "invitedBy": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["displayName", "id", "@libre.graph.userType"], + "properties": { + "displayName": { "const": "Alice Hansen" }, + "id": { "pattern": "^%user_id_pattern%$" }, + "@libre.graph.userType": { "const": "Member" } + } + } + } + } + } + }, + "grantedToV2": { + "type": "object", + "required": ["group"], + "properties": { + "group": { + "type": "object", + "required": ["displayName","id"], + "properties": { + "id": {"pattern": "^%group_id_pattern%$"}, + "displayName": {"const": "grp1"} + } + } + } } } } - }, - "name": {"const": "textfile.txt"}, - "size": {"const": 11} + } } } """ - Examples: - | permissions-role | - | Viewer With ListGrants | - | File Editor With ListGrants | - Scenario: share exists even though sharee has been disabled (Project space) - Given the following configs have been set: - | config | value | - | GRAPH_SPACES_USERS_CACHE_TTL | 1 | - | GRAPH_AVAILABLE_ROLES | d5041006-ebb3-4b4a-b6a4-7c180ecfb17d | - And using spaces DAV path - And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API - And user "Alice" has created a space "NewSpace" with the default quota using the Graph API - And user "Alice" has uploaded a file inside space "NewSpace" with content "some content" to "textfile.txt" + Scenario: sharee list shared-with-me (Personal space) + Given the administrator has assigned the role "Admin" to user "Alice" using the Graph API + And user "Alice" has created folder "folder" + And user "Alice" has created a group "grp1" using the Graph API + And user "Brian" has been added to group "grp1" + And user "Alice" has uploaded file with content "to share" to "textfile.txt" And user "Alice" has sent the following resource share invitation: | resource | textfile.txt | - | space | NewSpace | + | space | Personal | | sharee | Brian | | shareType | user | | permissionsRole | Viewer With ListGrants | - And the user "Admin" has disabled user "Brian" - When user "Alice" lists the shares shared by her after clearing user cache using the Graph API + And user "Alice" has sent the following resource share invitation: + | resource | folder | + | space | Personal | + | sharee | grp1 | + | shareType | group | + | permissionsRole | Editor With ListGrants | + When user "Brian" lists the shares shared with him using the Graph API Then the HTTP status code should be "200" And the JSON data of the response should contain resource "textfile.txt" with the following data: """ { "type": "object", - "required": ["parentReference","permissions","name"], + "required": ["@UI.Hidden","@client.synchronize","createdBy","eTag","file", + "id","lastModifiedDateTime","name","parentReference","remoteItem","size"], "properties": { - "parentReference": { + "lastModifiedDateTime": { "format": "date-time" }, + "eTag": {"pattern": "%etag_pattern%"}, + "id": {"pattern": "^%share_id_pattern%$"}, + "name": {"const": "textfile.txt"}, + "remoteItem": { "type": "object", - "required": ["driveId","driveType","path","name","id"], + "required": ["createdBy","eTag","file","id","lastModifiedDateTime","name","parentReference","permissions","size"], "properties": { - "driveType": {"const": "project"} - } - }, - "permissions": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": { - "type": "object", - "required": ["grantedToV2","id","roles"], - "properties": { - "grantedToV2": { + "eTag": {"pattern": "%etag_pattern%"}, + "id": {"pattern": "^%file_id_pattern%$"}, + "name": {"const": "textfile.txt"}, + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "uniqueItems": true, + "items": { "type": "object", - "required": ["user"], + "required": ["grantedToV2","id","invitation","roles"], "properties": { - "user": { + "grantedToV2": { "type": "object", - "required": ["displayName","id"], - "properties": { - "displayName": {"const": "Brian Murphy"} + "required": ["user"], + "properties":{ + "user": { + "type": "object", + "required": ["displayName","id"], + "properties": { + "displayName": {"const": "Brian Murphy"}, + "id": {"pattern": "^%user_id_pattern%$"} + } + } } + }, + "id": {"pattern": "^%permissions_id_pattern%$"}, + "invitation": { + "type": "object", + "required": ["invitedBy"], + "properties": { + "user":{ + "type": "object", + "required": ["displayName","id"], + "properties": { + "displayName": {"const": "Alice Hansen"}, + "id": {"pattern": "^%user_id_pattern%$"} + } + } + } + }, + "roles": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": {"pattern": "^%role_id_pattern%$"} } } - }, - "roles": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": {"pattern": "^%role_id_pattern%$"} } } } - }, - "name": {"const": "textfile.txt"} + } } } """ - - - Scenario Outline: share doesn't exist for disabled space (Project space) - Given the administrator has enabled the permissions role "" - And using spaces DAV path - And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API - And user "Alice" has created a space "NewSpace" with the default quota using the Graph API - And user "Alice" has uploaded a file inside space "NewSpace" with content "some content" to "textfile.txt" - And user "Alice" has sent the following resource share invitation: - | resource | textfile.txt | - | space | NewSpace | - | sharee | Brian | - | shareType | user | - | permissionsRole | | - And user "Admin" has disabled a space "NewSpace" - When user "Alice" lists the shares shared by her using the Graph API - Then the HTTP status code should be "200" - And the JSON data of the response should not contain resource "textfile.txt" with the following data: + And the JSON data of the response should contain resource "folder" with the following data: """ { "type": "object", - "required": ["parentReference","permissions","name"], + "required": ["@UI.Hidden","@client.synchronize","createdBy","eTag","folder", + "id","lastModifiedDateTime","name","parentReference","remoteItem"], "properties": { - "parentReference": { + "lastModifiedDateTime": { "format": "date-time" }, + "eTag": {"pattern": "%etag_pattern%"}, + "id": {"pattern": "^%share_id_pattern%$"}, + "name": {"const": "folder"}, + "remoteItem": { "type": "object", - "required": ["driveId","driveType","path","name","id"], + "required": ["createdBy","eTag","folder","id","lastModifiedDateTime","name","parentReference","permissions"], "properties": { - "driveType": {"const": "project"} - } - }, - "permissions": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": { - "type": "object", - "required": ["grantedToV2","id","roles"], - "properties": { - "grantedToV2": { + "eTag": {"pattern": "%etag_pattern%"}, + "file": {}, + "id": {"pattern": "^%file_id_pattern%$"}, + "name": {"const": "folder"}, + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "uniqueItems": true, + "items": { "type": "object", - "required": ["user"], + "required": ["grantedToV2","id","invitation","roles"], "properties": { - "user": { + "grantedToV2": { "type": "object", - "required": ["displayName","id"], - "properties": { - "displayName": {"const": "Brian Murphy"} + "required": ["group"], + "properties":{ + "group": { + "type": "object", + "required": ["displayName","id"], + "properties": { + "displayName": {"const": "grp1"}, + "id": {"pattern": "^%user_id_pattern%$"} + } + } } + }, + "id": {"pattern": "^%permissions_id_pattern%$"}, + "invitation": { + "type": "object", + "required": ["invitedBy"], + "properties": { + "user":{ + "type": "object", + "required": ["displayName","id"], + "properties": { + "displayName": {"const": "Alice Hansen"}, + "id": {"pattern": "^%user_id_pattern%$"} + } + } + } + }, + "roles": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": {"pattern": "^%role_id_pattern%$"} } } - }, - "roles": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": {"pattern": "^%role_id_pattern%$"} } } } - }, - "name": {"const": "textfile.txt"} + } } } """ - And user "Brian" should not have a share "textfile.txt" shared by user "Alice" from space "NewSpace" - Examples: - | permissions-role | - | Viewer With ListGrants | - | File Editor With ListGrants | Scenario Outline: list activities of folder shared with listGrant roles (Personal space)