mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-05-05 19:09:56 -05:00
adding test for updating share link of a project space using permission endpoint (#9251)
This commit is contained in:
@@ -268,6 +268,7 @@ The expected failures in this file are from features in the owncloud/ocis repo.
|
||||
- [apiSharingNgLinkShare/linkShare.feature:2734](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNgLinkShare/linkShare.feature#L2734)
|
||||
- [apiSharingNgLinkShare/linkShare.feature:2735](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNgLinkShare/linkShare.feature#L2735)
|
||||
- [apiSharingNgLinkShare/linkShare.feature:2803](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNgLinkShare/linkShare.feature#L2803)
|
||||
- [apiSharingNgLinkShare/linkShare.feature:2889](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNgLinkShare/linkShare.feature#L2889)
|
||||
- [apiSharingNg/removeAccessToDriveItem.feature:125](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/removeAccessToDriveItem.feature#L125)
|
||||
- [apiSharingNg/removeAccessToDriveItem.feature:141](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/removeAccessToDriveItem.feature#L141)
|
||||
- [apiSharingNg/removeAccessToDriveItem.feature:161](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/removeAccessToDriveItem.feature#L161)
|
||||
|
||||
@@ -482,7 +482,7 @@ Feature: Create a share link for a resource
|
||||
| space | Personal |
|
||||
| permissionsRole | <permissions-role> |
|
||||
| password | %public% |
|
||||
When user "Alice" updates the last public link share using the Graph API with
|
||||
When user "Alice" updates the last public link share using the permissions endpoint of the Graph API:
|
||||
| resource | textfile1.txt |
|
||||
| space | Personal |
|
||||
| permissionsRole | <new-permissions-role> |
|
||||
@@ -552,7 +552,7 @@ Feature: Create a share link for a resource
|
||||
| space | Personal |
|
||||
| permissionsRole | <permissions-role> |
|
||||
| password | %public% |
|
||||
When user "Alice" updates the last public link share using the Graph API with
|
||||
When user "Alice" updates the last public link share using the permissions endpoint of the Graph API:
|
||||
| resource | textfile1.txt |
|
||||
| space | Personal |
|
||||
| permissionsRole | internal |
|
||||
@@ -619,7 +619,7 @@ Feature: Create a share link for a resource
|
||||
| permissionsRole | view |
|
||||
| password | %public% |
|
||||
| expirationDateTime | 2200-07-15T14:00:00.000Z |
|
||||
When user "Alice" updates the last public link share using the Graph API with
|
||||
When user "Alice" updates the last public link share using the permissions endpoint of the Graph API:
|
||||
| resource | textfile1.txt |
|
||||
| space | Personal |
|
||||
| expirationDateTime | 2201-07-15T14:00:00.000Z |
|
||||
@@ -683,7 +683,7 @@ Feature: Create a share link for a resource
|
||||
| permissionsRole | view |
|
||||
| password | %public% |
|
||||
| expirationDateTime | 2200-07-15T14:00:00.000Z |
|
||||
When user "Alice" updates the last public link share using the Graph API with
|
||||
When user "Alice" updates the last public link share using the permissions endpoint of the Graph API:
|
||||
| resource | <resource> |
|
||||
| space | Personal |
|
||||
| expirationDateTime | |
|
||||
@@ -2801,3 +2801,89 @@ Feature: Create a share link for a resource
|
||||
| upload |
|
||||
| createOnly |
|
||||
| blocksDownload |
|
||||
|
||||
|
||||
Scenario Outline: update link share of a project-space using permissions endpoint
|
||||
Given 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 "projectSpace" with the default quota using the Graph API
|
||||
And user "Alice" has created the following space link share:
|
||||
| space | projectSpace |
|
||||
| permissionsRole | <permissions-role> |
|
||||
| password | %public% |
|
||||
| displayName | Homework |
|
||||
| expirationDateTime | 2200-07-15T14:00:00.000Z |
|
||||
When user "Alice" updates the last public link share using the permissions endpoint of the Graph API:
|
||||
| space | projectSpace |
|
||||
| permissionsRole | <new-permissions-role> |
|
||||
| password | p@$$w0rD |
|
||||
| expirationDateTime | 2201-07-15T14:00:00Z |
|
||||
Then the HTTP status code should be "200"
|
||||
And the JSON data of the response should match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"hasPassword",
|
||||
"id",
|
||||
"link",
|
||||
"expirationDateTime",
|
||||
"createdDateTime"
|
||||
],
|
||||
"properties": {
|
||||
"hasPassword": {
|
||||
"const": true
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"pattern": "^[a-zA-Z]{15}$"
|
||||
},
|
||||
"expirationDateTime": {
|
||||
"const": "2201-07-15T23:59:59Z"
|
||||
},
|
||||
"link": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"@libre.graph.displayName",
|
||||
"@libre.graph.quickLink",
|
||||
"preventsDownload",
|
||||
"type",
|
||||
"webUrl"
|
||||
],
|
||||
"properties": {
|
||||
"@libre.graph.displayName": {
|
||||
"const": "Homework"
|
||||
},
|
||||
"@libre.graph.quickLink": {
|
||||
"const": false
|
||||
},
|
||||
"preventsDownload": {
|
||||
"const": false
|
||||
},
|
||||
"type": {
|
||||
"const": "<new-permissions-role>"
|
||||
},
|
||||
"webUrl": {
|
||||
"type": "string",
|
||||
"pattern": "^%base_url%/s/[a-zA-Z]{15}$"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| permissions-role | new-permissions-role |
|
||||
| view | edit |
|
||||
| view | upload |
|
||||
| view | createOnly |
|
||||
| edit | view |
|
||||
| edit | upload |
|
||||
| edit | createOnly |
|
||||
| upload | view |
|
||||
| upload | edit |
|
||||
| upload | createOnly |
|
||||
| createOnly | view |
|
||||
| createOnly | edit |
|
||||
| createOnly | upload |
|
||||
| blocksDownload | blocksDownload |
|
||||
@@ -628,7 +628,7 @@ class SharingNgContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" updates the last public link share using the Graph API with$/
|
||||
* @When user :user updates the last public link share using the permissions endpoint of the Graph API:
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $body
|
||||
@@ -636,7 +636,7 @@ class SharingNgContext implements Context {
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function userUpdatesLastPublicLinkShareUsingTheGraphApiWith(string $user, TableNode $body):void {
|
||||
public function userUpdatesTheLastPublicLinkShareUsingThePermissionsEndpointOfTheGraphApi(string $user, TableNode $body):void {
|
||||
$this->featureContext->setResponse(
|
||||
$this->updateLinkShare(
|
||||
$user,
|
||||
@@ -657,9 +657,12 @@ class SharingNgContext implements Context {
|
||||
public function updateLinkShare(string $user, TableNode $body, string $permissionID): ResponseInterface {
|
||||
$bodyRows = $body->getRowsHash();
|
||||
$space = $bodyRows['space'];
|
||||
$resource = $bodyRows['resource'];
|
||||
if (isset($bodyRows['resource'])) {
|
||||
$itemId = $this->spacesContext->getResourceId($user, $space, $bodyRows['resource']);
|
||||
} else {
|
||||
$itemId = $this->spacesContext->getResourceId($user, $space, $space);
|
||||
}
|
||||
$spaceId = ($this->spacesContext->getSpaceByName($user, $space))['id'];
|
||||
$itemId = $this->spacesContext->getResourceId($user, $space, $resource);
|
||||
$body = [];
|
||||
|
||||
if (\array_key_exists('permissionsRole', $bodyRows)) {
|
||||
|
||||
Reference in New Issue
Block a user