diff --git a/tests/acceptance/TestHelpers/GraphHelper.php b/tests/acceptance/TestHelpers/GraphHelper.php index ce300dfe837..21aa08e0ace 100644 --- a/tests/acceptance/TestHelpers/GraphHelper.php +++ b/tests/acceptance/TestHelpers/GraphHelper.php @@ -43,6 +43,7 @@ class GraphHelper { public const ADDITIONAL_PERMISSIONS_ROLES = [ 'Secure Viewer' => 'aa97fe03-7980-45ac-9e50-b325749fd7e6', 'Space Editor Without Versions' => '3284f2d5-0070-4ad8-ac40-c247f7c1fb27', + 'Denied' => '63e64e19-8d43-42ec-a738-2b6af2610efa', ]; public const SHARES_SPACE_ID = 'a0ca6a90-a365-4782-871e-d44447bbc668$a0ca6a90-a365-4782-871e-d44447bbc668'; diff --git a/tests/acceptance/bootstrap/OcisConfigContext.php b/tests/acceptance/bootstrap/OcisConfigContext.php index 4a7a32172c9..d1db70c25cc 100644 --- a/tests/acceptance/bootstrap/OcisConfigContext.php +++ b/tests/acceptance/bootstrap/OcisConfigContext.php @@ -31,6 +31,24 @@ * steps needed to re-configure oCIS server */ class OcisConfigContext implements Context { + private array $enabledRoles = []; + + /** + * @return array + */ + public function getEnabledRoles(): array { + return $this->enabledRoles; + } + + /** + * @param array $enabledRoles + * + * @return void + */ + public function setEnabledRoles(array $enabledRoles): void { + $this->enabledRoles = $enabledRoles; + } + /** * @Given async upload has been enabled with post-processing delayed to :delayTime seconds * @@ -99,6 +117,33 @@ public function theAdministratorHasEnabledTheRole(string $role): void { $response->getStatusCode(), "Failed to enable role $role" ); + $this->setEnabledRoles($defaultRoles); + } + + /** + * @Given the administrator has disabled the permissions role :role + * + * @param string $role + * + * @return void + */ + public function theAdministratorHasDisabledThePermissionsRole(string $role): void { + $roleId = GraphHelper::getPermissionsRoleIdByName($role); + $availableRoles = $this->getEnabledRoles(); + + if ($key = array_search($roleId, $availableRoles)) { + unset($availableRoles[$key]); + } + $envs = [ + "GRAPH_AVAILABLE_ROLES" => implode(',', $availableRoles), + ]; + $response = OcisConfigHelper::reConfigureOcis($envs); + Assert::assertEquals( + 200, + $response->getStatusCode(), + "Failed to disable role $role" + ); + $this->setEnabledRoles($availableRoles); } /** diff --git a/tests/acceptance/features/apiSharingNg1/sharedWithMe.feature b/tests/acceptance/features/apiSharingNg1/sharedWithMe.feature index 65cf39ff4a0..79c53e87189 100755 --- a/tests/acceptance/features/apiSharingNg1/sharedWithMe.feature +++ b/tests/acceptance/features/apiSharingNg1/sharedWithMe.feature @@ -5232,3 +5232,973 @@ Feature: an user gets the resources shared to them And the json response should contain the following shares: | textfile.txt | | FolderToShare | + + @env-config + Scenario: sharee lists file share with role Secure Viewer after share role is disabled (Personal Space) + Given the administrator has enabled the permissions role "Secure Viewer" + And user "Alice" has uploaded file with content "some content" to "textfile.txt" + And user "Alice" has sent the following resource share invitation: + | resource | textfile.txt | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Secure Viewer | + And user "Brian" has a share "textfile.txt" synced + And the administrator has disabled the permissions role "Secure Viewer" + 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" + ], + "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": { + "type": "string", + "pattern": "^%user_id_pattern%$" + } + } + } + } + }, + "eTag": { + "type": "string", + "pattern": "%etag_pattern%" + }, + "file": { + "type": "object", + "required": ["mimeType"], + "properties": { + "mimeType": { + "const": "text/plain" + } + } + }, + "id": { + "type": "string", + "pattern": "^%share_id_pattern%$" + }, + "name": { + "const": "textfile.txt" + }, + "parentReference": { + "type": "object", + "required": [ + "driveId", + "driveType", + "id" + ], + "properties": { + "driveId": { + "type": "string", + "pattern": "^%space_id_pattern%$" + }, + "driveType": { + "const": "virtual" + }, + "id": { + "type": "string", + "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": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "displayName": { + "const": "Alice Hansen" + } + } + } + } + }, + "eTag": { + "type": "string", + "pattern": "%etag_pattern%" + }, + "file": { + "type": "object", + "required": ["mimeType"], + "properties": { + "mimeType": { + "const": "text/plain" + } + } + }, + "id": { + "type": "string", + "pattern": "^%file_id_pattern%$" + }, + "name": { + "const": "textfile.txt" + }, + "parentReference": { + "type": "object", + "required": ["driveId", "driveType"], + "properties": { + "driveId": { + "type": "string", + "pattern": "^%file_id_pattern%$" + }, + "driveType": { + "const": "personal" + } + } + }, + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "@libre.graph.permissions.actions", + "grantedToV2", + "id", + "invitation" + ], + "properties": { + "@libre.graph.permissions.actions": { + "type": "array", + "enum": [ + [ + "libre.graph/driveItem/path/read", + "libre.graph/driveItem/children/read", + "libre.graph/driveItem/basic/read" + ] + ] + }, + "id": { + "type": "string", + "pattern": "^%permissions_id_pattern%$" + }, + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "const": "Brian Murphy" + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + } + } + } + } + }, + "invitation": { + "type": "object", + "required": ["invitedBy"], + "properties": { + "invitedBy": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "const": "Alice Hansen" + }, + "id": { + "type": "string", + "pattern": "%user_id_pattern%" + } + } + } + } + } + } + } + } + } + } + } + }, + "size": { + "const": 12 + } + } + } + } + } + } + """ + + @env-config + Scenario: sharee lists folder share with role Secure Viewer after share role is disabled (Personal Space) + Given the administrator has enabled the permissions role "Secure Viewer" + And user "Alice" has created folder "folderToShare" + And user "Alice" has sent the following resource share invitation: + | resource | folderToShare | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Secure Viewer | + And user "Brian" has a share "folderToShare" synced + And the administrator has disabled the permissions role "Secure Viewer" + 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": { + "type": "string", + "pattern": "^%user_id_pattern%$" + } + } + } + } + }, + "eTag": { + "type": "string", + "pattern": "%etag_pattern%" + }, + "folder": {}, + "id": { + "type": "string", + "pattern": "^%share_id_pattern%$" + }, + "name": { + "const": "folderToShare" + }, + "parentReference": { + "type": "object", + "required": ["driveId", "driveType", "id"], + "properties": { + "driveId": { + "type": "string", + "pattern": "^%space_id_pattern%$" + }, + "driveType": { + "const": "virtual" + }, + "id": { + "type": "string", + "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": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "displayName": { + "const": "Alice Hansen" + } + } + } + } + }, + "eTag": { + "type": "string", + "pattern": "%etag_pattern%" + }, + "folder": {}, + "id": { + "type": "string", + "pattern": "^%file_id_pattern%$" + }, + "name": { + "const": "folderToShare" + }, + "parentReference": { + "type": "object", + "required": ["driveId", "driveType"], + "properties": { + "driveId": { + "type": "string", + "pattern": "^%file_id_pattern%$" + }, + "driveType": { + "const": "personal" + } + } + }, + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "@libre.graph.permissions.actions", + "grantedToV2", + "id", + "invitation" + ], + "properties": { + "@libre.graph.permissions.actions": { + "type": "array", + "enum": [ + [ + "libre.graph/driveItem/path/read", + "libre.graph/driveItem/children/read", + "libre.graph/driveItem/basic/read" + ] + ] + }, + "id": { + "type": "string", + "pattern": "^%permissions_id_pattern%$" + }, + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "const": "Brian Murphy" + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + } + } + } + } + }, + "invitation": { + "type": "object", + "required": ["invitedBy"], + "properties": { + "invitedBy": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "const": "Alice Hansen" + }, + "id": { + "type": "string", + "pattern": "%user_id_pattern%" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + """ + + @env-config + Scenario: sharee lists folder share with role Denied after share role is disabled (Personal Space) + Given the administrator has enabled the permissions role "Denied" + And user "Alice" has created folder "folderToShare" + And user "Alice" has sent the following resource share invitation: + | resource | folderToShare | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Denied | + And the administrator has disabled the permissions role "Denied" + 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": 0, + "maxItems": 0 + } + } + } + """ + + @env-config + Scenario: sharee lists file share with role Secure Viewer after share role is disabled (Project Space) + Given using spaces DAV path + And the administrator has enabled the permissions role "Secure Viewer" + 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 sent the following resource share invitation: + | resource | testfile.txt | + | space | new-space | + | sharee | Brian | + | shareType | user | + | permissionsRole | Secure Viewer | + And user "Brian" has a share "testfile.txt" synced + And the administrator has disabled the permissions role "Secure Viewer" + 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": { + "type": "string", + "pattern": "%etag_pattern%" + }, + "file": { + "type": "object", + "required": ["mimeType"], + "properties": { + "mimeType": { + "const": "text/plain" + } + } + }, + "id": { + "type": "string", + "pattern": "^%share_id_pattern%$" + }, + "name": { + "const": "testfile.txt" + }, + "parentReference": { + "type": "object", + "required": ["driveId", "driveType", "id"], + "properties": { + "driveId": { + "type": "string", + "pattern": "^%space_id_pattern%$" + }, + "driveType" : { + "const": "virtual" + }, + "id" : { + "type": "string", + "pattern": "%space_id_pattern%" + } + } + }, + "remoteItem": { + "type": "object", + "required": [ + "eTag", + "file", + "id", + "lastModifiedDateTime", + "name", + "parentReference", + "permissions", + "size" + ], + "properties": { + "eTag": { + "type": "string", + "pattern": "%etag_pattern%" + }, + "file": { + "type": "object", + "required": ["mimeType"], + "properties": { + "mimeType": { + "const": "text/plain" + } + } + }, + "id": { + "type": "string", + "pattern": "^%file_id_pattern%$" + }, + "name": { + "const": "testfile.txt" + }, + "parentReference": { + "type": "object", + "required": ["driveId", "driveType"], + "properties": { + "driveId": { + "type": "string", + "pattern": "^%file_id_pattern%$" + }, + "driveType" : { + "const": "project" + } + } + }, + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "@libre.graph.permissions.actions", + "grantedToV2", + "id", + "invitation" + ], + "properties": { + "@libre.graph.permissions.actions": { + "type": "array", + "enum": [ + [ + "libre.graph/driveItem/path/read", + "libre.graph/driveItem/children/read", + "libre.graph/driveItem/basic/read" + ] + ] + }, + "id": { + "type": "string", + "pattern": "^%permissions_id_pattern%$" + }, + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "const": "Brian Murphy" + }, + "id": { + "type": "string", + "pattern":"^%user_id_pattern%$" + } + } + } + } + }, + "invitation": { + "type": "object", + "required": ["invitedBy"], + "properties": { + "invitedBy": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "const": "Alice Hansen" + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + } + } + } + } + } + } + } + } + } + }, + "size": { + "const": 12 + } + } + }, + "size": { + "const": 12 + } + } + } + } + } + } + """ + + @env-config + Scenario: sharee lists folder share with role Secure Viewer after share role is disabled (Project Space) + Given using spaces DAV path + And the administrator has enabled the permissions role "Secure Viewer" + 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 sent the following resource share invitation: + | resource | folderToShare | + | space | new-space | + | sharee | Brian | + | shareType | user | + | permissionsRole | Secure Viewer | + And user "Brian" has a share "folderToShare" synced + And the administrator has disabled the permissions role "Secure Viewer" + 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", + "maxItems": 1, + "minItems": 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": { + "type": "string", + "pattern": "%etag_pattern%" + }, + "folder": {}, + "id": { + "type": "string", + "pattern": "^%share_id_pattern%$" + }, + "name": { + "const": "folderToShare" + }, + "parentReference": { + "type": "object", + "required": ["driveId", "driveType", "id"], + "properties": { + "driveId": { + "type": "string", + "pattern": "^%space_id_pattern%$" + }, + "driveType" : { + "const": "virtual" + }, + "id" : { + "type": "string", + "pattern": "%space_id_pattern%" + } + } + }, + "remoteItem": { + "type": "object", + "required": [ + "eTag", + "folder", + "id", + "lastModifiedDateTime", + "name", + "parentReference", + "permissions" + ], + "properties": { + "eTag": { + "type": "string", + "pattern": "%etag_pattern%" + }, + "folder": {}, + "id": { + "type": "string", + "pattern": "^%file_id_pattern%$" + }, + "name": { + "const": "folderToShare" + }, + "parentReference": { + "type": "object", + "required": ["driveId", "driveType"], + "properties": { + "driveId": { + "type": "string", + "pattern": "^%file_id_pattern%$" + }, + "driveType" : { + "const": "project" + } + } + }, + "permissions": { + "type": "array", + "maxItems": 1, + "minItems": 1, + "items": { + "type": "object", + "required": [ + "@libre.graph.permissions.actions", + "id", + "grantedToV2", + "invitation" + ], + "properties": { + "@libre.graph.permissions.actions": { + "type": "array", + "enum": [ + [ + "libre.graph/driveItem/path/read", + "libre.graph/driveItem/children/read", + "libre.graph/driveItem/basic/read" + ] + ] + }, + "id": { + "type": "string", + "pattern": "^%permissions_id_pattern%$" + }, + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "const": "Brian Murphy" + }, + "id": { + "type": "string", + "pattern":"^%user_id_pattern%$" + } + } + } + } + }, + "invitation": { + "type": "object", + "required": ["invitedBy"], + "properties": { + "invitedBy": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "const": "Alice Hansen" + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + """ + + @env-config + Scenario: sharee lists folder share with role Denied after share role is disabled (Project Space) + Given using spaces DAV path + And the administrator has enabled the permissions role "Denied" + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "new-space" with the default quota using the Graph API + And user "Alice" has created a folder "folderToShare" in space "new-space" + And user "Alice" has sent the following resource share invitation: + | resource | folderToShare | + | space | new-space | + | sharee | Brian | + | shareType | user | + | permissionsRole | Denied | + And the administrator has disabled the permissions role "Denied" + 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": 0, + "maxItems": 0 + } + } + } + """ diff --git a/tests/acceptance/features/apiSpaces/listSpaces.feature b/tests/acceptance/features/apiSpaces/listSpaces.feature index 7e8aabfdc22..5dcd0096275 100644 --- a/tests/acceptance/features/apiSpaces/listSpaces.feature +++ b/tests/acceptance/features/apiSpaces/listSpaces.feature @@ -526,3 +526,321 @@ Feature: List and create spaces | Space Admin | | User | | User Light | + + @env-config + Scenario Outline: list drive + Given user "Brian" has been created with default attributes + And the administrator has enabled the permissions role "Secure Viewer" + And user "Alice" has uploaded file with content "some content" to "textfile.txt" + And user "Alice" has created folder "folderToShare" + And user "Alice" has sent the following resource share invitation: + | resource | | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Secure Viewer | + And user "Brian" has a share "" synced + And the administrator has disabled the permissions role "Secure Viewer" + When user "Brian" lists all available spaces via the Graph API + Then the HTTP status code should be "200" + And the JSON response should contain space called "Shares" owned by "Brian" and match + """ + { + "type": "object", + "required": [ + "driveAlias", + "driveType", + "id", + "name", + "root", + "webUrl" + ], + "properties": { + "driveAlias": { + "const": "virtual/shares" + }, + "driveType": { + "const": "virtual" + }, + "id": { + "const": "%space_id%" + }, + "name": { + "const": "Shares" + }, + "root": { + "type": "object", + "required": ["eTag", "webDavUrl"], + "properties": { + "eTag": { + "type": "string", + "pattern": "%etag_pattern%" + }, + "webDavUrl": { + "const": "%base_url%/dav/spaces/%space_id%" + } + } + }, + "webUrl": { + "const": "%base_url%/f/%space_id%" + } + } + } + """ + Examples: + | resource | + | textfile.txt | + | folderToShare | + + @env-config + Scenario: list drive + Given user "Brian" has been created with default attributes + And the administrator has enabled the permissions role "Denied" + And user "Alice" has created folder "folderToShare" + And user "Alice" has sent the following resource share invitation: + | resource | folderToShare | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Denied | + And the administrator has disabled the permissions role "Denied" + When user "Brian" lists all available spaces via the Graph API + Then the HTTP status code should be "200" + And the JSON response should contain space called "Shares" owned by "Brian" and match + """ + { + "type": "object", + "required": [ + "driveAlias", + "driveType", + "id", + "name", + "root", + "webUrl" + ], + "properties": { + "driveAlias": { + "const": "virtual/shares" + }, + "driveType": { + "const": "virtual" + }, + "id": { + "const": "%space_id%" + }, + "name": { + "const": "Shares" + }, + "root": { + "type": "object", + "required": ["eTag", "webDavUrl"], + "properties": { + "eTag": { + "const": "%space_etag%" + }, + "webDavUrl": { + "const": "%base_url%/dav/spaces/%space_id%" + } + } + }, + "webUrl": { + "const": "%base_url%/f/%space_id%" + } + } + } + """ + + @env-config + Scenario Outline: list drives + Given user "Brian" has been created with default attributes + And the administrator has enabled the permissions role "Secure Viewer" + 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 "textfile.txt" + And user "Alice" has created a folder "folderToShare" in space "new-space" + And user "Alice" has sent the following resource share invitation: + | resource | | + | space | new-space | + | sharee | Brian | + | shareType | user | + | permissionsRole | Secure Viewer | + And user "Brian" has a share "" synced + And the administrator has disabled the permissions role "Secure Viewer" + When user "Brian" lists all available spaces via the Graph API + Then the HTTP status code should be "200" + And the JSON response should contain space called "Shares" owned by "Brian" and match + """ + { + "type": "object", + "required": [ + "driveAlias", + "driveType", + "id", + "name", + "root", + "webUrl" + ], + "properties": { + "driveAlias": { + "const": "virtual/shares" + }, + "driveType": { + "const": "virtual" + }, + "id": { + "const": "%space_id%" + }, + "name": { + "const": "Shares" + }, + "root": { + "type": "object", + "required": ["eTag", "webDavUrl"], + "properties": { + "eTag": { + "type": "string", + "pattern": "%etag_pattern%" + }, + "webDavUrl": { + "const": "%base_url%/dav/spaces/%space_id%" + } + } + }, + "webUrl": { + "const": "%base_url%/f/%space_id%" + } + } + } + """ + Examples: + | resource | + | textfile.txt | + | folderToShare | + + @env-config + Scenario: list drives + Given user "Brian" has been created with default attributes + And the administrator has enabled the permissions role "Denied" + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "new-space" with the default quota using the Graph API + And user "Alice" has created a folder "folderToShare" in space "new-space" + And user "Alice" has sent the following resource share invitation: + | resource | folderToShare | + | space | new-space | + | sharee | Brian | + | shareType | user | + | permissionsRole | Denied | + And the administrator has disabled the permissions role "Denied" + When user "Brian" lists all available spaces via the Graph API + Then the HTTP status code should be "200" + And the JSON response should contain space called "Shares" owned by "Brian" and match + """ + { + "type": "object", + "required": [ + "driveAlias", + "driveType", + "id", + "name", + "root", + "webUrl" + ], + "properties": { + "driveAlias": { + "const": "virtual/shares" + }, + "driveType": { + "const": "virtual" + }, + "id": { + "const": "%space_id%" + }, + "name": { + "const": "Shares" + }, + "root": { + "type": "object", + "required": ["eTag", "webDavUrl"], + "properties": { + "eTag": { + "const": "%space_etag%" + }, + "webDavUrl": { + "const": "%base_url%/dav/spaces/%space_id%" + } + } + }, + "webUrl": { + "const": "%base_url%/f/%space_id%" + } + } + } + """ + + @env-config + Scenario: sharee lists drives after the share role has been disabled + Given user "Brian" has been created with default attributes + And the administrator has enabled the permissions role "Space Editor Without 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 sent the following space share invitation: + | space | new-space | + | sharee | Brian | + | shareType | user | + | permissionsRole | Space Editor Without Versions | + And the administrator has disabled the permissions role "Space Editor Without Versions" + When user "Brian" lists all available spaces via the Graph API + Then the HTTP status code should be "200" + And the JSON response should contain space called "new-space" and match + """ + { + "type": "object", + "required": [ + "driveType", + "driveAlias", + "name", + "id", + "quota", + "root", + "webUrl" + ], + "properties": { + "name": { + "const": "new-space" + }, + "driveType": { + "const": "project" + }, + "driveAlias": { + "const": "project/new-space" + }, + "id": { + "type": "string", + "enum": ["%space_id%"] + }, + "quota": { + "type": "object", + "required": ["state"], + "properties": { + "state": { + "const": "normal" + } + } + }, + "root": { + "type": "object", + "required": ["webDavUrl"], + "properties": { + "webDavUrl": { + "type": "string", + "enum": ["%base_url%/dav/spaces/%space_id%"] + } + } + }, + "webUrl": { + "type": "string", + "enum": ["%base_url%/f/%space_id%"] + } + } + } + """