Files
opencloud/tests/acceptance/features/coreApiShareUpdateToShares/updateShare.feature
T
Viktor Scharf 05b0830cbf test: wait for the share sync in the Given steps that create shares (#4158)
* test: wait for the share sync in the Given steps that create shares

Shares are synced (auto-accepted) asynchronously by the sharing service,
so the scenarios waited for it with "user ... has a share ... synced"
after each share. Where they didn't, the following steps could race with
it, e.g. a hide sent before the auto-accept was overwritten by it.

The Given steps that create user and group shares now wait until the
share is synced for each user it was sent to (the members of a group),
unless the user has auto-sync turned off. The "has a share ... synced"
steps that only followed such a Given step are removed, and the line
references of the expected failures are updated.

Assisted-by: Claude Code:claude-opus-5-5

* test: don't wait for the sync of a share with the role Denied

A share with the role Denied gives no access, so it never shows up in
the shared-with-me list of the sharee, and the wait for its sync timed
out.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-29 10:42:57 +00:00

254 lines
12 KiB
Gherkin

@skipOnReva
Feature: sharing
As a user
I want to update share permissions
So that I can decide what resources can be shared with which permission
Background:
Given using OCS API version "1"
And user "Alice" has been created with default attributes
@issue-1289 @issue-7555
Scenario Outline: keep group permissions in sync when the share is renamed by the receiver and then the permissions are updated by sharer
Given using OCS API version "<ocs-api-version>"
And user "Brian" has been created with default attributes
And group "grp1" has been created
And user "Brian" has been added to group "grp1"
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/textfile0.txt"
And user "Alice" has sent the following resource share invitation:
| resource | textfile0.txt |
| space | Personal |
| sharee | grp1 |
| shareType | group |
| permissionsRole | File Editor |
And using SharingNG
And user "Brian" has moved file "/Shares/textfile0.txt" to "/Shares/textfile_new.txt"
When user "Alice" updates the last share using the sharing API with
| permissions | read |
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" sharing with group "grp1" should include
| id | A_STRING |
| item_type | file |
| item_source | A_STRING |
| share_type | group |
| file_source | A_STRING |
| file_target | /Shares/textfile0.txt |
| permissions | read |
| stime | A_NUMBER |
| storage | A_STRING |
| mail_send | 0 |
| uid_owner | %username% |
| displayname_owner | %displayname% |
| mimetype | text/plain |
Examples:
| ocs-api-version | ocs-status-code |
| 1 | 100 |
| 2 | 200 |
Scenario Outline: cannot set permissions to zero
Given using OCS API version "<ocs-api-version>"
And group "grp1" has been created
And user "Alice" has created folder "/FOLDER"
And user "Alice" has sent the following resource share invitation:
| resource | FOLDER |
| space | Personal |
| sharee | grp1 |
| shareType | group |
| permissionsRole | Viewer |
And using SharingNG
When user "Alice" updates the last share using the sharing API with
| permissions | 0 |
Then the OCS status code should be "400"
And the HTTP status code should be "<http-status-code>"
Examples:
| ocs-api-version | http-status-code |
| 1 | 200 |
| 2 | 400 |
@issue-2173
Scenario Outline: cannot update a share of a file with a user to have only create and/or delete permission
Given using OCS API version "<ocs-api-version>"
And user "Brian" has been created with default attributes
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/textfile0.txt"
And user "Alice" has sent the following resource share invitation:
| resource | textfile0.txt |
| space | Personal |
| sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
And using SharingNG
When user "Alice" updates the last share using the sharing API with
| permissions | <permissions> |
Then the OCS status code should be "400"
And the HTTP status code should be "<http-status-code>"
# Brian should still have at least read access to the shared file
And as "Brian" entry "/Shares/textfile0.txt" should exist
Examples:
| ocs-api-version | http-status-code | permissions |
| 1 | 200 | create |
| 2 | 400 | create |
| 1 | 200 | delete |
| 2 | 400 | delete |
| 1 | 200 | create,delete |
| 2 | 400 | create,delete |
@issue-2173
Scenario Outline: cannot update a share of a file with a group to have only create and/or delete permission
Given using OCS API version "<ocs-api-version>"
And user "Brian" has been created with default attributes
And group "grp1" has been created
And user "Brian" has been added to group "grp1"
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/textfile0.txt"
And user "Alice" has sent the following resource share invitation:
| resource | textfile0.txt |
| space | Personal |
| sharee | grp1 |
| shareType | group |
| permissionsRole | Viewer |
And using SharingNG
When user "Alice" updates the last share using the sharing API with
| permissions | <permissions> |
Then the OCS status code should be "400"
And the HTTP status code should be "<http-status-code>"
# Brian in grp1 should still have at least read access to the shared file
And as "Brian" entry "/Shares/textfile0.txt" should exist
Examples:
| ocs-api-version | http-status-code | permissions |
| 1 | 200 | create |
| 2 | 400 | create |
| 1 | 200 | delete |
| 2 | 400 | delete |
| 1 | 200 | create,delete |
| 2 | 400 | create,delete |
@issue-2442
Scenario Outline: share ownership change after moving a shared file to another share
Given using <dav-path-version> DAV path
And these users have been created with default attributes:
| username |
| Brian |
| Carol |
And user "Alice" has created folder "/Alice-folder"
And user "Alice" has created folder "/Alice-folder/folder2"
And user "Carol" has created folder "/Carol-folder"
And user "Alice" has sent the following resource share invitation:
| resource | Alice-folder |
| space | Personal |
| sharee | Brian |
| shareType | user |
| permissionsRole | Editor |
And user "Carol" has sent the following resource share invitation:
| resource | Carol-folder |
| space | Personal |
| sharee | Brian |
| shareType | user |
| permissionsRole | Editor |
When user "Brian" moves folder "/Shares/Alice-folder/folder2" to "/Shares/Carol-folder/folder2" using the WebDAV API
Then the HTTP status code should be "502"
Examples:
| dav-path-version |
| old |
| new |
| spaces |
@issue-1253 @issue-1224 @issue-1225
Scenario Outline: change the permission of the share and check the API response
Given using OCS API version "<ocs-api-version>"
And user "Brian" has been created with default attributes
And user "Alice" has created folder "/Alice-folder"
And user "Alice" has sent the following resource share invitation:
| resource | Alice-folder |
| space | Personal |
| sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
And using SharingNG
When user "Alice" updates the last share using the sharing API with
| permissions | all |
Then the OCS status code should be "<ocs-status-code>"
And the OCS status message should be "OK"
And the HTTP status code should be "200"
And the fields of the last response to user "Alice" sharing with user "Brian" should include
| id | A_STRING |
| share_type | user |
| uid_owner | %username% |
| displayname_owner | %displayname% |
| permissions | all |
| stime | A_NUMBER |
| parent | |
| expiration | |
| token | |
| uid_file_owner | %username% |
| displayname_file_owner | %displayname% |
| additional_info_owner | %emailaddress% |
| additional_info_file_owner | %emailaddress% |
| item_type | folder |
| item_source | A_STRING |
| path | /Alice-folder |
| mimetype | httpd/unix-directory |
| storage_id | A_STRING |
| storage | A_STRING |
| file_source | A_STRING |
| file_target | /Shares/Alice-folder |
| share_with | %username% |
| share_with_displayname | %displayname% |
| share_with_additional_info | %emailaddress% |
| mail_send | 0 |
| name | |
Examples:
| ocs-api-version | ocs-status-code |
| 1 | 100 |
| 2 | 200 |
Scenario Outline: increasing permissions is allowed for owner
Given using OCS API version "<ocs-api-version>"
And user "Brian" has been created with default attributes
And user "Carol" has been created with default attributes
And group "grp1" has been created
And user "Brian" has been added to group "grp1"
And user "Carol" has been added to group "grp1"
And user "Carol" has created folder "/FOLDER"
And user "Carol" has sent the following resource share invitation:
| resource | FOLDER |
| space | Personal |
| sharee | grp1 |
| shareType | group |
| permissionsRole | Editor |
And using SharingNG
And user "Carol" has updated the last share with
| permissions | read |
When user "Carol" updates the last share using the sharing API with
| permissions | all |
Then the OCS status code should be "<ocs-status-code>"
And the HTTP status code should be "200"
And user "Brian" should be able to upload file "filesForUpload/textfile.txt" to "/Shares/FOLDER/textfile.txt"
Examples:
| ocs-api-version | ocs-status-code |
| 1 | 100 |
| 2 | 200 |
Scenario Outline: sharer deletes file uploaded with upload-only permission by sharee to a shared folder
Given using <dav-path-version> DAV path
And user "Brian" has been created with default attributes
And user "Alice" has created folder "/FOLDER"
And user "Alice" has sent the following resource share invitation:
| resource | FOLDER |
| space | Personal |
| sharee | Brian |
| shareType | user |
| permissionsRole | Uploader |
And user "Brian" has uploaded file with content "some content" to "/Shares/FOLDER/textFile.txt"
When user "Alice" deletes file "/FOLDER/textFile.txt" using the WebDAV API
Then the HTTP status code should be "204"
And as "Brian" file "/Shares/FOLDER/textFile.txt" should not exist
And as "Alice" file "/textFile.txt" should not exist
Examples:
| dav-path-version |
| old |
| new |
| spaces |