Files
ocis/tests/acceptance/features/apiSpacesShares/shareOperations.feature
T

398 lines
19 KiB
Gherkin
Raw Normal View History

2022-08-09 14:00:02 +05:45
Feature: sharing
As a user
I want to share resources with different permissions
So that I can manage the access to the resource
2022-08-09 14:00:02 +05:45
Background:
Given using OCS API version "1"
And these users have been created with default attributes and without skeleton files:
| username |
| Alice |
| Brian |
2022-08-10 09:40:26 +05:45
And using spaces DAV path
2022-08-09 14:00:02 +05:45
Scenario: correct webdav share-permissions for received file with edit and reshare permissions
2022-08-09 14:00:02 +05:45
Given user "Alice" has uploaded file with content "foo" to "/tmp.txt"
And user "Alice" has shared file "/tmp.txt" with user "Brian"
2022-10-20 20:49:57 +02:00
When user "Brian" gets the following properties of file "/tmp.txt" inside space "Shares" using the WebDAV API
2022-08-09 14:00:02 +05:45
| propertyName |
| ocs:share-permissions |
Then the HTTP status code should be "207"
2022-08-09 14:00:02 +05:45
And the single response should contain a property "ocs:share-permissions" with value "19"
Scenario: correct webdav share-permissions for received group shared file with edit and reshare permissions
2022-08-09 14:00:02 +05:45
Given group "grp1" has been created
And user "Brian" has been added to group "grp1"
And user "Alice" has uploaded file with content "foo" to "/tmp.txt"
And user "Alice" has created a share with settings
| path | /tmp.txt |
| shareType | group |
| permissions | share,update,read |
| shareWith | grp1 |
2022-10-20 20:49:57 +02:00
When user "Brian" gets the following properties of file "/tmp.txt" inside space "Shares" using the WebDAV API
2022-08-09 14:00:02 +05:45
| propertyName |
| ocs:share-permissions |
Then the HTTP status code should be "207"
2022-08-09 14:00:02 +05:45
And the single response should contain a property "ocs:share-permissions" with value "19"
Scenario: correct webdav share-permissions for received file with edit permissions but no reshare permissions
2022-08-09 14:00:02 +05:45
Given user "Alice" has uploaded file with content "foo" to "/tmp.txt"
And user "Alice" has shared file "tmp.txt" with user "Brian"
When user "Alice" updates the last share using the sharing API with
| permissions | update,read |
Then the HTTP status code should be "200"
2022-10-20 20:49:57 +02:00
And as user "Brian" file "/tmp.txt" inside space "Shares" should contain a property "ocs:share-permissions" with value "3"
2022-08-09 14:00:02 +05:45
Scenario: correct webdav share-permissions for received group shared file with edit permissions but no reshare permissions
2022-08-09 14:00:02 +05:45
Given group "grp1" has been created
And user "Brian" has been added to group "grp1"
And user "Alice" has uploaded file with content "foo" to "/tmp.txt"
And user "Alice" has created a share with settings
| path | /tmp.txt |
| shareType | group |
| permissions | update,read |
| shareWith | grp1 |
2022-10-20 20:49:57 +02:00
When user "Brian" gets the following properties of file "/tmp.txt" inside space "Shares" using the WebDAV API
2022-08-09 14:00:02 +05:45
| propertyName |
| ocs:share-permissions |
Then the HTTP status code should be "207"
2022-08-09 14:00:02 +05:45
And the single response should contain a property "ocs:share-permissions" with value "3"
Scenario: correct webdav share-permissions for received file with reshare permissions but no edit permissions
2022-08-09 14:00:02 +05:45
Given user "Alice" has uploaded file with content "foo" to "/tmp.txt"
And user "Alice" has shared file "tmp.txt" with user "Brian"
When user "Alice" updates the last share using the sharing API with
| permissions | share,read |
Then the HTTP status code should be "200"
2022-10-20 20:49:57 +02:00
And as user "Brian" file "/tmp.txt" inside space "Shares" should contain a property "ocs:share-permissions" with value "17"
2022-08-10 09:40:26 +05:45
2022-08-09 14:00:02 +05:45
Scenario: correct webdav share-permissions for received group shared file with reshare permissions but no edit permissions
2022-08-09 14:00:02 +05:45
Given group "grp1" has been created
And user "Brian" has been added to group "grp1"
And user "Alice" has uploaded file with content "foo" to "/tmp.txt"
And user "Alice" has created a share with settings
| path | /tmp.txt |
| shareType | group |
| permissions | share,read |
| shareWith | grp1 |
2022-10-20 20:49:57 +02:00
When user "Brian" gets the following properties of file "/tmp.txt" inside space "Shares" using the WebDAV API
2022-08-09 14:00:02 +05:45
| propertyName |
| ocs:share-permissions |
Then the HTTP status code should be "207"
2022-08-09 14:00:02 +05:45
And the single response should contain a property "ocs:share-permissions" with value "17"
Scenario: correct webdav share-permissions for received folder with all permissions
2022-08-09 14:00:02 +05:45
Given user "Alice" has created folder "/tmp"
And user "Alice" has shared file "/tmp" with user "Brian"
2022-10-20 20:49:57 +02:00
When user "Brian" gets the following properties of folder "/tmp" inside space "Shares" using the WebDAV API
2022-08-09 14:00:02 +05:45
| propertyName |
| ocs:share-permissions |
Then the HTTP status code should be "207"
2022-08-09 14:00:02 +05:45
And the single response should contain a property "ocs:share-permissions" with value "31"
2022-08-10 09:40:26 +05:45
2022-08-09 14:00:02 +05:45
Scenario: correct webdav share-permissions for received group shared folder with all permissions
2022-08-09 14:00:02 +05:45
Given group "grp1" has been created
And user "Brian" has been added to group "grp1"
And user "Alice" has created folder "/tmp"
And user "Alice" has created a share with settings
| path | tmp |
| shareType | group |
| shareWith | grp1 |
2022-10-20 20:49:57 +02:00
When user "Brian" gets the following properties of folder "/tmp" inside space "Shares" using the WebDAV API
2022-08-09 14:00:02 +05:45
| propertyName |
| ocs:share-permissions |
Then the HTTP status code should be "207"
2022-08-09 14:00:02 +05:45
And the single response should contain a property "ocs:share-permissions" with value "31"
Scenario: correct webdav share-permissions for received folder with all permissions but edit
2022-08-09 14:00:02 +05:45
Given user "Alice" has created folder "/tmp"
And user "Alice" has shared file "/tmp" with user "Brian"
When user "Alice" updates the last share using the sharing API with
| permissions | share,delete,create,read |
Then the HTTP status code should be "200"
2022-10-20 20:49:57 +02:00
And as user "Brian" folder "/tmp" inside space "Shares" should contain a property "ocs:share-permissions" with value "29"
2022-08-09 14:00:02 +05:45
Scenario: correct webdav share-permissions for received group shared folder with all permissions but edit
2022-08-09 14:00:02 +05:45
Given group "grp1" has been created
And user "Brian" has been added to group "grp1"
And user "Alice" has created folder "/tmp"
And user "Alice" has created a share with settings
| path | tmp |
| shareType | group |
| shareWith | grp1 |
| permissions | share,delete,create,read |
When user "Brian" gets the following properties of folder "/tmp" inside space "Shares" using the WebDAV API
2022-08-09 14:00:02 +05:45
| propertyName |
| ocs:share-permissions |
Then the HTTP status code should be "207"
2022-08-09 14:00:02 +05:45
And the single response should contain a property "ocs:share-permissions" with value "29"
2022-08-10 09:40:26 +05:45
2022-08-09 14:00:02 +05:45
Scenario: correct webdav share-permissions for received folder with all permissions but create
2022-08-09 14:00:02 +05:45
Given user "Alice" has created folder "/tmp"
And user "Alice" has shared file "/tmp" with user "Brian"
When user "Alice" updates the last share using the sharing API with
| permissions | share,delete,update,read |
Then the HTTP status code should be "200"
And as user "Brian" folder "/tmp" inside space "Shares" should contain a property "ocs:share-permissions" with value "27"
2022-08-10 09:40:26 +05:45
2022-08-09 14:00:02 +05:45
Scenario: correct webdav share-permissions for received group shared folder with all permissions but create
2022-08-09 14:00:02 +05:45
Given group "grp1" has been created
And user "Brian" has been added to group "grp1"
And user "Alice" has created folder "/tmp"
And user "Alice" has created a share with settings
| path | tmp |
| shareType | group |
| shareWith | grp1 |
| permissions | share,delete,update,read |
2022-10-20 20:49:57 +02:00
When user "Brian" gets the following properties of folder "/tmp" inside space "Shares" using the WebDAV API
2022-08-09 14:00:02 +05:45
| propertyName |
| ocs:share-permissions |
Then the HTTP status code should be "207"
2022-08-09 14:00:02 +05:45
And the single response should contain a property "ocs:share-permissions" with value "27"
2022-08-10 09:40:26 +05:45
2022-08-09 14:00:02 +05:45
Scenario: correct webdav share-permissions for received folder with all permissions but delete
2022-08-09 14:00:02 +05:45
Given user "Alice" has created folder "/tmp"
And user "Alice" has shared file "/tmp" with user "Brian"
When user "Alice" updates the last share using the sharing API with
| permissions | share,create,update,read |
Then the HTTP status code should be "200"
2022-10-20 20:49:57 +02:00
And as user "Brian" folder "/tmp" inside space "Shares" should contain a property "ocs:share-permissions" with value "23"
2022-08-10 09:40:26 +05:45
Scenario: correct webdav share-permissions for received group shared folder with all permissions but delete
2022-08-09 14:00:02 +05:45
Given group "grp1" has been created
And user "Brian" has been added to group "grp1"
And user "Alice" has created folder "/tmp"
And user "Alice" has created a share with settings
| path | tmp |
| shareType | group |
| shareWith | grp1 |
| permissions | share,create,update,read |
2022-10-20 20:49:57 +02:00
When user "Brian" gets the following properties of folder "/tmp" inside space "Shares" using the WebDAV API
2022-08-09 14:00:02 +05:45
| propertyName |
| ocs:share-permissions |
Then the HTTP status code should be "207"
2022-08-09 14:00:02 +05:45
And the single response should contain a property "ocs:share-permissions" with value "23"
2022-08-10 09:40:26 +05:45
2022-08-09 14:00:02 +05:45
Scenario: correct webdav share-permissions for received folder with all permissions but share
2022-08-09 14:00:02 +05:45
Given user "Alice" has created folder "/tmp"
And user "Alice" has shared file "/tmp" with user "Brian"
When user "Alice" updates the last share using the sharing API with
| permissions | change |
Then the HTTP status code should be "200"
2022-10-20 20:49:57 +02:00
And as user "Brian" folder "/tmp" inside space "Shares" should contain a property "ocs:share-permissions" with value "15"
2022-08-10 09:40:26 +05:45
2022-08-09 14:00:02 +05:45
Scenario: correct webdav share-permissions for received group shared folder with all permissions but share
2022-08-09 14:00:02 +05:45
Given group "grp1" has been created
And user "Brian" has been added to group "grp1"
And user "Alice" has created folder "/tmp"
And user "Alice" has created a share with settings
| path | tmp |
| shareType | group |
| shareWith | grp1 |
| permissions | change |
2022-10-20 20:49:57 +02:00
When user "Brian" gets the following properties of folder "/tmp" inside space "Shares" using the WebDAV API
2022-08-09 14:00:02 +05:45
| propertyName |
| ocs:share-permissions |
Then the HTTP status code should be "207"
2022-08-10 09:40:26 +05:45
And the single response should contain a property "ocs:share-permissions" with value "15"
Scenario: uploading a file to a folder received as a read-only group share
2022-08-10 09:40:26 +05:45
Given group "grp1" has been created
And user "Brian" has been added to group "grp1"
And user "Alice" has created folder "FOLDER"
And user "Alice" has created a share with settings
| path | FOLDER |
| shareType | group |
| permissions | read |
| shareWith | grp1 |
2022-10-20 20:49:57 +02:00
When user "Brian" uploads a file inside space "Shares" with content "new description" to "/FOLDER/textfile.txt" using the WebDAV API
2022-08-10 09:40:26 +05:45
Then the HTTP status code should be "403"
And as "Alice" file "/FOLDER/textfile.txt" should not exist
Scenario: uploading a file to a folder received as a upload-only user share
2022-08-10 09:40:26 +05:45
Given user "Alice" has created folder "FOLDER"
And user "Alice" has created a share with settings
| path | FOLDER |
| shareType | user |
| permissions | create |
| shareWith | Brian |
2022-10-20 20:49:57 +02:00
When user "Brian" uploads a file inside space "Shares" with content "new description" to "/FOLDER/textfile.txt" using the WebDAV API
2022-08-10 09:40:26 +05:45
Then the HTTP status code should be "201"
And the following headers should match these regular expressions for user "Brian"
| ETag | /^"[a-f0-9:\.]{1,32}"$/ |
And the content of file "/FOLDER/textfile.txt" for user "Alice" should be:
"""
new description
"""
2022-08-10 09:40:26 +05:45
Scenario: uploading a file to a folder received as a upload-only group share
2022-08-10 09:40:26 +05:45
Given group "grp1" has been created
And user "Brian" has been added to group "grp1"
And user "Alice" has created folder "FOLDER"
And user "Alice" has created a share with settings
| path | FOLDER |
| shareType | group |
| permissions | create |
| shareWith | grp1 |
2022-10-20 20:49:57 +02:00
When user "Brian" uploads a file inside space "Shares" with content "new description" to "/FOLDER/textfile.txt" using the WebDAV API
2022-08-10 09:40:26 +05:45
Then the HTTP status code should be "201"
And the following headers should match these regular expressions for user "Brian"
| ETag | /^"[a-f0-9:\.]{1,32}"$/ |
And the content of file "/FOLDER/textfile.txt" for user "Alice" should be:
"""
new description
"""
2022-08-10 09:40:26 +05:45
Scenario: uploading a file to a folder received as a read/write user share
2022-08-10 09:40:26 +05:45
Given user "Alice" has created folder "FOLDER"
And user "Alice" has created a share with settings
| path | FOLDER |
| shareType | user |
| permissions | change |
| shareWith | Brian |
2022-10-20 20:49:57 +02:00
When user "Brian" uploads a file inside space "Shares" with content "new description" to "/FOLDER/textfile.txt" using the WebDAV API
2022-08-10 09:40:26 +05:45
Then the HTTP status code should be "201"
And the content of file "/FOLDER/textfile.txt" for user "Alice" should be:
"""
new description
"""
2022-08-10 09:40:26 +05:45
Scenario: uploading a file to a folder received as a read/write group share
2022-08-10 09:40:26 +05:45
Given group "grp1" has been created
And user "Brian" has been added to group "grp1"
And user "Alice" has created folder "FOLDER"
And user "Alice" has created a share with settings
| path | FOLDER |
| shareType | group |
| permissions | change |
| shareWith | grp1 |
2022-10-20 20:49:57 +02:00
When user "Brian" uploads a file inside space "Shares" with content "new description" to "/FOLDER/textfile.txt" using the WebDAV API
2022-08-10 09:40:26 +05:45
Then the HTTP status code should be "201"
And the content of file "/FOLDER/textfile.txt" for user "Alice" should be:
"""
new description
"""
2022-08-10 09:40:26 +05:45
Scenario: uploading to a user shared folder with read/write permission when the sharer has insufficient quota
2022-08-10 09:40:26 +05:45
Given user "Alice" has created folder "FOLDER"
And user "Alice" has created a share with settings
| path | FOLDER |
| shareType | user |
| permissions | change |
| shareWith | Brian |
And user "Admin" has changed the quota of the personal space of "Alice Hansen" space to "1"
2022-10-20 20:49:57 +02:00
When user "Brian" uploads a file inside space "Shares" with content "new description" to "/FOLDER/textfile.txt" using the WebDAV API
2022-08-10 09:40:26 +05:45
Then the HTTP status code should be "507"
And as "Alice" file "/FOLDER/textfile.txt" should not exist
Scenario: uploading to a user shared folder with upload-only permission when the sharer has insufficient quota
2022-08-10 09:40:26 +05:45
Given user "Alice" has created folder "FOLDER"
And user "Alice" has created a share with settings
| path | FOLDER |
| shareType | user |
| permissions | create |
| shareWith | Brian |
And user "Admin" has changed the quota of the personal space of "Alice Hansen" space to "1"
2022-10-20 20:49:57 +02:00
When user "Brian" uploads a file inside space "Shares" with content "new description" to "/FOLDER/textfile.txt" using the WebDAV API
2022-08-10 09:40:26 +05:45
Then the HTTP status code should be "507"
And as "Alice" file "/FOLDER/textfile.txt" should not exist
Scenario: uploading a file to a group shared folder with upload-only permission when the sharer has insufficient quota
2022-08-10 09:40:26 +05:45
Given group "grp1" has been created
And user "Brian" has been added to group "grp1"
And user "Alice" has created folder "FOLDER"
And user "Alice" has created a share with settings
| path | FOLDER |
| shareType | group |
| permissions | create |
| shareWith | grp1 |
And user "Admin" has changed the quota of the personal space of "Alice Hansen" space to "10"
2022-10-20 20:49:57 +02:00
When user "Brian" uploads a file inside space "Shares" with content "new descriptionfgshsywhhh" to "/FOLDER/textfile.txt" using the WebDAV API
2022-08-10 09:40:26 +05:45
Then the HTTP status code should be "507"
And as "Alice" file "/FOLDER/textfile.txt" should not exist
Scenario Outline: sharer can download file uploaded with different permission by sharee to a shared folder
2022-08-10 09:40:26 +05:45
Given user "Alice" has created folder "FOLDER"
And user "Alice" has created a share with settings
| path | FOLDER |
| shareType | user |
| permissions | <permissions> |
| shareWith | Brian |
2022-10-20 20:49:57 +02:00
When user "Brian" uploads a file inside space "Shares" with content "some content" to "/FOLDER/textfile.txt" using the WebDAV API
2022-08-10 09:40:26 +05:45
And user "Alice" downloads file "/FOLDER/textfile.txt" using the WebDAV API
Then the HTTP status code should be "200"
And the downloaded content should be "some content"
Examples:
2022-08-10 09:40:26 +05:45
| permissions |
| change |
| create |
Scenario Outline: space admin tries to remove password of a public link share (change/create permission)
Given using spaces DAV path
And using OCS API version "<ocs_api_version>"
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Alice" has created folder "FOLDER"
And user "Alice" has created a public link share with settings
| path | /FOLDER |
| permissions | <permissions> |
| password | %public% |
When user "Alice" updates the last public link share using the sharing API with
| path | /FOLDER |
| permissions | <permissions> |
| password | |
Then the HTTP status code should be "<http_status_code>"
And the OCS status code should be "400"
And the OCS status message should be "missing required password"
Examples:
| ocs_api_version | permissions | http_status_code |
| 1 | change | 200 |
| 2 | change | 400 |
| 1 | create | 200 |
| 2 | create | 400 |
Scenario Outline: space admin removes password of a public link share (read permission)
Given using spaces DAV path
And using OCS API version "<ocs_api_version>"
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Alice" has created folder "FOLDER"
And user "Alice" has created a public link share with settings
| path | /FOLDER |
| permissions | read |
| password | %public% |
When user "Alice" updates the last public link share using the sharing API with
| path | /FOLDER |
| permissions | read |
| password | |
Then the HTTP status code should be "200"
And the OCS status code should be "<ocs_status_code>"
Examples:
| ocs_api_version | ocs_status_code |
| 1 | 100 |
| 2 | 200 |