add create share link using root endpoint (#9076)

This commit is contained in:
Amrita
2024-05-10 12:17:15 +05:45
committed by GitHub
parent b4b51437a0
commit 71ca659ee8
3 changed files with 632 additions and 0 deletions
@@ -254,6 +254,14 @@ The expected failures in this file are from features in the owncloud/ocis repo.
- [apiSharingNg/linkShare.feature:1596](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L1596)
- [apiSharingNg/linkShare.feature:1597](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L1597)
- [apiSharingNg/linkShare.feature:1598](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L1598)
- [apiSharingNg/linkShare.feature:1837](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L1837)
- [apiSharingNg/linkShare.feature:1977](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L1977)
- [apiSharingNg/linkShare.feature:2031](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L2031)
- [apiSharingNg/linkShare.feature:2032](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L2032)
- [apiSharingNg/linkShare.feature:2033](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L2033)
- [apiSharingNg/linkShare.feature:2101](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L2101)
- [apiSharingNg/linkShare.feature:2168](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L2168)
- [apiSharingNg/linkShare.feature:2239](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L2239)
- [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)
@@ -1630,3 +1630,610 @@ Feature: Create a share link for a resource
}
"""
And the public should be able to download file "textfile.txt" from the last link share with password "%public%" and the content should be "to share"
@issue-7879
Scenario Outline: try to create a link share of a Personal and Share drive using root endpoint
When user "Alice" tries to create the following space link share using root endpoint of the Graph API:
| space | <drive> |
| permissionsRole | <permissions-role> |
| password | %public% |
Then the HTTP status code should be "400"
And the JSON data of the response should match
"""
{
"type": "object",
"required": ["error"],
"properties": {
"error": {
"type": "object",
"required": [
"code",
"innererror",
"message"
],
"properties": {
"code": {
"const": "invalidRequest"
},
"innererror": {
"type": "object",
"required": [
"date",
"request-id"
]
},
"message": {
"const": "unsupported space type"
}
}
}
}
}
"""
Examples:
| permissions-role | drive |
| view | Shares |
| edit | Shares |
| upload | Shares |
| createOnly | Shares |
| blocksDownload | Shares |
| view | Personal |
| edit | Personal |
| upload | Personal |
| createOnly | Personal |
| blocksDownload | Personal |
Scenario Outline: try to create an internal link share of a Personal and Share drives using root endpoint
When user "Alice" tries to create the following space link share using root endpoint of the Graph API:
| space | <drive> |
| permissionsRole | internal |
Then the HTTP status code should be "400"
And the JSON data of the response should match
"""
{
"type": "object",
"required": ["error"],
"properties": {
"error": {
"type": "object",
"required": [
"code",
"innererror",
"message"
],
"properties": {
"code": {
"const": "invalidRequest"
},
"innererror": {
"type": "object",
"required": [
"date",
"request-id"
]
},
"message": {
"const": "unsupported space type"
}
}
}
}
}
"""
Examples:
| drive |
| Personal |
| Shares |
Scenario Outline: try to create an internal link share with password of a Personal and Share drive using root endpoint
When user "Alice" tries to create the following space link share using root endpoint of the Graph API:
| space | <drive> |
| permissionsRole | internal |
| password | %public% |
Then the HTTP status code should be "400"
And the JSON data of the response should match
"""
{
"type": "object",
"required": ["error"],
"properties": {
"error": {
"type": "object",
"required": [
"code",
"innererror",
"message"
],
"properties": {
"code": {
"const": "invalidRequest"
},
"innererror": {
"type": "object",
"required": [
"date",
"request-id"
]
},
"message": {
"const": "unsupported space type"
}
}
}
}
}
"""
Examples:
| drive |
| Personal |
| Shares |
@issue-7879
Scenario Outline: create a link share of a project-space drive with different permissions using root 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
When user "Alice" creates the following space link share using root endpoint of the Graph API:
| space | projectSpace |
| permissionsRole | <permissions-role> |
| password | %public% |
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
{
"type": "object",
"required": [
"hasPassword",
"id",
"link"
],
"properties": {
"hasPassword": {
"const": true
},
"id": {
"type": "string",
"pattern": "^[a-zA-Z]{15}$"
},
"link": {
"type": "object",
"required": [
"@libre.graph.displayName",
"@libre.graph.quickLink",
"preventsDownload",
"type",
"webUrl"
],
"properties": {
"@libre.graph.displayName": {
"const": ""
},
"@libre.graph.quickLink": {
"const": false
},
"preventsDownload": {
"const": false
},
"type": {
"const": "<permissions-role>"
},
"webUrl": {
"type": "string",
"pattern": "^%base_url%/s/[a-zA-Z]{15}$"
}
}
}
}
}
"""
Examples:
| permissions-role |
| view |
| edit |
| upload |
| createOnly |
| blocksDownload |
Scenario: create an internal link share of a project-space using root 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
When user "Alice" creates the following space link share using root endpoint of the Graph API:
| space | projectSpace |
| permissionsRole | internal |
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
{
"type": "object",
"required": [
"hasPassword",
"id",
"link"
],
"properties": {
"hasPassword": {
"const": false
},
"id": {
"pattern": "^[a-zA-Z]{15}$"
},
"link": {
"type": "object",
"required": [
"@libre.graph.displayName",
"@libre.graph.quickLink",
"preventsDownload",
"type",
"webUrl"
],
"properties": {
"@libre.graph.displayName": {
"const": ""
},
"@libre.graph.quickLink": {
"const": false
},
"preventsDownload": {
"const": false
},
"type": {
"const": "internal"
},
"webUrl": {
"type": "string",
"pattern": "^%base_url%/s/[a-zA-Z]{15}$"
}
}
}
}
}
"""
Scenario: try to create an internal link share of a project-space drive with password
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
When user "Alice" tries to create the following space link share using root endpoint of the Graph API:
| space | projectSpace |
| permissionsRole | internal |
| password | %public% |
Then the HTTP status code should be "400"
@issue-7879
Scenario Outline: create a link share of a project-space drive with display name and expiry date using root 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
When user "Alice" creates the following space link share using root endpoint of the Graph API:
| space | projectSpace |
| permissionsRole | <permissions-role> |
| password | %public% |
| displayName | Homework |
| expirationDateTime | 2200-07-15T14:00:00.000Z |
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
{
"type": "object",
"required": [
"hasPassword",
"id",
"link",
"expirationDateTime"
],
"properties": {
"hasPassword": {
"const": true
},
"id": {
"type": "string",
"pattern": "^[a-zA-Z]{15}$"
},
"expirationDateTime": {
"const": "2200-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": "<permissions-role>"
},
"webUrl": {
"type": "string",
"pattern": "^%base_url%/s/[a-zA-Z]{15}$"
}
}
}
}
}
"""
Examples:
| permissions-role |
| view |
| edit |
| upload |
| createOnly |
| blocksDownload |
@issue-7879
Scenario Outline: try to create a link share of a project-space drive with a password that is listed in the Banned-Password-List using root endpoint
Given the config "OCIS_PASSWORD_POLICY_BANNED_PASSWORDS_LIST" has been set to path "config/drone/banned-password-list.txt"
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 "projectSpace" with the default quota using the Graph API
When user "Alice" tries to create the following space link share using root endpoint of the Graph API:
| space | projectSpace |
| permissionsRole | <permissions-role> |
| password | <banned-password> |
Then the HTTP status code should be "400"
And the JSON data of the response should match
"""
{
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "string",
"pattern": "invalidRequest"
},
"message": {
"const": "unfortunately, your password is commonly used. please pick a harder-to-guess password for your safety"
}
}
}
}
}
"""
Examples:
| banned-password | permissions-role |
| 123 | view |
| password | view |
| ownCloud | view |
| 123 | edit |
| password | edit |
| ownCloud | edit |
| 123 | upload |
| password | upload |
| ownCloud | upload |
| 123 | createOnly |
| password | createOnly |
| ownCloud | createOnly |
| 123 | blocksDownload |
| password | blocksDownload |
| ownCloud | blocksDownload |
@env-config @issue-7879
Scenario Outline: create a link share of a project-space drive without password using root endpoint
Given the following configs have been set:
| config | value |
| OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
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 "projectSpace" with the default quota using the Graph API
When user "Alice" creates the following space link share using root endpoint of the Graph API:
| space | projectSpace |
| permissionsRole | <permissions-role> |
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
{
"type": "object",
"required": [
"hasPassword",
"id",
"link"
],
"properties": {
"hasPassword": {
"const": false
},
"id": {
"type": "string",
"pattern": "^[a-zA-Z]{15}$"
},
"link": {
"type": "object",
"required": [
"@libre.graph.displayName",
"@libre.graph.quickLink",
"preventsDownload",
"type",
"webUrl"
],
"properties": {
"@libre.graph.displayName": {
"const": ""
},
"@libre.graph.quickLink": {
"const": false
},
"preventsDownload": {
"const": false
},
"type": {
"const": "<permissions-role>"
},
"webUrl": {
"type": "string",
"pattern": "^%base_url%/s/[a-zA-Z]{15}$"
}
}
}
}
}
"""
Examples:
| permissions-role |
| view |
| edit |
| upload |
| createOnly |
| blocksDownload |
@issue-7879
Scenario Outline: create a link share of a project-space drive with display name using root 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
When user "Alice" creates the following space link share using root endpoint of the Graph API:
| space | projectSpace |
| permissionsRole | <permissions-role> |
| password | %public% |
| displayName | Homework |
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
{
"type": "object",
"required": [
"hasPassword",
"id",
"link"
],
"properties": {
"hasPassword": {
"const": true
},
"id": {
"type": "string",
"pattern": "^[a-zA-Z]{15}$"
},
"link": {
"type": "object",
"required": [
"@libre.graph.displayName",
"@libre.graph.quickLink",
"preventsDownload",
"type",
"webUrl"
],
"properties": {
"@libre.graph.displayName": {
"const": "Homework"
},
"@libre.graph.quickLink": {
"const": false
},
"preventsDownload": {
"const": false
},
"type": {
"const": "<permissions-role>"
},
"webUrl": {
"type": "string",
"pattern": "^%base_url%/s/[a-zA-Z]{15}$"
}
}
}
}
}
"""
Examples:
| permissions-role |
| view |
| edit |
| upload |
| createOnly |
| blocksDownload |
@issue-7879
Scenario Outline: create a link share of a project-space drive with expiry date using root 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
When user "Alice" creates the following space link share using root endpoint of the Graph API:
| space | projectSpace |
| permissionsRole | <permissions-role> |
| password | %public% |
| expirationDateTime | 2200-07-15T14:00:00.000Z |
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
{
"type": "object",
"required": [
"hasPassword",
"id",
"link",
"expirationDateTime"
],
"properties": {
"hasPassword": {
"const": true
},
"id": {
"type": "string",
"pattern": "^[a-zA-Z]{15}$"
},
"expirationDateTime": {
"const": "2200-07-15T23:59:59Z"
},
"link": {
"type": "object",
"required": [
"@libre.graph.displayName",
"@libre.graph.quickLink",
"preventsDownload",
"type",
"webUrl"
],
"properties": {
"@libre.graph.displayName": {
"const": ""
},
"@libre.graph.quickLink": {
"const": false
},
"preventsDownload": {
"const": false
},
"type": {
"const": "<permissions-role>"
},
"webUrl": {
"type": "string",
"pattern": "^%base_url%/s/[a-zA-Z]{15}$"
}
}
}
}
}
"""
Examples:
| permissions-role |
| view |
| edit |
| upload |
| createOnly |
| blocksDownload |
@@ -1266,4 +1266,21 @@ class SharingNgContext implements Context {
)
);
}
/**
* @When /^user "([^"]*)" (?:tries to create|creates) the following space link share using root endpoint of the Graph API:$/
*
* @param string $user
* @param TableNode $body
*
* @return void
* @throws GuzzleException
*/
public function userCreatesTheFollowingSpaceLinkShareUsingRootEndpointOfTheGraphApi(string $user, TableNode $body): void {
$rows = $body->getRowsHash();
Assert::assertArrayNotHasKey("resource", $rows, "'resource' should not be provided in the data-table while sharing a space");
$response = $this->createDriveLinkShare($user, $body);
$this->featureContext->setResponse($response);
}
}