apiTest: create public link to file with edit permissions

This commit is contained in:
Viktor Scharf committed 2022-04-13 22:34:35 +02:00
1 parent a78df515f4
commit ec2401ec46
2 files changed
+77 -60

No files matched your search

@@ -7,88 +7,72 @@ Feature: Share spaces
See https://github.com/owncloud/ocis/issues/1542 and https://github.com/owncloud/ocis/pull/839 See https://github.com/owncloud/ocis/issues/1542 and https://github.com/owncloud/ocis/pull/839
Background: Background:
Given user "Alice" has been created with default attributes and without skeleton files Given these users have been created with default attributes and without skeleton files:
And user "Brian" has been created with default attributes and without skeleton files | username |
And user "Bob" has been created with default attributes and without skeleton files | Alice |
| Brian |
| Bob |
And the administrator has given "Alice" the role "Admin" using the settings api And the administrator has given "Alice" the role "Admin" using the settings api
And user "Alice" has created a space "share space" with the default quota using the GraphApi
Scenario: A user can share a space to another user with role viewer Scenario Outline:: A user can share a space to another user
Given user "Alice" has created a space "Space to share" of type "project" with quota "10" When user "Alice" shares a space "share space" to user "Brian" with role "<role>"
When user "Alice" shares a space "Space to share" to user "Brian" with role "viewer"
Then the HTTP status code should be "200" Then the HTTP status code should be "200"
And the OCS status code should be "200" And the OCS status code should be "200"
And the OCS status message should be "OK" And the OCS status message should be "OK"
Scenario: A user can share a space to another user with role editor
Given user "Alice" has created a space "Space to share with role editor" of type "project" with quota "10"
When user "Alice" shares a space "Space to share with role editor" to user "Brian" with role "editor"
Then the HTTP status code should be "200"
And the OCS status code should be "200"
And the OCS status message should be "OK"
Scenario: A user can see that a received shared space is available
Given user "Alice" has created a space "Share space to Brian" of type "project" with quota "10"
And user "Alice" has shared a space "Share space to Brian" to user "Brian" with role "viewer"
When user "Brian" lists all available spaces via the GraphApi When user "Brian" lists all available spaces via the GraphApi
Then the json responded should contain a space "Share space to Brian" with these key and value pairs: Then the json responded should contain a space "share space" with these key and value pairs:
| key | value | | key | value |
| driveType | project | | driveType | project |
| id | %space_id% | | id | %space_id% |
| name | Share space to Brian | | name | share space |
Examples:
| role |
| manager |
| editor |
| viewer |
Scenario: A user can see who has been granted access Scenario: A user can see who has been granted access
Given user "Alice" has created a space "Share space to Brian" of type "project" with quota "10" Given user "Alice" has shared a space "share space" to user "Brian" with role "viewer"
And user "Alice" has shared a space "Share space to Brian" to user "Brian" with role "viewer"
When user "Alice" lists all available spaces via the GraphApi When user "Alice" lists all available spaces via the GraphApi
Then the json responded should contain a space "Share space to Brian" granted to "Brian" with these key and value pairs: Then the json responded should contain a space "share space" granted to "Brian" with these key and value pairs:
| key | value | | key | value |
| root@@@permissions@@@1@@@grantedTo@@@0@@@user@@@id | %user_id% | | root@@@permissions@@@1@@@grantedTo@@@0@@@user@@@id | %user_id% |
| root@@@permissions@@@1@@@roles@@@0 | viewer | | root@@@permissions@@@1@@@roles@@@0 | viewer |
Scenario: A user can see a file in a received shared space Scenario: A user can see a file in a received shared space
Given user "Alice" has created a space "Share space with file" of type "project" with quota "10" Given user "Alice" has uploaded a file inside space "share space" with content "Test" to "test.txt"
And user "Alice" has uploaded a file inside space "Share space with file" with content "Test" to "test.txt" And user "Alice" has created a folder "Folder Main" in space "share space"
When user "Alice" has shared a space "Share space with file" to user "Brian" with role "viewer" When user "Alice" shares a space "share space" to user "Brian" with role "viewer"
Then for user "Brian" the space "Share space with file" should contain these entries: Then for user "Brian" the space "share space" should contain these entries:
| test.txt | | test.txt |
Scenario: A user can see a folder in received shared space
Given user "Alice" has created a space "Share space with folder" of type "project" with quota "10"
And user "Alice" has created a folder "Folder Main" in space "Share space with folder"
When user "Alice" has shared a space "Share space with folder" to user "Brian" with role "viewer"
Then for user "Brian" the space "Share space with folder" should contain these entries:
| Folder Main | | Folder Main |
Scenario: When a user unshares a space, the space becomes unavailable to the receiver Scenario: When a user unshares a space, the space becomes unavailable to the receiver
Given user "Alice" has created a space "Unshare space" of type "project" with quota "10" Given user "Alice" has shared a space "share space" to user "Brian" with role "viewer"
And user "Alice" has shared a space "Unshare space" to user "Brian" with role "viewer"
When user "Brian" lists all available spaces via the GraphApi When user "Brian" lists all available spaces via the GraphApi
Then the json responded should contain a space "Unshare space" with these key and value pairs: Then the json responded should contain a space "share space" with these key and value pairs:
| key | value | | key | value |
| driveType | project | | driveType | project |
| id | %space_id% | | id | %space_id% |
| name | Unshare space | | name | share space |
When user "Alice" unshares a space "Unshare space" to user "Brian" When user "Alice" unshares a space "share space" to user "Brian"
Then the HTTP status code should be "200" Then the HTTP status code should be "200"
And user "Brian" lists all available spaces via the GraphApi And user "Brian" lists all available spaces via the GraphApi
And the json responded should not contain a space with name "Unshare space" And the json responded should not contain a space with name "share space"
Scenario: A user can add another user to the space managers to enable him Scenario: A user can add another user to the space managers to enable him
Given user "Alice" has created a space "Multiple Managers" of type "project" with quota "10" Given user "Alice" has uploaded a file inside space "share space" with content "Test" to "test.txt"
And user "Alice" has uploaded a file inside space "Multiple Managers" with content "Test" to "test.txt" And user "Alice" has shared a space "share space" to user "Brian" with role "manager"
When user "Alice" has shared a space "Multiple Managers" to user "Brian" with role "manager" When user "Brian" lists all available spaces via the GraphApi
And user "Brian" lists all available spaces via the GraphApi Then the json responded should contain a space "share space" granted to "Brian" with role "manager"
Then the json responded should contain a space "Multiple Managers" granted to "Brian" with role "manager" When user "Brian" has shared a space "share space" to user "Bob" with role "viewer"
When user "Brian" has shared a space "Multiple Managers" to user "Bob" with role "viewer"
And user "Bob" lists all available spaces via the GraphApi And user "Bob" lists all available spaces via the GraphApi
Then the json responded should contain a space "Multiple Managers" granted to "Bob" with role "viewer" Then the json responded should contain a space "share space" granted to "Bob" with role "viewer"
And for user "Bob" the space "Multiple Managers" should contain these entries: And for user "Bob" the space "share space" should contain these entries:
| test.txt | | test.txt |
@@ -3,12 +3,18 @@ Feature: Share a file or folder that is inside a space via public link
As an user with manager space role As an user with manager space role
I want to be able to share the data inside the space via public link I want to be able to share the data inside the space via public link
folder permissions:
| role | permissions | | role | permissions |
| viewer | 1 | | viewer | 1 |
| uploader | 4 | | uploader | 4 |
| contributor | 5 | | contributor | 5 |
| editor | 15 | | editor | 15 |
file permissions:
| role | permissions |
| viewer | 1 |
| editor | 3 |
Note - this feature is run in CI with ACCOUNTS_HASH_DIFFICULTY set to the default for production Note - this feature is run in CI with ACCOUNTS_HASH_DIFFICULTY set to the default for production
See https://github.com/owncloud/ocis/issues/1542 and https://github.com/owncloud/ocis/pull/839 See https://github.com/owncloud/ocis/issues/1542 and https://github.com/owncloud/ocis/pull/839
@@ -17,7 +23,6 @@ Feature: Share a file or folder that is inside a space via public link
| username | | username |
| Alice | | Alice |
| Brian | | Brian |
| Bob |
And the administrator has given "Alice" the role "Admin" using the settings api And the administrator has given "Alice" the role "Admin" using the settings api
And user "Alice" has created a space "share sub-item" with the default quota using the GraphApi And user "Alice" has created a space "share sub-item" with the default quota using the GraphApi
And user "Alice" has created a folder "folder" in space "share sub-item" And user "Alice" has created a folder "folder" in space "share sub-item"
@@ -44,6 +49,7 @@ Feature: Share a file or folder that is inside a space via public link
| folder | 5 | 200 | | 2042-03-25T23:59:59+0100 | | folder | 5 | 200 | | 2042-03-25T23:59:59+0100 |
| folder | 15 | | link | | | folder | 15 | | link | |
| folder/file.txt | 1 | 123 | link | 2042-03-25T23:59:59+0100 | | folder/file.txt | 1 | 123 | link | 2042-03-25T23:59:59+0100 |
| folder/file.txt | 3 | 123 | link | 2042-03-25T23:59:59+0100 |
Scenario Outline: An user participant of the project space with space manager role can share an entrity inside project space via public link Scenario Outline: An user participant of the project space with space manager role can share an entrity inside project space via public link
@@ -84,3 +90,30 @@ Feature: Share a file or folder that is inside a space via public link
| folder | viewer | | folder | viewer |
| folder/file.txt | editor | | folder/file.txt | editor |
| folder/file.txt | viewer | | folder/file.txt | viewer |
Scenario Outline: User creates a new public link share of a file with edit permissions
Given using OCS API version "<ocs_api_version>"
And user "Alice" has uploaded file with content "Random data" to "/file.txt"
When user "Alice" creates a public link share using the sharing API with settings
| path | file.txt |
| permissions | read,update |
Then the OCS status code should be "<ocs_status_code>"
And the HTTP status code should be "200"
And the fields of the last response to user "Alice" should include
| item_type | file |
| mimetype | text/plain |
| file_target | /file.txt |
| path | /file.txt |
| permissions | read,update |
| share_type | public_link |
| displayname_file_owner | %displayname% |
| displayname_owner | %displayname% |
| uid_file_owner | %username% |
| uid_owner | %username% |
And the public should be able to download the last publicly shared file using the <webdav_api_version> public WebDAV API without a password and the content should be "Random data"
And the public upload to the last publicly shared file using the <webdav_api_version> public WebDAV API should pass with HTTP status code "204"
Examples:
| ocs_api_version | ocs_status_code | webdav_api_version |
| 1 | 100 | new |
| 2 | 200 | new |