"
And the HTTP status code should be "200"
And the fields of the last response should include
- | share_with | user1 |
- | share_with_displayname | User One |
- | file_target | /welcome.txt |
- | path | /welcome.txt |
- | permissions | share,read,update |
- | uid_owner | user0 |
- | displayname_owner | User Zero |
- | item_type | file |
- | mimetype | text/plain |
- | storage_id | ANY_VALUE |
- | share_type | user |
+ | share_with | user1 |
+ | share_with_displayname | User One |
+ | file_target | /welcome.txt |
+ | path | /welcome.txt |
+ | permissions | share,read,update |
+ | uid_owner | user0 |
+ | displayname_owner | User Zero |
+ | item_type | file |
+ | mimetype | text/plain |
+ | storage_id | ANY_VALUE |
+ | share_type | user |
And the downloaded content when downloading file "welcome.txt" for user "user1" with range "bytes=0-6" should be "Welcome"
Examples:
| ocs_api_version | ocs_status_code |
@@ -38,17 +38,17 @@ Feature: sharing
Then the OCS status code should be ""
And the HTTP status code should be "200"
And the fields of the last response should include
- | share_with | user1 |
- | share_with_displayname | User One |
- | file_target | /welcome.txt |
- | path | /welcome.txt |
- | permissions | |
- | uid_owner | user0 |
- | displayname_owner | User Zero |
- | item_type | file |
- | mimetype | text/plain |
- | storage_id | ANY_VALUE |
- | share_type | user |
+ | share_with | user1 |
+ | share_with_displayname | User One |
+ | file_target | /welcome.txt |
+ | path | /welcome.txt |
+ | permissions | |
+ | uid_owner | user0 |
+ | displayname_owner | User Zero |
+ | item_type | file |
+ | mimetype | text/plain |
+ | storage_id | ANY_VALUE |
+ | share_type | user |
Examples:
| ocs_api_version | requested_permissions | granted_permissions | ocs_status_code |
# Ask for full permissions. You get share plus read plus update. create and delete do not apply to shares of a file
@@ -97,17 +97,17 @@ Feature: sharing
Then the OCS status code should be ""
And the HTTP status code should be "200"
And the fields of the last response should include
- | share_with | user1 |
- | share_with_displayname | User One |
- | file_target | /FOLDER |
- | path | /FOLDER |
- | permissions | all |
- | uid_owner | user0 |
- | displayname_owner | User Zero |
- | item_type | folder |
- | mimetype | httpd/unix-directory |
- | storage_id | ANY_VALUE |
- | share_type | user |
+ | share_with | user1 |
+ | share_with_displayname | User One |
+ | file_target | /FOLDER |
+ | path | /FOLDER |
+ | permissions | all |
+ | uid_owner | user0 |
+ | displayname_owner | User Zero |
+ | item_type | folder |
+ | mimetype | httpd/unix-directory |
+ | storage_id | ANY_VALUE |
+ | share_type | user |
Examples:
| ocs_api_version | ocs_status_code |
| 1 | 100 |
@@ -170,17 +170,17 @@ Feature: sharing
Then the OCS status code should be ""
And the HTTP status code should be "200"
And the fields of the last response should include
- | share_with | user1 |
- | share_with_displayname | User One |
- | file_target | /welcome.txt |
- | path | /welcome.txt |
- | permissions | share,read,update |
- | uid_owner | user0 |
- | displayname_owner | User Zero |
- | item_type | file |
- | mimetype | text/plain |
- | storage_id | ANY_VALUE |
- | share_type | user |
+ | share_with | user1 |
+ | share_with_displayname | User One |
+ | file_target | /welcome.txt |
+ | path | /welcome.txt |
+ | permissions | share,read,update |
+ | uid_owner | user0 |
+ | displayname_owner | User Zero |
+ | item_type | file |
+ | mimetype | text/plain |
+ | storage_id | ANY_VALUE |
+ | share_type | user |
Examples:
| ocs_api_version | ocs_status_code |
| 1 | 100 |
@@ -292,7 +292,7 @@ Feature: sharing
And the administrator has enabled DAV tech_preview
And user "user0" has uploaded file with content "user0 file" to "/PARENT/randomfile.txt"
When user "user0" creates a public link share using the sharing API with settings
- | path | PARENT |
+ | path | PARENT |
Then the OCS status code should be ""
And the HTTP status code should be "200"
And the fields of the last response should include
@@ -357,8 +357,8 @@ Feature: sharing
Scenario Outline: Getting the share information of public link share from the OCS API does not expose sensitive information
Given using OCS API version ""
When user "user0" creates a public link share using the sharing API with settings
- | path | welcome.txt |
- | password | %public% |
+ | path | welcome.txt |
+ | password | %public% |
Then the OCS status code should be ""
And the HTTP status code should be "200"
And the fields of the last response should include
@@ -379,16 +379,16 @@ Feature: sharing
Scenario Outline: Getting the share information of passwordless public-links hides credential placeholders
Given using OCS API version ""
When user "user0" creates a public link share using the sharing API with settings
- | path | welcome.txt |
+ | path | welcome.txt |
Then the OCS status code should be ""
And the HTTP status code should be "200"
And the fields of the last response should include
- | file_target | /welcome.txt |
- | path | /welcome.txt |
- | item_type | file |
- | share_type | public_link |
- | permissions | read |
- | uid_owner | user0 |
+ | file_target | /welcome.txt |
+ | path | /welcome.txt |
+ | item_type | file |
+ | share_type | public_link |
+ | permissions | read |
+ | uid_owner | user0 |
And the fields of the last response should not include
| share_with | ANY_VALUE |
| share_with_displayname | ANY_VALUE |
@@ -469,8 +469,8 @@ Feature: sharing
And parameter "shareapi_allow_public_upload" of app "core" has been set to "no"
And user "user0" has created folder "/afolder"
When user "user0" creates a public link share using the sharing API with settings
- | path | /afolder |
- | permissions | create |
+ | path | /afolder |
+ | permissions | create |
# And the fields of the last response should include
# | id | A_NUMBER |
# | share_type | public_link |
@@ -533,18 +533,18 @@ Feature: sharing
# And the public upload to the last publicly shared folder using the old public WebDAV API should fail with HTTP status code "403"
# And the public upload to the last publicly shared folder using the new public WebDAV API should fail with HTTP status code "403"
Examples:
- | ocs_api_version | ocs_status_code | http_status_code | permission |
- | 1 | 403 | 200 | create |
+ | ocs_api_version | ocs_status_code | http_status_code | permission |
+ | 1 | 403 | 200 | create |
#| 1 | 100 | 200 | create |
- | 2 | 403 | 403 | create |
+ | 2 | 403 | 403 | create |
#| 2 | 200 | 200 | create |
- | 1 | 403 | 200 | create,read,update |
+ | 1 | 403 | 200 | create,read,update |
#| 1 | 100 | 200 | create,read,update |
- | 2 | 403 | 403 | create,read,update |
+ | 2 | 403 | 403 | create,read,update |
#| 2 | 200 | 200 | create,read,update |
- | 1 | 403 | 200 | read,create,update,delete |
+ | 1 | 403 | 200 | read,create,update,delete |
#| 1 | 100 | 200 | read,create,update,delete |
- | 2 | 403 | 403 | read,create,update,delete |
+ | 2 | 403 | 403 | read,create,update,delete |
#| 2 | 200 | 200 | read,create,update,delete |
@public_link_share-feature-required
@@ -1139,11 +1139,11 @@ Feature: sharing
When user "user3" shares file "randomfile.txt" with user "user1" with permissions "read,update" using the sharing API
And user "user1" gets the info of the last share using the sharing API
Then the fields of the last response should include
- | uid_owner | user3 |
- | share_with | user1 |
- | file_target | /randomfile (2).txt|
- | item_type | file |
- | permissions | read,update |
+ | uid_owner | user3 |
+ | share_with | user1 |
+ | file_target | /randomfile (2).txt |
+ | item_type | file |
+ | permissions | read,update |
And the content of file "randomfile.txt" for user "user1" should be "user2 file"
And the content of file "randomfile (2).txt" for user "user1" should be "user3 file"
Examples:
@@ -1258,13 +1258,13 @@ Feature: sharing
And the HTTP status code should be "200"
And the content of file "textfile3.txt" for user "user3" should be "ownCloud test text file 3" plus end-of-line
Examples:
- | ocs_api_version | group_id1 | group_id2 | group_id3 | ocs_status_code |
- | 1 | case-sensitive-group | Case-Sensitive-Group | CASE-SENSITIVE-GROUP | 100 |
- | 1 | Case-Sensitive-Group | CASE-SENSITIVE-GROUP | case-sensitive-group | 100 |
- | 1 | CASE-SENSITIVE-GROUP | case-sensitive-group | Case-Sensitive-Group | 100 |
- | 2 | case-sensitive-group | Case-Sensitive-Group | CASE-SENSITIVE-GROUP | 200 |
- | 2 | Case-Sensitive-Group | CASE-SENSITIVE-GROUP | case-sensitive-group | 200 |
- | 2 | CASE-SENSITIVE-GROUP | case-sensitive-group | Case-Sensitive-Group | 200 |
+ | ocs_api_version | group_id1 | group_id2 | group_id3 | ocs_status_code |
+ | 1 | case-sensitive-group | Case-Sensitive-Group | CASE-SENSITIVE-GROUP | 100 |
+ | 1 | Case-Sensitive-Group | CASE-SENSITIVE-GROUP | case-sensitive-group | 100 |
+ | 1 | CASE-SENSITIVE-GROUP | case-sensitive-group | Case-Sensitive-Group | 100 |
+ | 2 | case-sensitive-group | Case-Sensitive-Group | CASE-SENSITIVE-GROUP | 200 |
+ | 2 | Case-Sensitive-Group | CASE-SENSITIVE-GROUP | case-sensitive-group | 200 |
+ | 2 | CASE-SENSITIVE-GROUP | case-sensitive-group | Case-Sensitive-Group | 200 |
@skipOnLDAP @issue-ldap-250
Scenario Outline: group names are case-sensitive, sharing with non-existent groups with different upper and lower case names
@@ -1291,13 +1291,13 @@ Feature: sharing
Then the OCS status code should be "404"
And the HTTP status code should be ""
Examples:
- |ocs_api_version | group_id1 | group_id2 | group_id3 | ocs_status_code | http_status_code |
- | 1 | case-sensitive-group | Case-Sensitive-Group | CASE-SENSITIVE-GROUP | 100 | 200 |
- | 1 | Case-Sensitive-Group | CASE-SENSITIVE-GROUP | case-sensitive-group | 100 | 200 |
- | 1 | CASE-SENSITIVE-GROUP | case-sensitive-group | Case-Sensitive-Group | 100 | 200 |
- | 2 | case-sensitive-group | Case-Sensitive-Group | CASE-SENSITIVE-GROUP | 200 | 404 |
- | 2 | Case-Sensitive-Group | CASE-SENSITIVE-GROUP | case-sensitive-group | 200 | 404 |
- | 2 | CASE-SENSITIVE-GROUP | case-sensitive-group | Case-Sensitive-Group | 200 | 404 |
+ | ocs_api_version | group_id1 | group_id2 | group_id3 | ocs_status_code | http_status_code |
+ | 1 | case-sensitive-group | Case-Sensitive-Group | CASE-SENSITIVE-GROUP | 100 | 200 |
+ | 1 | Case-Sensitive-Group | CASE-SENSITIVE-GROUP | case-sensitive-group | 100 | 200 |
+ | 1 | CASE-SENSITIVE-GROUP | case-sensitive-group | Case-Sensitive-Group | 100 | 200 |
+ | 2 | case-sensitive-group | Case-Sensitive-Group | CASE-SENSITIVE-GROUP | 200 | 404 |
+ | 2 | Case-Sensitive-Group | CASE-SENSITIVE-GROUP | case-sensitive-group | 200 | 404 |
+ | 2 | CASE-SENSITIVE-GROUP | case-sensitive-group | Case-Sensitive-Group | 200 | 404 |
@public_link_share-feature-required
Scenario Outline: Create a public link with default expiration date set and max expiration date enforced
@@ -1462,10 +1462,10 @@ Feature: sharing
Then the OCS status code should be ""
And the HTTP status code should be "200"
And the fields of the last response should include
- | share_with | grp1 |
- | file_target | /textfile0.txt |
- | path | /textfile0.txt |
- | uid_owner | user0 |
+ | share_with | grp1 |
+ | file_target | /textfile0.txt |
+ | path | /textfile0.txt |
+ | uid_owner | user0 |
And as "user1" file "/textfile0.txt" should exist
And as "user2" file "/textfile0.txt" should exist
When the administrator deletes group "grp1" using the provisioning API
@@ -1535,7 +1535,7 @@ Feature: sharing
Then the OCS status code should be "100"
And the HTTP status code should be "200"
And user "user1" should see the following elements
- | /randomfile.txt |
+ | /randomfile.txt |
And user "user2" should see the following elements
| /randomfile.txt |
And the content of file "randomfile.txt" for user "user1" should be "user0 file"
@@ -1619,3 +1619,664 @@ Feature: sharing
When the public downloads file "parent.txt" from inside the last public shared folder using the old public WebDAV API
Then the value of the item "//s:message" in the response should be ""
And the HTTP status code should be "404"
+
+ @skipOnOcV10.3
+ Scenario Outline: sharing with expiration date enabled but not enforced, user shares without specifying expireDate
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And user "user1" has been created with default attributes and without skeleton files
+ When user "user0" shares folder "/FOLDER" with user "user1" using the sharing API
+ Then the OCS status code should be ""
+ And the HTTP status code should be ""
+ And the fields of the last response should include
+ | expiration | |
+ Examples:
+ | ocs_api_version | ocs_status_code | http_status_code |
+ | 1 | 100 | 200 |
+ | 2 | 200 | 200 |
+
+ @skipOnOcV10.3
+ Scenario Outline: sharing with expiration date enabled but not enforced, user shares with expiration date
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And user "user1" has been created with default attributes and without skeleton files
+ When user "user0" creates a share using the sharing API with settings
+ | path | /FOLDER |
+ | shareType | user |
+ | shareWith | user1 |
+ | permissions | read,share |
+ | expireDate | +15 days |
+ Then the OCS status code should be ""
+ And the HTTP status code should be ""
+ And the fields of the last response should include
+ | share_type | user |
+ | file_target | /FOLDER |
+ | uid_owner | user0 |
+ | expiration | +15 days |
+ | share_with | user1 |
+ Examples:
+ | ocs_api_version | ocs_status_code | http_status_code |
+ | 1 | 100 | 200 |
+ | 2 | 200 | 200 |
+
+ @skipOnOcV10.3 @issue-36568
+ Scenario Outline: sharing with expiration date is not enabled, user shares with expiration date set
+ Given using OCS API version ""
+ And user "user1" has been created with default attributes and without skeleton files
+ When user "user0" creates a share using the sharing API with settings
+ | path | /FOLDER |
+ | shareType | user |
+ | shareWith | user1 |
+ | permissions | read,share |
+ | expireDate | +15 days |
+ Then the OCS status code should be ""
+ # And the HTTP status code should be "400"
+ And the HTTP status code should be ""
+ And the fields of the last response should include
+ | share_type | user |
+ | file_target | /FOLDER |
+ | uid_owner | user0 |
+ | share_with | user1 |
+ | expiration | +15 days |
+ Examples:
+ | ocs_api_version | ocs_status_code | http_status_code |
+ | 1 | 100 | 200 |
+ | 2 | 200 | 200 |
+
+ @skipOnOcV10.3
+ Scenario Outline: sharing with expiration date is enabled but not enforced, user shares with expiration date and then disables
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And user "user1" has been created with default attributes and without skeleton files
+ When user "user0" creates a share using the sharing API with settings
+ | path | /FOLDER |
+ | shareType | user |
+ | shareWith | user1 |
+ | permissions | read,share |
+ | expireDate | +15 days |
+ And the administrator sets parameter "shareapi_default_expire_date_user_share" of app "core" to "no"
+ And user "user0" gets the info of the last share using the sharing API
+ Then the fields of the last response should include
+ | share_type | user |
+ | file_target | /FOLDER |
+ | uid_owner | user0 |
+ | share_with | user1 |
+ | expiration | +15 days |
+ Examples:
+ | ocs_api_version |
+ | 1 |
+ | 2 |
+
+ @skipOnOcV10.3
+ Scenario Outline: sharing with expiration date is enabled and enforced, user shares with expiration date and then disables
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to "yes"
+ And user "user1" has been created with default attributes and without skeleton files
+ When user "user0" creates a share using the sharing API with settings
+ | path | /FOLDER |
+ | shareType | user |
+ | shareWith | user1 |
+ | permissions | read,share |
+ And the administrator sets parameter "shareapi_default_expire_date_user_share" of app "core" to "no"
+ And user "user0" gets the info of the last share using the sharing API
+ Then the fields of the last response should include
+ | share_type | user |
+ | file_target | /FOLDER |
+ | uid_owner | user0 |
+ | share_with | user1 |
+ | expiration | +7 days |
+ Examples:
+ | ocs_api_version |
+ | 1 |
+ | 2 |
+
+ @skipOnOcV10.3
+ Scenario Outline: sharing with expiration date enabled but not enforced for groups, user shares without specifying expireDate
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "yes"
+ And user "user1" has been created with default attributes and without skeleton files
+ And group "grp1" has been created
+ And user "user1" has been added to group "grp1"
+ When user "user0" shares folder "/FOLDER" with group "grp1" using the sharing API
+ Then the OCS status code should be ""
+ And the HTTP status code should be ""
+ And the fields of the last response should include
+ | expiration | |
+ Examples:
+ | ocs_api_version | ocs_status_code | http_status_code |
+ | 1 | 100 | 200 |
+ | 2 | 200 | 200 |
+
+ @skipOnOcV10.3
+ Scenario Outline: sharing with expiration date enabled but not enforced for groups, user shares with expiration date
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "yes"
+ And user "user1" has been created with default attributes and without skeleton files
+ And group "grp1" has been created
+ And user "user1" has been added to group "grp1"
+ When user "user0" creates a share using the sharing API with settings
+ | path | /FOLDER |
+ | shareType | group |
+ | shareWith | grp1 |
+ | permissions | read,share |
+ | expireDate | +15 days |
+ Then the OCS status code should be ""
+ And the HTTP status code should be ""
+ And the fields of the last response should include
+ | share_type | group |
+ | file_target | /FOLDER |
+ | uid_owner | user0 |
+ | expiration | +15 days |
+ | share_with | grp1 |
+ Examples:
+ | ocs_api_version | ocs_status_code | http_status_code |
+ | 1 | 100 | 200 |
+ | 2 | 200 | 200 |
+
+ @skipOnOcV10.3 @issue-36568
+ Scenario Outline: sharing with expiration date is not enabled for groups, user shares with expiration date set
+ Given using OCS API version ""
+ And user "user1" has been created with default attributes and without skeleton files
+ And group "grp1" has been created
+ And user "user1" has been added to group "grp1"
+ When user "user0" creates a share using the sharing API with settings
+ | path | /FOLDER |
+ | shareType | group |
+ | shareWith | grp1 |
+ | permissions | read,share |
+ | expireDate | +15 days |
+ Then the OCS status code should be ""
+ # And the HTTP status code should be "400"
+ And the HTTP status code should be ""
+ And the fields of the last response should include
+ | share_type | group |
+ | file_target | /FOLDER |
+ | uid_owner | user0 |
+ | expiration | +15 days |
+ | share_with | grp1 |
+ Examples:
+ | ocs_api_version | ocs_status_code | http_status_code |
+ | 1 | 100 | 200 |
+ | 2 | 200 | 200 |
+
+ @skipOnOcV10.3
+ Scenario Outline: sharing with expiration date is enabled but not enforced for groups, user shares with expiration date and then disables
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "yes"
+ And user "user1" has been created with default attributes and without skeleton files
+ And group "grp1" has been created
+ And user "user1" has been added to group "grp1"
+ When user "user0" creates a share using the sharing API with settings
+ | path | /FOLDER |
+ | shareType | group |
+ | shareWith | grp1 |
+ | permissions | read,share |
+ | expireDate | +15 days |
+ And the administrator sets parameter "shareapi_default_expire_date_group_share" of app "core" to "no"
+ And user "user0" gets the info of the last share using the sharing API
+ Then the fields of the last response should include
+ | share_type | group |
+ | file_target | /FOLDER |
+ | uid_owner | user0 |
+ | share_with | grp1 |
+ | expiration | +15 days |
+ Examples:
+ | ocs_api_version |
+ | 1 |
+ | 2 |
+
+ @skipOnOcV10.3
+ Scenario Outline: sharing with expiration date is enabled and enforced for groups, user shares with expiration date and then disables
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_group_share" of app "core" has been set to "yes"
+ And user "user1" has been created with default attributes and without skeleton files
+ And group "grp1" has been created
+ And user "user1" has been added to group "grp1"
+ When user "user0" creates a share using the sharing API with settings
+ | path | /FOLDER |
+ | shareType | group |
+ | shareWith | grp1 |
+ | permissions | read,share |
+ | expireDate | +3 days |
+ And the administrator sets parameter "shareapi_default_expire_date_group_share" of app "core" to "no"
+ And user "user0" gets the info of the last share using the sharing API
+ Then the fields of the last response should include
+ | share_type | group |
+ | file_target | /FOLDER |
+ | uid_owner | user0 |
+ | share_with | grp1 |
+ | expiration | +3 days |
+ Examples:
+ | ocs_api_version |
+ | 1 |
+ | 2 |
+
+ @skipOnOcV10.3
+ Scenario Outline: sharing with expiration date is enabled and enforced for users, user shares without setting expiration date
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to "yes"
+ And user "user1" has been created with default attributes and without skeleton files
+ When user "user0" shares file "textfile0.txt" with user "user1" using the sharing API
+ Then the fields of the last response should include
+ | share_type | user |
+ | file_target | /textfile0.txt |
+ | uid_owner | user0 |
+ | share_with | user1 |
+ | expiration | +7 days |
+ Examples:
+ | ocs_api_version |
+ | 1 |
+ | 2 |
+
+ @skipOnOcV10.3
+ Scenario Outline: sharing with expiration date is enabled and enforced for users, user shares with expiration date more than the default
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to "yes"
+ And user "user1" has been created with default attributes and without skeleton files
+ When user "user0" creates a share using the sharing API with settings
+ | path | textfile0.txt |
+ | shareType | user |
+ | shareWith | user1 |
+ | permissions | read,share |
+ | expireDate | +10 days |
+ Then the HTTP status code should be ""
+ And the OCS status code should be "404"
+ And the OCS status message should be "Cannot set expiration date more than 7 days in the future"
+ Examples:
+ | ocs_api_version | http_status_code |
+ | 1 | 200 |
+ | 2 | 404 |
+
+ @skipOnOcV10.3
+ Scenario Outline: sharing with expiration date is enabled and enforced/max expire date is set, user shares without setting expiration date
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_expire_after_n_days_user_share" of app "core" has been set to "30"
+ And user "user1" has been created with default attributes and without skeleton files
+ When user "user0" shares file "textfile0.txt" with user "user1" using the sharing API
+ Then the fields of the last response should include
+ | share_type | user |
+ | file_target | /textfile0.txt |
+ | uid_owner | user0 |
+ | share_with | user1 |
+ | expiration | +30 days |
+ Examples:
+ | ocs_api_version |
+ | 1 |
+ | 2 |
+
+ @skipOnOcV10.3
+ Scenario Outline: sharing with expiration date is enabled and enforced for users/max expire date set, user shares with expiration date more than the max expire date
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_expire_after_n_days_user_share" of app "core" has been set to "30"
+ And user "user1" has been created with default attributes and without skeleton files
+ When user "user0" creates a share using the sharing API with settings
+ | path | textfile0.txt |
+ | shareType | user |
+ | shareWith | user1 |
+ | permissions | read,share |
+ | expireDate | +40 days |
+ Then the HTTP status code should be ""
+ And the OCS status code should be "404"
+ And the OCS status message should be "Cannot set expiration date more than 30 days in the future"
+ Examples:
+ | ocs_api_version | http_status_code |
+ | 1 | 200 |
+ | 2 | 404 |
+
+ @skipOnOcV10.3
+ Scenario Outline: sharing with expiration date is enabled/max expire date is set, user shares and changes the max expire date greater than the previous one
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_expire_after_n_days_user_share" of app "core" has been set to "30"
+ And user "user1" has been created with default attributes and without skeleton files
+ When user "user0" shares file "textfile0.txt" with user "user1" with permissions "read,share" using the sharing API
+ And the administrator sets parameter "shareapi_expire_after_n_days_user_share" of app "core" to "40"
+ And user "user0" gets the info of the last share using the sharing API
+ Then the fields of the last response should include
+ | expiration | +30 days |
+ Examples:
+ | ocs_api_version |
+ | 1 |
+ | 2 |
+
+ @skipOnOcV10.3
+ Scenario Outline: sharing with expiration date is enabled/max expire date is set, user shares and changes max expire date less than the previous one
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_expire_after_n_days_user_share" of app "core" has been set to "30"
+ And user "user1" has been created with default attributes and without skeleton files
+ When user "user0" shares file "textfile0.txt" with user "user1" with permissions "read,share" using the sharing API
+ And the administrator sets parameter "shareapi_expire_after_n_days_user_share" of app "core" to "15"
+ And user "user0" gets the info of the last share using the sharing API
+ Then the fields of the last response should include
+ | expiration | +30 days |
+ Examples:
+ | ocs_api_version |
+ | 1 |
+ | 2 |
+
+ @skipOnOcV10.3
+ Scenario Outline: sharing with expiration date is enabled and enforced for groups, user shares without setting expiration date
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_group_share" of app "core" has been set to "yes"
+ And user "user1" has been created with default attributes and without skeleton files
+ And group "grp1" has been created
+ And user "user1" has been added to group "grp1"
+ When user "user0" shares file "textfile0.txt" with group "grp1" using the sharing API
+ Then the fields of the last response should include
+ | share_type | group |
+ | file_target | /textfile0.txt |
+ | uid_owner | user0 |
+ | share_with | grp1 |
+ | expiration | +7 days |
+ Examples:
+ | ocs_api_version |
+ | 1 |
+ | 2 |
+
+ @skipOnOcV10.3
+ Scenario Outline: sharing with expiration date is enabled and enforced for groups, user shares with expiration date more than the default
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_group_share" of app "core" has been set to "yes"
+ And user "user1" has been created with default attributes and without skeleton files
+ And group "grp1" has been created
+ And user "user1" has been added to group "grp1"
+ When user "user0" creates a share using the sharing API with settings
+ | path | textfile0.txt |
+ | shareType | group |
+ | shareWith | grp1 |
+ | permissions | read,share |
+ | expireDate | +10 days |
+ Then the HTTP status code should be ""
+ And the OCS status code should be "404"
+ And the OCS status message should be "Cannot set expiration date more than 7 days in the future"
+ Examples:
+ | ocs_api_version | http_status_code |
+ | 1 | 200 |
+ | 2 | 404 |
+
+ @skipOnOcV10.3
+ Scenario Outline: sharing with expiration date is enabled and enforced/max expire date is set for groups, user shares without setting expiration date
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_expire_after_n_days_group_share" of app "core" has been set to "30"
+ And user "user1" has been created with default attributes and without skeleton files
+ And group "grp1" has been created
+ And user "user1" has been added to group "grp1"
+ When user "user0" shares file "textfile0.txt" with group "grp1" using the sharing API
+ Then the fields of the last response should include
+ | share_type | group |
+ | file_target | /textfile0.txt |
+ | uid_owner | user0 |
+ | share_with | grp1 |
+ | expiration | +30 days |
+ Examples:
+ | ocs_api_version |
+ | 1 |
+ | 2 |
+
+ @skipOnOcV10.3
+ Scenario Outline: sharing with expiration date is enabled and enforced for users/max expire date set for groups, user shares with expiration date more than the max expire date
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_expire_after_n_days_group_share" of app "core" has been set to "30"
+ And user "user1" has been created with default attributes and without skeleton files
+ And group "grp1" has been created
+ And user "user1" has been added to group "grp1"
+ When user "user0" creates a share using the sharing API with settings
+ | path | textfile0.txt |
+ | shareType | group |
+ | shareWith | grp1 |
+ | permissions | read,share |
+ | expireDate | +40 days |
+ Then the HTTP status code should be ""
+ And the OCS status code should be "404"
+ And the OCS status message should be "Cannot set expiration date more than 30 days in the future"
+ Examples:
+ | ocs_api_version | http_status_code |
+ | 1 | 200 |
+ | 2 | 404 |
+
+ @skipOnOcV10.3
+ Scenario Outline: sharing with expiration date is enabled/max expire date is set for groups, user shares and changes the max expire date greater than the previous one
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_expire_after_n_days_group_share" of app "core" has been set to "30"
+ And user "user1" has been created with default attributes and without skeleton files
+ And group "grp1" has been created
+ And user "user1" has been added to group "grp1"
+ When user "user0" shares file "textfile0.txt" with group "grp1" with permissions "read,share" using the sharing API
+ And the administrator sets parameter "shareapi_expire_after_n_days_group_share" of app "core" to "40"
+ And user "user0" gets the info of the last share using the sharing API
+ Then the fields of the last response should include
+ | expiration | +30 days |
+ Examples:
+ | ocs_api_version |
+ | 1 |
+ | 2 |
+
+ @skipOnOcV10.3
+ Scenario Outline: sharing with expiration date is enabled/max expire date is set for groups, user shares and changes max expire date less than the previous one
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_expire_after_n_days_group_share" of app "core" has been set to "30"
+ And user "user1" has been created with default attributes and without skeleton files
+ And group "grp1" has been created
+ And user "user1" has been added to group "grp1"
+ When user "user0" shares file "textfile0.txt" with group "grp1" with permissions "read,share" using the sharing API
+ And the administrator sets parameter "shareapi_expire_after_n_days_group_share" of app "core" to "15"
+ And user "user0" gets the info of the last share using the sharing API
+ Then the fields of the last response should include
+ | expiration | +30 days |
+ Examples:
+ | ocs_api_version |
+ | 1 |
+ | 2 |
+
+ @skipOnOcV10.3
+ Scenario Outline: sharing with expiration date enforced for users, user shares to the group
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to "yes"
+ And user "user1" has been created with default attributes and without skeleton files
+ And group "grp1" has been created
+ And user "user1" has been added to group "grp1"
+ When user "user0" shares file "FOLDER" with group "grp1" with permissions "read,share" using the sharing API
+ And user "user0" gets the info of the last share using the sharing API
+ Then the fields of the last response should include
+ | expiration | |
+ Examples:
+ | ocs_api_version |
+ | 1 |
+ | 2 |
+
+ @skipOnOcV10.3
+ Scenario Outline: sharing with expiration date enforced for groups, user shares to the user
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_group_share" of app "core" has been set to "yes"
+ And user "user1" has been created with default attributes and without skeleton files
+ When user "user0" shares file "/FOLDER" with user "user1" with permissions "read,share" using the sharing API
+ And user "user0" gets the info of the last share using the sharing API
+ Then the fields of the last response should include
+ | expiration | |
+ Examples:
+ | ocs_api_version |
+ | 1 |
+ | 2 |
+
+ @skipOnOcV10.3
+ Scenario Outline: sharing with expiration date enforced for users, user shares with invalid expiration date set
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to "yes"
+ And user "user1" has been created with default attributes and without skeleton files
+ When user "user0" creates a share using the sharing API with settings
+ | path | textfile0.txt |
+ | shareType | user |
+ | shareWith | user1 |
+ | permissions | read,share |
+ | expireDateAsString | INVALID-DATE |
+ Then the HTTP status code should be ""
+ And the OCS status code should be ""
+ And the OCS status message should be "Invalid date, date format must be YYYY-MM-DD"
+ Examples:
+ | ocs_api_version | ocs_status_code | http_status_code |
+ | 1 | 404 | 200 |
+ | 2 | 404 | 404 |
+
+ @skipOnOcV10.3
+ Scenario Outline: sharing with expiration date enforced for users, user shares with different time format
+ Given using OCS API version "2"
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And user "user1" has been created with default attributes and without skeleton files
+ When user "user0" creates a share using the sharing API with settings
+ | path | textfile0.txt |
+ | shareType | user |
+ | shareWith | user1 |
+ | permissions | read,share |
+ | expireDateAsString | |
+ Then the HTTP status code should be "200"
+ And the OCS status code should be "200"
+ Then the fields of the last response should include
+ | expiration | 2050-12-11 |
+ Examples:
+ | date |
+ | 2050-12-11 |
+ | 11-12-2050 |
+ | 12/11/2050 |
+ | 11.12.2050 |
+ | 11.12.2050 12:30:40 |
+
+ @skipOnOcV10.3
+ Scenario Outline: sharing with expiration date enforced for users, user shares with humanized expiration date format
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to "yes"
+ And user "user1" has been created with default attributes and without skeleton files
+ When user "user0" creates a share using the sharing API with settings
+ | path | textfile0.txt |
+ | shareType | user |
+ | shareWith | user1 |
+ | permissions | read,share |
+ | expireDateAsString | tomorrow |
+ Then the fields of the last response should include
+ | expiration | tomorrow |
+ Examples:
+ | ocs_api_version |
+ | 1 |
+ | 2 |
+
+ @skipOnOcV10.3
+ Scenario Outline: sharing with expiration date enforced for users, user shares with humanized expiration date format in past
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to "yes"
+ And user "user1" has been created with default attributes and without skeleton files
+ When user "user0" creates a share using the sharing API with settings
+ | path | textfile0.txt |
+ | shareType | user |
+ | shareWith | user1 |
+ | permissions | read,share |
+ | expireDateAsString | yesterday |
+ Then the HTTP status code should be ""
+ And the OCS status code should be ""
+ And the OCS status message should be "Expiration date is in the past"
+ Examples:
+ | ocs_api_version | ocs_status_code | http_status_code |
+ | 1 | 404 | 200 |
+ | 2 | 404 | 404 |
+
+ @skipOnOcV10.3
+ Scenario Outline: sharing with expiration date enforced for users, user shares with invalid humanized expiration date
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to "yes"
+ And user "user1" has been created with default attributes and without skeleton files
+ When user "user0" creates a share using the sharing API with settings
+ | path | textfile0.txt |
+ | shareType | user |
+ | shareWith | user1 |
+ | permissions | read,share |
+ | expireDateAsString | 123 |
+ Then the HTTP status code should be ""
+ And the OCS status code should be ""
+ And the OCS status message should be "Invalid date, date format must be YYYY-MM-DD"
+ Examples:
+ | ocs_api_version | ocs_status_code | http_status_code |
+ | 1 | 404 | 200 |
+ | 2 | 404 | 404 |
+
+ @skipOnOcV10.3
+ Scenario Outline: sharing with expiration date enforced for users, user shares with past expiration date set
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to "yes"
+ And user "user1" has been created with default attributes and without skeleton files
+ When user "user0" creates a share using the sharing API with settings
+ | path | textfile0.txt |
+ | shareType | user |
+ | shareWith | user1 |
+ | permissions | read,share |
+ | expireDateAsString | -10 days |
+ Then the HTTP status code should be ""
+ And the OCS status code should be ""
+ And the OCS status message should be "Expiration date is in the past"
+ Examples:
+ | ocs_api_version | ocs_status_code | http_status_code |
+ | 1 | 404 | 200 |
+ | 2 | 404 | 404 |
+
+ @skipOnOcV10.3 @issue-36569
+ Scenario Outline: sharing with expiration date set, max expire date is 0, user shares without specifying expiration date
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_expire_after_n_days_user_share" of app "core" has been set to "0"
+ And user "user1" has been created with default attributes and without skeleton files
+ When user "user0" creates a share using the sharing API with settings
+ | path | textfile0.txt |
+ | shareType | user |
+ | shareWith | user1 |
+ | permissions | read,share |
+ Then the fields of the last response should include
+ | expiration | today |
+ Examples:
+ | ocs_api_version |
+ | 1 |
+ | 2 |
+
+ @skipOnOcV10.3
+ Scenario Outline: sharing with expiration date set, max expire date is 1, user shares without specifying expiration date
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_expire_after_n_days_user_share" of app "core" has been set to "1"
+ And user "user1" has been created with default attributes and without skeleton files
+ When user "user0" creates a share using the sharing API with settings
+ | path | textfile0.txt |
+ | shareType | user |
+ | shareWith | user1 |
+ | permissions | read,share |
+ Then the fields of the last response should include
+ | expiration | tomorrow |
+ Examples:
+ | ocs_api_version |
+ | 1 |
+ | 2 |
diff --git a/tests/acceptance/features/apiShareReshare/reShare.feature b/tests/acceptance/features/apiShareReshare/reShare.feature
index 270bab82de51..925eaad1ecb9 100644
--- a/tests/acceptance/features/apiShareReshare/reShare.feature
+++ b/tests/acceptance/features/apiShareReshare/reShare.feature
@@ -530,3 +530,286 @@ Feature: sharing
| ocs_api_version | ocs_status_code | http_status_code |
| 1 | 403 | 200 |
| 2 | 403 | 403 |
+
+ @skipOnOcV10.3
+ Scenario Outline: User should be able to set expiration while resharing a file with user
+ Given using OCS API version ""
+ And user "user2" has been created with default attributes and without skeleton files
+ And user "user0" has shared file "/textfile0.txt" with user "user1" with permissions "read,update,share"
+ When user "user1" creates a share using the sharing API with settings
+ | path | textfile0.txt |
+ | shareType | user |
+ | permissions | change |
+ | shareWith | user2 |
+ | expireDate | +3 days |
+ Then the HTTP status code should be "200"
+ And the OCS status code should be ""
+ And the information of the last share of user "user1" should include
+ | expiration | +3 days |
+ Examples:
+ | ocs_api_version | ocs_status_code |
+ | 1 | 100 |
+ | 2 | 200 |
+
+ @skipOnOcV10.3
+ Scenario Outline: User should be able to set expiration while resharing a file with group
+ Given using OCS API version ""
+ And group "grp1" has been created
+ And user "user0" has shared file "/textfile0.txt" with user "user1" with permissions "read,update,share"
+ When user "user1" creates a share using the sharing API with settings
+ | path | textfile0.txt |
+ | shareType | group |
+ | permissions | change |
+ | shareWith | grp1 |
+ | expireDate | +3 days |
+ Then the HTTP status code should be "200"
+ And the OCS status code should be ""
+ And the information of the last share of user "user1" should include
+ | expiration | +3 days |
+ Examples:
+ | ocs_api_version | ocs_status_code |
+ | 1 | 100 |
+ | 2 | 200 |
+
+ @skipOnOcV10.3
+ Scenario Outline: Default expiration date for resharing with user using the sharing API with expire days set
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to ""
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to ""
+ And parameter "shareapi_expire_after_n_days_user_share" of app "core" has been set to "30"
+ And user "user2" has been created with default attributes and without skeleton files
+ And user "user0" has shared file "/textfile0.txt" with user "user1" with permissions "read,update,share"
+ When user "user1" creates a share using the sharing API with settings
+ | path | textfile0.txt |
+ | shareType | user |
+ | permissions | change |
+ | shareWith | user2 |
+ Then the HTTP status code should be "200"
+ And the OCS status code should be ""
+ And the information of the last share of user "user1" should include
+ | expiration | |
+ Examples:
+ | ocs_api_version | default-expire-date | enforce-expire-date | expected-expire-date | ocs_status_code |
+ | 1 | yes | yes | +30 days | 100 |
+ | 2 | yes | yes | +30 days | 200 |
+ | 1 | no | yes | | 100 |
+ | 2 | no | yes | | 200 |
+
+ @skipOnOcV10.3
+ Scenario Outline: Default expiration date for resharing with group using the sharing API with expire days set
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_group_share" of app "core" has been set to ""
+ And parameter "shareapi_enforce_expire_date_group_share" of app "core" has been set to ""
+ And parameter "shareapi_expire_after_n_days_group_share" of app "core" has been set to "30"
+ And group "grp1" has been created
+ And user "user1" has been added to group "grp1"
+ And user "user0" has shared file "/textfile0.txt" with user "user1" with permissions "read,update,share"
+ When user "user1" creates a share using the sharing API with settings
+ | path | textfile0.txt |
+ | shareType | group |
+ | permissions | change |
+ | shareWith | grp1 |
+ Then the HTTP status code should be "200"
+ And the OCS status code should be ""
+ And the information of the last share of user "user1" should include
+ | expiration | |
+ Examples:
+ | ocs_api_version | default-expire-date | enforce-expire-date | expected-expire-date | ocs_status_code |
+ | 1 | yes | yes | +30 days | 100 |
+ | 2 | yes | yes | +30 days | 200 |
+ | 1 | no | yes | | 100 |
+ | 2 | no | yes | | 200 |
+
+ @skipOnOcV10.3
+ Scenario Outline: Default expiration date for resharing with user using the sharing API without expire days set
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to ""
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to ""
+ And user "user2" has been created with default attributes and without skeleton files
+ And user "user0" has shared file "/textfile0.txt" with user "user1" with permissions "read,update,share"
+ When user "user1" creates a share using the sharing API with settings
+ | path | textfile0.txt |
+ | shareType | user |
+ | permissions | change |
+ | shareWith | user2 |
+ Then the HTTP status code should be "200"
+ And the OCS status code should be ""
+ And the information of the last share of user "user1" should include
+ | expiration | |
+ Examples:
+ | ocs_api_version | default-expire-date | enforce-expire-date | expected-expire-date | ocs_status_code |
+ | 1 | yes | yes | +7 days | 100 |
+ | 2 | yes | yes | +7 days | 200 |
+ | 1 | no | yes | | 100 |
+ | 2 | no | yes | | 200 |
+
+ @skipOnOcV10.3
+ Scenario Outline: Default expiration date for resharing with group using the sharing API without expire days set
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_group_share" of app "core" has been set to ""
+ And parameter "shareapi_enforce_expire_date_group_share" of app "core" has been set to ""
+ And group "grp2" has been created
+ And user "user0" has shared file "/textfile0.txt" with user "user1" with permissions "read,update,share"
+ When user "user1" creates a share using the sharing API with settings
+ | path | textfile0.txt |
+ | shareType | group |
+ | permissions | change |
+ | shareWith | grp2 |
+ Then the HTTP status code should be "200"
+ And the OCS status code should be ""
+ And the information of the last share of user "user1" should include
+ | expiration | |
+ Examples:
+ | ocs_api_version | default-expire-date | enforce-expire-date | expected-expire-date | ocs_status_code |
+ | 1 | yes | yes | +7 days | 100 |
+ | 2 | yes | yes | +7 days | 200 |
+ | 1 | no | yes | | 100 |
+ | 2 | no | yes | | 200 |
+
+ @skipOnOcV10.3
+ Scenario Outline: Default expiration date for resharing with user using the sharing API with expire days set and specify expire date in share
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to ""
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to ""
+ And parameter "shareapi_expire_after_n_days_user_share" of app "core" has been set to "30"
+ And user "user2" has been created with default attributes and without skeleton files
+ And user "user0" has shared file "/textfile0.txt" with user "user1" with permissions "read,update,share"
+ When user "user1" creates a share using the sharing API with settings
+ | path | textfile0.txt |
+ | shareType | user |
+ | permissions | change |
+ | shareWith | user2 |
+ | expireDate | +20 days |
+ Then the HTTP status code should be "200"
+ And the OCS status code should be ""
+ And the information of the last share of user "user1" should include
+ | expiration | +20 days |
+ Examples:
+ | ocs_api_version | default-expire-date | enforce-expire-date | ocs_status_code |
+ | 1 | yes | yes | 100 |
+ | 2 | yes | yes | 200 |
+ | 1 | no | yes | 100 |
+ | 2 | no | yes | 200 |
+
+ @skipOnOcV10.3
+ Scenario Outline: Default expiration date for resharing with group using the sharing API with expire days set and specify expire date in share
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_group_share" of app "core" has been set to ""
+ And parameter "shareapi_enforce_expire_date_group_share" of app "core" has been set to ""
+ And parameter "shareapi_expire_after_n_days_group_share" of app "core" has been set to "30"
+ And group "group2" has been created
+ And user "user0" has shared file "/textfile0.txt" with user "user1" with permissions "read,update,share"
+ When user "user1" creates a share using the sharing API with settings
+ | path | textfile0.txt |
+ | shareType | group |
+ | permissions | change |
+ | shareWith | group2 |
+ | expireDate | +20 days |
+ Then the HTTP status code should be "200"
+ And the OCS status code should be ""
+ And the information of the last share of user "user1" should include
+ | expiration | +20 days |
+ Examples:
+ | ocs_api_version | default-expire-date | enforce-expire-date | ocs_status_code |
+ | 1 | yes | yes | 100 |
+ | 2 | yes | yes | 200 |
+ | 1 | no | yes | 100 |
+ | 2 | no | yes | 200 |
+
+ @skipOnOcV10.3
+ Scenario Outline: Setting default expiry date and enforcement after the share is created
+ Given using OCS API version ""
+ And user "user2" has been created with default attributes and without skeleton files
+ And user "user0" has shared file "/textfile0.txt" with user "user1" with permissions "read,update,share"
+ And user "user1" has shared file "/textfile0.txt" with user "user2"
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to ""
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to ""
+ And parameter "shareapi_expire_after_n_days_group_share" of app "core" has been set to "4"
+ When user "user1" gets the info of the last share using the sharing API
+ Then the HTTP status code should be "200"
+ And the OCS status code should be ""
+ And the information of the last share of user "user1" should include
+ | expiration | |
+ Examples:
+ | ocs_api_version | default-expire-date | enforce-expire-date | ocs_status_code |
+ | 1 | yes | yes | 100 |
+ | 2 | yes | yes | 200 |
+ | 1 | no | yes | 100 |
+ | 2 | no | yes | 200 |
+
+ @skipOnOcV10.3
+ Scenario Outline: Default expiration date for resharing group share with user using the sharing API with default expire date set
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to ""
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to ""
+ And parameter "shareapi_expire_after_n_days_user_share" of app "core" has been set to "30"
+ And group "grp1" has been created
+ And user "user2" has been created with default attributes and without skeleton files
+ And user "user1" has been added to group "grp1"
+ And user "user0" has shared file "/textfile0.txt" with group "grp1" with permissions "read,update,share"
+ When user "user1" creates a share using the sharing API with settings
+ | path | textfile0.txt |
+ | shareType | user |
+ | permissions | change |
+ | shareWith | user2 |
+ Then the HTTP status code should be "200"
+ And the OCS status code should be ""
+ And the information of the last share of user "user1" should include
+ | expiration | |
+ Examples:
+ | ocs_api_version | default-expire-date | enforce-expire-date | expected-expire-date | ocs_status_code |
+ | 1 | yes | yes | +30 days | 100 |
+ | 2 | yes | yes | +30 days | 200 |
+ | 1 | no | yes | | 100 |
+ | 2 | no | yes | | 200 |
+
+ @skipOnOcV10.3
+ Scenario Outline: Default expiration date for resharing group share with user using the sharing API with default expire date set and specifying expiration on share
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to ""
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to ""
+ And parameter "shareapi_expire_after_n_days_user_share" of app "core" has been set to "30"
+ And group "grp1" has been created
+ And user "user2" has been created with default attributes and without skeleton files
+ And user "user1" has been added to group "grp1"
+ And user "user0" has shared file "/textfile0.txt" with group "grp1" with permissions "read,update,share"
+ When user "user1" creates a share using the sharing API with settings
+ | path | textfile0.txt |
+ | shareType | user |
+ | permissions | change |
+ | shareWith | user2 |
+ | expireDate | +20 days |
+ Then the HTTP status code should be "200"
+ And the OCS status code should be ""
+ And the information of the last share of user "user1" should include
+ | expiration | |
+ Examples:
+ | ocs_api_version | default-expire-date | enforce-expire-date | expected-expire-date | ocs_status_code |
+ | 1 | yes | yes | +20 days | 100 |
+ | 2 | yes | yes | +20 days | 200 |
+ | 1 | no | yes | +20 days | 100 |
+ | 2 | no | yes | +20 days | 200 |
+
+ @skipOnOcV10.3
+ Scenario Outline: Default expiration date for resharing using the sharing API with default expire date set but not enforced
+ Given using OCS API version ""
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to ""
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to ""
+ And parameter "shareapi_expire_after_n_days_user_share" of app "core" has been set to "30"
+ And user "user2" has been created with default attributes and without skeleton files
+ And user "user0" has shared file "/textfile0.txt" with user "user1" with permissions "read,update,share"
+ When user "user1" creates a share using the sharing API with settings
+ | path | textfile0.txt |
+ | shareType | user |
+ | permissions | change |
+ | shareWith | user2 |
+ Then the HTTP status code should be "200"
+ And the OCS status code should be ""
+ And the information of the last share of user "user1" should include
+ | expiration | |
+ Examples:
+ | ocs_api_version | default-expire-date | enforce-expire-date | ocs_status_code |
+ | 1 | yes | no | 100 |
+ | 2 | yes | no | 200 |
+ | 1 | no | no | 100 |
+ | 2 | no | no | 200 |
diff --git a/tests/acceptance/features/apiShareUpdate/updateShare.feature b/tests/acceptance/features/apiShareUpdate/updateShare.feature
index 87f72637993c..9307a2dabe25 100644
--- a/tests/acceptance/features/apiShareUpdate/updateShare.feature
+++ b/tests/acceptance/features/apiShareUpdate/updateShare.feature
@@ -552,8 +552,6 @@ Feature: sharing
When user "user0" shares file "/welcome.txt" with group "grp1" using the sharing API
Then the OCS status code should be "404"
And the HTTP status code should be ""
- When user "user0" gets the info of the last share using the sharing API
- Then the last response should be empty
Examples:
| ocs_api_version | http_status_code |
| 1 | 200 |
diff --git a/tests/acceptance/features/bootstrap/Sharing.php b/tests/acceptance/features/bootstrap/Sharing.php
index 8a6cfb1e4e08..ab08f72f7251 100644
--- a/tests/acceptance/features/bootstrap/Sharing.php
+++ b/tests/acceptance/features/bootstrap/Sharing.php
@@ -187,7 +187,6 @@ private function waitToCreateShare() {
public function userCreatesAShareWithSettings($user, $body) {
if ($body instanceof TableNode) {
$fd = $body->getRowsHash();
- $fd['expireDate'] = \array_key_exists('expireDate', $fd) ? $fd['expireDate'] : null;
$fd['name'] = \array_key_exists('name', $fd) ? $fd['name'] : null;
$fd['shareWith'] = \array_key_exists('shareWith', $fd) ? $fd['shareWith'] : null;
$fd['publicUpload'] = \array_key_exists('publicUpload', $fd) ? $fd['publicUpload'] === 'true' : null;
@@ -209,8 +208,15 @@ public function userCreatesAShareWithSettings($user, $body) {
} else {
$fd['shareType'] = null;
}
- }
+ Assert::assertFalse(
+ isset($fd['expireDate'], $fd['expireDateAsString']),
+ 'expireDate and expireDateAsString cannot be set at the same time.'
+ );
+ $needToParse = \array_key_exists('expireDate', $fd);
+ $expireDate = $fd['expireDate'] ?? $fd['expireDateAsString'] ?? null;
+ $fd['expireDate'] = $needToParse ? \date('Y-m-d', \strtotime($expireDate)) : $expireDate;
+ }
$this->createShare(
$user,
$fd['path'],
@@ -658,14 +664,15 @@ public function isFieldInResponse($field, $contentExpected, $expectSuccess = tru
}
//do not try to convert empty date
if ((string) $field === 'expiration' && !empty($contentExpected)) {
- $contentExpected
- = \date(
- 'Y-m-d',
- \strtotime(
- $contentExpected,
- $this->getServerShareTimeFromLastResponse()
- )
- ) . " 00:00:00";
+ $timestamp = \strtotime($contentExpected, $this->getServerShareTimeFromLastResponse());
+ // strtotime returns false if it failed to parse, just leave it as it is in that condition
+ if ($timestamp !== false) {
+ $contentExpected
+ = \date(
+ 'Y-m-d',
+ $timestamp
+ ) . " 00:00:00";
+ }
}
$contentExpected = (string) $contentExpected;
@@ -1199,7 +1206,7 @@ public function userGetsInfoOfLastShareUsingTheSharingApi($user) {
* @throws Exception
*/
public function getLastShareIdOf($user) {
- if ($this->lastShareData !== null) {
+ if (isset($this->lastShareData->data[0]->id)) {
return (int)$this->lastShareData->data[0]->id;
}
@@ -1391,6 +1398,32 @@ public function theResponseWhenUserGetsInfoOfLastShareShouldInclude(
$this->checkFields($body);
}
+ /**
+ * @Then the information of the last share of user :user should include
+ *
+ * @param string $user
+ * @param TableNode|null $body
+ *
+ * @throws \Exception
+ *
+ * @return void
+ */
+ public function informationOfLastShareShouldInclude(
+ $user, $body
+ ) {
+ $this->getListOfShares($user);
+ $share_id = $this->extractLastSharedIdFromLastResponse();
+ if ($share_id === null) {
+ throw new Exception("Could not find id in the last response.");
+ }
+ $this->getShareData($user, $share_id);
+ $this->theHTTPStatusCodeShouldBe(
+ 200,
+ "Error getting info of last share for user $user"
+ );
+ $this->checkFields($body);
+ }
+
/**
* @Then /^the last share_id should be included in the response/
*
@@ -1453,7 +1486,6 @@ public function checkingTheResponseEntriesCount($count) {
public function checkFields($body) {
if ($body instanceof TableNode) {
$fd = $body->getRowsHash();
-
foreach ($fd as $field => $value) {
$value = $this->replaceValuesFromTable($field, $value);
Assert::assertTrue(
@@ -2159,6 +2191,34 @@ protected function getCommonSharingConfigs() {
'testingParameter' => 'shareapi_enforce_expire_date',
'testingState' => false
],
+ [
+ 'capabilitiesApp' => 'files_sharing',
+ 'capabilitiesParameter' => 'user@@@expire_date@@@enabled',
+ 'testingApp' => 'core',
+ 'testingParameter' => 'shareapi_default_expire_date_user_share',
+ 'testingState' => false
+ ],
+ [
+ 'capabilitiesApp' => 'files_sharing',
+ 'capabilitiesParameter' => 'user@@@expire_date@@@enforced',
+ 'testingApp' => 'core',
+ 'testingParameter' => 'shareapi_enforce_expire_date_user_share',
+ 'testingState' => false
+ ],
+ [
+ 'capabilitiesApp' => 'files_sharing',
+ 'capabilitiesParameter' => 'group@@@expire_date@@@enabled',
+ 'testingApp' => 'core',
+ 'testingParameter' => 'shareapi_default_expire_date_group_share',
+ 'testingState' => false
+ ],
+ [
+ 'capabilitiesApp' => 'files_sharing',
+ 'capabilitiesParameter' => 'group@@@expire_date@@@enforced',
+ 'testingApp' => 'core',
+ 'testingParameter' => 'shareapi_enforce_expire_date_group_share',
+ 'testingState' => false
+ ],
[
'capabilitiesApp' => 'files_sharing',
'capabilitiesParameter' => 'federation@@@outgoing',
diff --git a/tests/acceptance/features/bootstrap/WebUIAdminSharingSettingsContext.php b/tests/acceptance/features/bootstrap/WebUIAdminSharingSettingsContext.php
index 7786bf2a2d41..e88c66d17e53 100644
--- a/tests/acceptance/features/bootstrap/WebUIAdminSharingSettingsContext.php
+++ b/tests/acceptance/features/bootstrap/WebUIAdminSharingSettingsContext.php
@@ -98,6 +98,81 @@ public function adminTogglesShareViaLink($action) {
);
}
+ /**
+ *
+ * @param NodeElement|null $checkbox
+ *
+ * @return void
+ */
+ private function assertCheckBoxIsChecked($checkbox) {
+ Assert::assertNotNull($checkbox, "checkbox does not exist");
+ Assert::assertTrue($checkbox->isChecked(), "checkbox is not checked");
+ }
+
+ /**
+ * @Then the default expiration date checkbox for user shares should be enabled on the webUI
+ *
+ * @return void
+ */
+ public function setDefaultExpirationDateForUserSharesCheckboxShouldBeEnabled() {
+ $checkboxElement = $this->adminSharingSettingsPage->getDefaultExpirationForUserShareElement();
+ $this->assertCheckBoxIsChecked($checkboxElement);
+ }
+
+ /**
+ * @Then the default expiration date checkbox for group shares should be enabled on the webUI
+ *
+ * @return void
+ */
+ public function setDefaultExpirationDateForGroupCheckboxSharesShouldBeEnabled() {
+ $checkboxElement = $this->adminSharingSettingsPage->getDefaultExpirationForGroupShareElement();
+ $this->assertCheckBoxIsChecked($checkboxElement);
+ }
+
+ /**
+ * @Then the enforce maximum expiration date checkbox for user shares should be enabled on the webUI
+ *
+ * @return void
+ */
+ public function enforceMaximumExpirationDateForUserSharesCheckboxShouldBeEnabled() {
+ $checkboxElement = $this->adminSharingSettingsPage->getEnforceExpireDateUserShareElement();
+ $this->assertCheckBoxIsChecked($checkboxElement);
+ }
+
+ /**
+ * @Then the enforce maximum expiration date checkbox for group shares should be enabled on the webUI
+ *
+ * @return void
+ */
+ public function enforceMaximumExpirationDateForGroupSharesCheckboxShouldBeEnabled() {
+ $checkboxElement = $this->adminSharingSettingsPage->getEnforceExpireDateGroupShareElement();
+ $this->assertCheckBoxIsChecked($checkboxElement);
+ }
+
+ /**
+ * @Then the expiration date for user shares should set to :days days on the webUI
+ *
+ * @param int $days
+ *
+ * @return void
+ */
+ public function expirationDateForUserSharesShouldBeSetToXDays($days) {
+ $expectedDays = $this->adminSharingSettingsPage->getUserShareExpirationDays();
+ Assert::assertEquals($days, $expectedDays);
+ }
+
+ /**
+ * @Then the expiration date for group shares should set to :days days on the webUI
+ *
+ * @param int $days
+ *
+ * @return void
+ */
+ public function expirationDateForGroupSharesShouldBeSetToXDays($days) {
+ $expectedDays = $this->adminSharingSettingsPage->getGroupShareExpirationDays();
+ Assert::assertEquals($days, $expectedDays);
+ }
+
/**
* @When /^the administrator (enables|disables) public uploads using the webUI$/
*
@@ -240,6 +315,72 @@ public function theAdministratorEnablesExcludeGroupsFromSharingUsingTheWebui() {
);
}
+ /**
+ * @When the administrator enables default expiration date for user shares using the webUI
+ *
+ * @return void
+ */
+ public function administratorEnablesDefaultExpirationDateForUserShares() {
+ $this->adminSharingSettingsPage->enableDefaultExpirationDateForUserShares(
+ $this->getSession()
+ );
+ }
+
+ /**
+ * @When the administrator enforces maximum expiration date for user shares using the webUI
+ *
+ * @return void
+ */
+ public function administratorEnforcesMaximumExpirationDateForUserShares() {
+ $this->adminSharingSettingsPage->enforceMaximumExpirationDateForUserShares(
+ $this->getSession()
+ );
+ }
+
+ /**
+ * @When the administrator enforces maximum expiration date for group shares using the webUI
+ *
+ * @return void
+ */
+ public function administratorEnforcesMaximumExpirationDateForGroupShares() {
+ $this->adminSharingSettingsPage->enforceMaximumExpirationDateForGroupShares(
+ $this->getSession()
+ );
+ }
+
+ /**
+ * @When the administrator updates the user share expiration date to :days days using the webUI
+ *
+ * @param int $days
+ *
+ * @return void
+ */
+ public function administratorUpdatesUserShareExpirationTo($days) {
+ $this->adminSharingSettingsPage->setExpirationDaysForUserShare($days, $this->getSession());
+ }
+
+ /**
+ * @When the administrator updates the group share expiration date to :days days using the webUI
+ *
+ * @param int $days
+ *
+ * @return void
+ */
+ public function administratorUpdatesGroupShareExpirationTo($days) {
+ $this->adminSharingSettingsPage->setExpirationDaysForGroupShare($days, $this->getSession());
+ }
+
+ /**
+ * @When the administrator enables default expiration date for group shares using the webUI
+ *
+ * @return void
+ */
+ public function theAdministratorEnablesDefaultExpirationDateForGroupShares() {
+ $this->adminSharingSettingsPage->enableDefaultExpirationDateForGroupShares(
+ $this->getSession()
+ );
+ }
+
/**
* @When the administrator enables restrict users to only share with groups they are member of using the webUI
*
diff --git a/tests/acceptance/features/bootstrap/WebUIGeneralContext.php b/tests/acceptance/features/bootstrap/WebUIGeneralContext.php
index bd2430d85aaf..fa93521c55e9 100644
--- a/tests/acceptance/features/bootstrap/WebUIGeneralContext.php
+++ b/tests/acceptance/features/bootstrap/WebUIGeneralContext.php
@@ -90,12 +90,12 @@ class WebUIGeneralContext extends RawMinkContext implements Context {
* @var string the original capabilities in XML format
*/
private $savedCapabilitiesXml;
-
+
/**
* @var array the changes made to capabilities for the test scenario
*/
private $savedCapabilitiesChanges = [];
-
+
/**
* table of capabilities to map the human readable terms from the settings page
* to terms in the capabilities XML and testing app
@@ -458,7 +458,7 @@ public function theUserShouldBeRedirectedToGeneralErrorPage($title) {
$title, $this->generalErrorPage->getPageTitle()
);
}
-
+
/**
* @Then an error should be displayed on the general error webUI page saying :error
*
@@ -553,7 +553,7 @@ public function settingInSectionHasBeen($setting, $section, $value) {
"$value can only be 'disabled' or 'enabled'"
);
}
-
+
$capability = $this->capabilities[\strtolower($section)][$setting];
$change = AppConfigHelper::setCapability(
$this->featureContext->getBaseUrl(),
@@ -664,7 +664,7 @@ public function setUpScenario(BeforeScenarioScope $scope) {
$this->featureContext->getBaseUrl(),
$this->featureContext->getOcPath()
);
-
+
$response = AppConfigHelper::getCapabilities(
$this->featureContext->getBaseUrl(),
$this->featureContext->getAdminUsername(),
@@ -797,7 +797,7 @@ function ($server) {
}
}
);
-
+
if ($this->oldCSRFSetting === "") {
$this->featureContext->deleteSystemConfig('csrf.disabled');
} elseif ($this->oldCSRFSetting !== null) {
@@ -805,7 +805,7 @@ function ($server) {
'csrf.disabled', $this->oldCSRFSetting, 'boolean'
);
}
-
+
foreach ($this->createdFiles as $file) {
\unlink($file);
}
diff --git a/tests/acceptance/features/bootstrap/WebUISharingContext.php b/tests/acceptance/features/bootstrap/WebUISharingContext.php
index 0c41c8fc16ec..f058635b4bcb 100644
--- a/tests/acceptance/features/bootstrap/WebUISharingContext.php
+++ b/tests/acceptance/features/bootstrap/WebUISharingContext.php
@@ -170,37 +170,132 @@ public function theUserSharesFileFolderWithUserUsingTheWebUI(
}
/**
- * @When the user shares file/folder :folder with group :group using the webUI
- * @Given the user has shared file/folder :folder with group :group using the webUI
+ * @When /^the user shares (?:file|folder) "([^"]*)" with (?:(remote|federated)\s)?user "([^"]*)" using the webUI without closing the share dialog$/
*
* @param string $folder
- * @param string $group
+ * @param string $remote (remote|federated|)
+ * @param string $name
* @param int $maxRetries
* @param bool $quiet
*
- * @return void
* @throws \Exception
+ *
+ * @return void
*/
- public function theUserSharesFileFolderWithGroupUsingTheWebUI(
- $folder, $group, $maxRetries = STANDARD_RETRY_COUNT, $quiet = false
+ public function theUserSharesWithUserWithoutClosingDialog(
+ $folder, $remote, $name, $maxRetries = STANDARD_RETRY_COUNT, $quiet = false
) {
- $this->theUserSharesFileFolderWithUserOrGroupUsingTheWebUI(
- $folder, "group", "", $group, $maxRetries, $quiet
- );
+ $this->theUserSharesUsingWebUIWithoutClosingDialog($folder, "user", $remote, $name, $maxRetries, $quiet);
}
/**
+ * @When /^the user shares (?:file|folder) "([^"]*)" with group "([^"]*)" using the webUI without closing the share dialog$/
+ *
* @param string $folder
- * @param string $userOrGroup
- * @param string $remote
* @param string $name
* @param int $maxRetries
* @param bool $quiet
*
+ * @throws \Exception
+ *
+ * @return void
+ *
+ */
+ public function theUserSharesWithGroupWithoutClosingDialog(
+ $folder, $name, $maxRetries = STANDARD_RETRY_COUNT, $quiet = false
+ ) {
+ $this->theUserSharesUsingWebUIWithoutClosingDialog($folder, "group", "", $name, $maxRetries, $quiet);
+ }
+
+ /**
+ * @Then /^the expiration date input field should (not |)be visible for the (user|group) "([^"]*)" in the share dialog$/
+ *
+ * @param string $shouldOrNot
+ * @param string $type
+ * @param string $receiver
+ *
+ * @return void
+ */
+ public function expirationFieldVisibleForUser($shouldOrNot, $type, $receiver) {
+ $expected = ($shouldOrNot === "");
+ $this->sharingDialog->openShareActionsDropDown();
+ Assert::assertEquals($this->sharingDialog->isExpirationFieldVisible($receiver, $type), $expected);
+ $this->sharingDialog->closeShareActionsDropDown();
+ }
+
+ /**
+ * @Then /^the expiration date input field should be empty for the (user|group) "([^"]*)" in the share dialog$/
+ *
+ * @param string $type
+ * @param string $receiver
+ *
+ * @return void
+ */
+ public function expirationFieldEmptyForUser($type, $receiver) {
+ Assert::assertEquals($this->sharingDialog->getExpirationDateFor($receiver, $type), "");
+ }
+
+ /**
+ * @When /^the user changes expiration date for share of (user|group) "([^"]*)" to "([^"]*)" in the share dialog$/
+ *
+ * @param string $type
+ * @param string $receiver
+ * @param string $days
+ *
+ * @return void
+ */
+ public function expirationDateChangedTo($type, $receiver, $days) {
+ $expectedDate = \date('d-m-Y', \strtotime($days));
+ $this->sharingDialog->openShareActionsDropDown();
+ $this->sharingDialog->setExpirationDateFor($this->getSession(), $receiver, $type, $expectedDate);
+ $this->sharingDialog->closeShareActionsDropDown();
+ }
+
+ /**
+ * @Then /^the expiration date input field should be "([^"]*)" for the (user|group) "([^"]*)" in the share dialog$/
+ *
+ * @param string $days
+ * @param string $type
+ * @param string $receiver
+ *
+ * @return void
+ * @throws Exception
+ */
+ public function expirationDateShouldBe($days, $type, $receiver) {
+ if (\strtotime($days) !== false) {
+ Assert::assertEquals(\date('d-m-Y', \strtotime($days)), $this->sharingDialog->getExpirationDateFor($receiver, $type));
+ } else {
+ throw new Exception("Invalid Format for the expiration date provided.");
+ }
+ }
+
+ /**
+ * @When /^the user clears the expiration date input field for share of (user|group) "([^"]*)" in the share dialog$/
+ *
+ * @param string $userOrGroup
+ * @param string $receiver
+ *
* @return void
+ */
+ public function clearExpirationDate($userOrGroup, $receiver) {
+ $this->sharingDialog->openShareActionsDropDown();
+ $this->sharingDialog->clearExpirationDateFor($this->getSession(), $receiver, $userOrGroup);
+ $this->sharingDialog->closeShareActionsDropDown();
+ }
+
+ /**
+ * @param string $folder
+ * @param string $userOrGroup (user|group)
+ * @param string $remote (remote|federated|)
+ * @param string $name
+ * @param int $maxRetries
+ * @param bool $quiet
+ *
* @throws \Exception
+ *
+ * @return void
*/
- public function theUserSharesFileFolderWithUserOrGroupUsingTheWebUI(
+ public function theUserSharesUsingWebUIWithoutClosingDialog(
$folder, $userOrGroup, $remote, $name, $maxRetries = STANDARD_RETRY_COUNT, $quiet = false
) {
$this->filesPage->waitTillPageIsloaded($this->getSession());
@@ -228,6 +323,45 @@ public function theUserSharesFileFolderWithUserOrGroupUsingTheWebUI(
$name, $this->getSession(), $maxRetries, $quiet
);
}
+ }
+
+ /**
+ * @When the user shares file/folder :folder with group :group using the webUI
+ * @Given the user has shared file/folder :folder with group :group using the webUI
+ *
+ * @param string $folder
+ * @param string $group
+ * @param int $maxRetries
+ * @param bool $quiet
+ *
+ * @return void
+ * @throws \Exception
+ */
+ public function theUserSharesFileFolderWithGroupUsingTheWebUI(
+ $folder, $group, $maxRetries = STANDARD_RETRY_COUNT, $quiet = false
+ ) {
+ $this->theUserSharesFileFolderWithUserOrGroupUsingTheWebUI(
+ $folder, "group", "", $group, $maxRetries, $quiet
+ );
+ }
+
+ /**
+ * @param string $folder
+ * @param string $userOrGroup
+ * @param string $remote
+ * @param string $name
+ * @param int $maxRetries
+ * @param bool $quiet
+ *
+ * @return void
+ * @throws \Exception
+ */
+ public function theUserSharesFileFolderWithUserOrGroupUsingTheWebUI(
+ $folder, $userOrGroup, $remote, $name, $maxRetries = STANDARD_RETRY_COUNT, $quiet = false
+ ) {
+ $this->theUserSharesUsingWebUIWithoutClosingDialog(
+ $folder, $userOrGroup, $remote, $name, $maxRetries, $quiet
+ );
$this->theUserClosesTheShareDialog();
}
@@ -1084,7 +1218,7 @@ public function theUsersOwnNameShouldNotBeListedInTheAutocompleteList() {
* @param string $username
*
* @return void
- * @throws Exception
+ * @throws \Exception
*/
public function userShouldBeListedInTheAutocompleteListOnTheWebui($username) {
$names = $this->sharingDialog->getAutocompleteItemsList();
@@ -1101,7 +1235,7 @@ public function userShouldBeListedInTheAutocompleteListOnTheWebui($username) {
* @param string $username
*
* @return void
- * @throws Exception
+ * @throws \Exception
*/
public function userShouldNotBeListedInTheAutocompleteListOnTheWebui($username) {
$names = $this->sharingDialog->getAutocompleteItemsList();
diff --git a/tests/acceptance/features/lib/AdminSharingSettingsPage.php b/tests/acceptance/features/lib/AdminSharingSettingsPage.php
index 8bd68cd72c9e..43f245b35a61 100644
--- a/tests/acceptance/features/lib/AdminSharingSettingsPage.php
+++ b/tests/acceptance/features/lib/AdminSharingSettingsPage.php
@@ -22,7 +22,9 @@
*/
namespace Page;
+use Behat\Mink\Element\NodeElement;
use Behat\Mink\Session;
+use function GuzzleHttp\Psr7\str;
/**
* Admin Sharing Settings page.
@@ -81,6 +83,17 @@ class AdminSharingSettingsPage extends SharingSettingsPage {
protected $changeSharePermissionXpath = "//p[@id='shareApiDefaultPermissionsSection']//label[contains(text(),'Change')]";
protected $deleteSharePermissionXpath = "//p[@id='shareApiDefaultPermissionsSection']//label[contains(text(),'Delete')]";
protected $shareSharePermissionXpath = "//p[@id='shareApiDefaultPermissionsSection']//label[contains(text(),'Share')]";
+
+ protected $defaultExpirationDateForUserCheckboxXpath = '//label[@for="shareapiDefaultExpireDateUserShare"]';
+ protected $defaultExpirationDateForUserCheckboxId = 'shareapiDefaultExpireDateUserShare';
+ protected $defaultExpirationDateForGroupCheckboxXpath = '//label[@for="shareapiDefaultExpireDateGroupShare"]';
+ protected $defaultExpirationDateForGroupCheckboxId = 'shareapiDefaultExpireDateGroupShare';
+ protected $userShareExpirationDateFieldXpath = '//input[@id="shareapiExpireAfterNDaysUserShare"]';
+ protected $groupShareExpirationDateFieldXpath = '//input[@id="shareapiExpireAfterNDaysGroupShare"]';
+ protected $enforceExpirationDateUserShareCheckboxXpath = '//span[@id="setDefaultExpireDateUserShare"]//label[contains(text(),"expiration date")]';
+ protected $enforceExpirationDateUserShareCheckboxId = 'shareapiEnforceExpireDateUserShare';
+ protected $enforceExpirationDateGroupShareCheckboxXpath = '//span[@id="setDefaultExpireDateGroupShare"]//label[contains(text(),"expiration date")]';
+ protected $enforceExpirationDateGroupShareCheckboxId = 'shareapiEnforceExpireDateGroupShare';
/**
* toggle the Share API
*
@@ -339,6 +352,186 @@ public function enableExcludeGroupFromSharing(Session $session) {
);
}
+ /**
+ * @return NodeElement|null
+ */
+ public function getDefaultExpirationForUserShareElement() {
+ return $this->findById($this->defaultExpirationDateForUserCheckboxId);
+ }
+
+ /**
+ * @return NodeElement|null
+ */
+ public function getDefaultExpirationForGroupShareElement() {
+ return $this->findById($this->defaultExpirationDateForGroupCheckboxId);
+ }
+
+ /**
+ * @return NodeElement|null
+ */
+ public function getEnforceExpireDateUserShareElement() {
+ return $this->findById($this->enforceExpirationDateUserShareCheckboxId);
+ }
+
+ /**
+ * @return NodeElement|null
+ */
+ public function getEnforceExpireDateGroupShareElement() {
+ return $this->findById($this->enforceExpirationDateGroupShareCheckboxId);
+ }
+
+ /**
+ * @return string
+ */
+ public function getUserShareExpirationDays() {
+ $expirationDay = $this->find("xpath", $this->userShareExpirationDateFieldXpath);
+ $this->assertElementNotNull(
+ $expirationDay,
+ __METHOD__ .
+ "could not find user share expiration day field"
+ );
+ return $expirationDay->getValue($expirationDay);
+ }
+
+ /**
+ * @return string
+ */
+ public function getGroupShareExpirationDays() {
+ $expirationDay = $this->find("xpath", $this->groupShareExpirationDateFieldXpath);
+ $this->assertElementNotNull(
+ $expirationDay,
+ __METHOD__ .
+ "could not find group share expiration day field"
+ );
+ return $expirationDay->getValue($expirationDay);
+ }
+
+ /**
+ * enable default expiration date for user share
+ *
+ * @param Session $session
+ *
+ * @return void
+ */
+ public function enableDefaultExpirationDateForUserShares(Session $session) {
+ $this->toggleCheckbox(
+ $session,
+ "enables",
+ $this->defaultExpirationDateForUserCheckboxXpath,
+ $this->defaultExpirationDateForUserCheckboxId
+ );
+ }
+
+ /**
+ * enforce maximum expiration date for user share
+ *
+ * @param Session $session
+ *
+ * @return void
+ */
+ public function enforceMaximumExpirationDateForUserShares(Session $session) {
+ $this->toggleCheckbox(
+ $session,
+ "enables",
+ $this->enforceExpirationDateUserShareCheckboxXpath,
+ $this->enforceExpirationDateUserShareCheckboxId
+ );
+ }
+
+ /**
+ * enforce mamixum expiration date for group share
+ *
+ * @param Session $session
+ *
+ * @return void
+ */
+ public function enforceMaximumExpirationDateForGroupShares(Session $session) {
+ $this->toggleCheckbox(
+ $session,
+ "enables",
+ $this->enforceExpirationDateGroupShareCheckboxXpath,
+ $this->enforceExpirationDateGroupShareCheckboxId
+ );
+ }
+
+ /**
+ *
+ * @throws ElementNotFoundException
+ * @return NodeElement|NULL
+ */
+ private function findUserShareExpirationField() {
+ $expirationDateField = $this->find("xpath", $this->userShareExpirationDateFieldXpath);
+ $this->assertElementNotNull(
+ $expirationDateField,
+ __METHOD__ .
+ " xpath $this->userShareExpirationDateFieldXpath could not find set-user-share-expiration-field"
+ );
+ return $expirationDateField;
+ }
+
+ /**
+ *
+ * @throws ElementNotFoundException
+ * @return NodeElement|NULL
+ */
+ private function findGroupShareExpirationField() {
+ $expirationDateField = $this->find("xpath", $this->groupShareExpirationDateFieldXpath);
+ $this->assertElementNotNull(
+ $expirationDateField,
+ __METHOD__ .
+ " xpath $this->groupShareExpirationDateFieldXpath could not find set-group-share-expiration-field"
+ );
+ return $expirationDateField;
+ }
+
+ /**
+ * set expiration date for user share
+ *
+ * @param int $date
+ * @param Session $session
+ *
+ * @return void
+ */
+ public function setExpirationDaysForUserShare(
+ $date, Session $session
+ ) {
+ $expirationDateField = $this->findUserShareExpirationField();
+ $this->fillFieldAndKeepFocus($expirationDateField, $date . "\n", $session);
+ $this->waitForAjaxCallsToStartAndFinish($session);
+ }
+
+ /**
+ * set expiration date for group share
+ *
+ * @param int $date
+ * @param Session $session
+ *
+ * @return void
+ */
+ public function setExpirationDaysForGroupShare(
+ $date, Session $session
+ ) {
+ $expirationDateField = $this->findGroupShareExpirationField();
+ $this->fillFieldAndKeepFocus($expirationDateField, $date . "\n", $session);
+ $this->waitForAjaxCallsToStartAndFinish($session);
+ }
+
+ /**
+ * enable default expiration date for group share
+ *
+ * @param Session $session
+ *
+ * @return void
+ */
+ public function enableDefaultExpirationDateForGroupShares(Session $session) {
+ $this->toggleCheckbox(
+ $session,
+ "enables",
+ $this->defaultExpirationDateForGroupCheckboxXpath,
+ $this->defaultExpirationDateForGroupCheckboxId
+ );
+ }
+
/**
* enable restrict users to only share with groups they are member of
*
diff --git a/tests/acceptance/features/lib/FilesPageElement/SharingDialog.php b/tests/acceptance/features/lib/FilesPageElement/SharingDialog.php
index b2433bfd8b1b..a4d913496cb3 100644
--- a/tests/acceptance/features/lib/FilesPageElement/SharingDialog.php
+++ b/tests/acceptance/features/lib/FilesPageElement/SharingDialog.php
@@ -52,18 +52,20 @@ class SharingDialog extends OwncloudPage {
private $suffixToIdentifyRemoteUsers = " Federated";
private $sharerInformationXpath = ".//*[@class='reshare']";
private $sharedWithAndByRegEx = "^(?:[A-Z]\s)?Shared with you(?: and the group (.*))? by (.*)$";
- private $permissionsFieldByUserName = ".//*[@id='shareWithList']//*[@class='has-tooltip username' and .='%s']/..";
- private $permissionsFieldByGroupName = ".//*[@id='shareWithList']//*[@class='has-tooltip username' and .='%s (group)']/..";
+ private $permissionsFieldByUserName = ".//*[@id='shareWithList']//*[@class='has-tooltip username' and .='%s']/../..";
+ private $permissionsFieldByGroupName = ".//*[@id='shareWithList']//*[@class='has-tooltip username' and .='%s (group)']/../..";
private $permissionLabelXpath = ".//label[@for='%s']";
- private $showCrudsXpath = ".//*[@class='showCruds']";
+ private $showCrudsXpath = ".//*[@class='action-item toggleShareDetails']";
private $publicLinksShareTabXpath = ".//li[contains(@class,'subtab-publicshare')]";
private $publicLinksTabContentXpath = "//div[@id='shareDialogLinkList']";
private $noSharingMessageXpath = "//div[@class='noSharingPlaceholder']";
private $publicLinkRemoveBtnXpath = "//div[contains(@class, 'removeLink')]";
private $publicLinkTitleXpath = "//span[@class='link-entry--title']";
private $notifyByEmailBtnXpath = "//input[@name='mailNotification']";
-
+ private $shareWithExpirationFieldXpath = "//*[@id='shareWithList']//span[@class='has-tooltip username' and .='%s']/../..//input[contains(@class, 'expiration')]";
+ private $shareWithClearExpirationFieldXpath = "/following-sibling::button[@class='removeExpiration']"; // in relation to $shareWithExpirationFieldXpath
private $shareWithListXpath = "//ul[@id='shareWithList']/li";
+ private $shareWithListDetailsXpath = "//div[@class='shareWithList__details']";
private $userOrGroupNameSpanXpath = "//span[contains(@class,'username')]";
private $unShareTabXpath = "//a[contains(@class,'unshare')]";
private $sharedWithGroupAndSharerName = null;
@@ -90,6 +92,122 @@ private function findShareWithField() {
return $shareWithField;
}
+ /**
+ * @param string $user
+ * @param string $type
+ *
+ * @return null|NodeElement
+ */
+ private function getExpirationFieldFor($user, $type = 'user') {
+ if ($type === "group") {
+ $user = \sprintf($this->groupFramework, $user);
+ }
+ return $this->find("xpath", \sprintf($this->shareWithExpirationFieldXpath, $user));
+ }
+
+ /**
+ * click the dropdown button for share actions in the sidebar
+ *
+ * @return void
+ */
+ public function toggleShareActionsDropDown() {
+ $showCrudsBtn = $this->find("xpath", $this->showCrudsXpath);
+ $this->assertElementNotNull(
+ $showCrudsBtn,
+ __METHOD__
+ . " xpath $this->showCrudsXpath could not find show-cruds button"
+ );
+ $showCrudsBtn->click();
+ }
+
+ /**
+ * open the dropdown for share actions in the sidebar
+ *
+ * @return void
+ */
+ public function openShareActionsDropDown() {
+ $this->toggleShareActionsDropDown();
+ $this->waitTillElementIsNotNull($this->shareWithListDetailsXpath);
+ }
+
+ /**
+ * close the dropdown for share actions in the sidebar
+ *
+ * @return void
+ */
+ public function closeShareActionsDropDown() {
+ $this->toggleShareActionsDropDown();
+ $this->waitTillElementIsNull($this->shareWithListDetailsXpath);
+ }
+
+ /**
+ * @param string $user
+ * @param string $type
+ *
+ * @return bool
+ */
+ public function isExpirationFieldVisible($user, $type = 'user') {
+ $field = $this->getExpirationFieldFor($user, $type);
+ $visible = ($field and $field->isVisible());
+ return $visible;
+ }
+
+ /**
+ * @param string $user
+ * @param string $type
+ *
+ * @throws \Exception
+ * @return string
+ */
+ public function getExpirationDateFor($user, $type = 'user') {
+ $field = $this->getExpirationFieldFor($user, $type);
+ $this->assertElementNotNull(
+ $field,
+ "Could not find expiration field for " . $type . " '$user'"
+ );
+ return $field->getValue();
+ }
+
+ /**
+ * @param Session $session
+ * @param string $user
+ * @param string $type
+ * @param string $value
+ *
+ * @return void
+ */
+ public function setExpirationDateFor(Session $session, $user, $type = 'user', $value = '') {
+ $field = $this->getExpirationFieldFor($user, $type);
+ $this->assertElementNotNull(
+ $field,
+ "Could not find expiration field for " . $type . " '$user'"
+ );
+ $field->setValue($value . "\n");
+ $this->waitForAjaxCallsToStartAndFinish($session);
+ }
+
+ /**
+ * @param Session $session
+ * @param string $user
+ * @param string $type
+ *
+ * @return void
+ */
+ public function clearExpirationDateFor(Session $session, $user, $type = 'user') {
+ $field = $this->getExpirationFieldFor($user, $type);
+ $this->assertElementNotNull(
+ $field,
+ "Could not find expiration field for " . $type . " '$user'"
+ );
+ $removeBtn = $field->find("xpath", $this->shareWithClearExpirationFieldXpath);
+ $this->assertElementNotNull(
+ $removeBtn,
+ "Could not find expiration field remove button for " . $type . " '$user'"
+ );
+ $removeBtn->click();
+ $this->waitForAjaxCallsToStartAndFinish($session);
+ }
+
/**
* checks if the share-with field is visible
*
@@ -362,10 +480,8 @@ public function setSharingPermissions(
. " xpath $this->showCrudsXpath could not find show-cruds button for user "
. $shareReceiverName
);
+ $showCrudsBtn->click();
foreach ($permissions as $permission => $value) {
- //the additional permission disappear again after they are changed
- //so we need to open them again and again
- $showCrudsBtn->click();
$value = \strtolower($value);
//to find where to click is a little bit complicated
diff --git a/tests/acceptance/features/webUIAdminSettings/adminSharingSettings.feature b/tests/acceptance/features/webUIAdminSettings/adminSharingSettings.feature
index 1c4fff197b70..cf0298ba5ad4 100644
--- a/tests/acceptance/features/webUIAdminSettings/adminSharingSettings.feature
+++ b/tests/acceptance/features/webUIAdminSettings/adminSharingSettings.feature
@@ -152,3 +152,85 @@ Feature: admin sharing settings
And the administrator has browsed to the admin sharing settings page
When the administrator disables add server automatically once a federation share was created successfully using the webUI
Then the config key "autoAddServers" of app "federation" should have value "0"
+
+ @skipOnOcV10.3
+ Scenario: enable default expiration date for user shares
+ Given the administrator has browsed to the admin sharing settings page
+ When the administrator enables default expiration date for user shares using the webUI
+ Then the config key "shareapi_default_expire_date_user_share" of app "core" should have value "yes"
+
+ @skipOnOcV10.3
+ Scenario: enable default expiration date for group shares
+ Given the administrator has browsed to the admin sharing settings page
+ When the administrator enables default expiration date for group shares using the webUI
+ Then the config key "shareapi_default_expire_date_group_share" of app "core" should have value "yes"
+
+ @skipOnOcV10.3
+ Scenario: set expiration date for user shares
+ Given the administrator has browsed to the admin sharing settings page
+ When the administrator enables default expiration date for user shares using the webUI
+ And the administrator updates the user share expiration date to "4" days using the webUI
+ Then the config key "shareapi_expire_after_n_days_user_share" of app "core" should have value "4"
+
+ @skipOnOcV10.3
+ Scenario: set expiration date for group shares
+ Given the administrator has browsed to the admin sharing settings page
+ When the administrator enables default expiration date for group shares using the webUI
+ And the administrator updates the group share expiration date to "11" days using the webUI
+ Then the config key "shareapi_expire_after_n_days_group_share" of app "core" should have value "11"
+
+ @skipOnOcV10.3
+ Scenario: set expiration date for user shares and enforce as maximum expiration date
+ Given the administrator has browsed to the admin sharing settings page
+ When the administrator enables default expiration date for user shares using the webUI
+ And the administrator enforces maximum expiration date for user shares using the webUI
+ Then the config key "shareapi_enforce_expire_date_user_share" of app "core" should have value "yes"
+
+ @skipOnOcV10.3
+ Scenario: set expiration date for group shares and enforce as maximum expiration date
+ Given the administrator has browsed to the admin sharing settings page
+ When the administrator enables default expiration date for group shares using the webUI
+ And the administrator enforces maximum expiration date for group shares using the webUI
+ Then the config key "shareapi_enforce_expire_date_group_share" of app "core" should have value "yes"
+
+ @skipOnOcV10.3
+ Scenario: check previously set default expiration date for user shares
+ Given parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ When the administrator browses to the admin sharing settings page
+ Then the default expiration date checkbox for user shares should be enabled on the webUI
+ And the expiration date for user shares should set to "7" days on the webUI
+
+ @skipOnOcV10.3
+ Scenario: check previously set default expiration date for group shares
+ Given parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "yes"
+ When the administrator browses to the admin sharing settings page
+ Then the default expiration date checkbox for group shares should be enabled on the webUI
+ And the expiration date for group shares should set to "7" days on the webUI
+
+ @skipOnOcV10.3
+ Scenario: check previously enforced maximum expiration date for user shares
+ Given parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to "yes"
+ When the administrator browses to the admin sharing settings page
+ Then the enforce maximum expiration date checkbox for user shares should be enabled on the webUI
+
+ @skipOnOcV10.3
+ Scenario: check previously enforced maximum expiration date for group shares
+ Given parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_group_share" of app "core" has been set to "yes"
+ When the administrator browses to the admin sharing settings page
+ Then the enforce maximum expiration date checkbox for group shares should be enabled on the webUI
+
+ @skipOnOcV10.3
+ Scenario: check previously set expiration date for user shares
+ Given parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_expire_after_n_days_user_share" of app "core" has been set to "5"
+ When the administrator browses to the admin sharing settings page
+ Then the expiration date for user shares should set to "5" days on the webUI
+
+ @skipOnOcV10.3
+ Scenario: check previously set expiration date for user shares
+ Given parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_expire_after_n_days_group_share" of app "core" has been set to "5"
+ When the administrator browses to the admin sharing settings page
+ Then the expiration date for group shares should set to "5" days on the webUI
\ No newline at end of file
diff --git a/tests/acceptance/features/webUIRestrictSharing/restrictReSharing.feature b/tests/acceptance/features/webUIRestrictSharing/restrictReSharing.feature
index dd29a89d945d..100c274543d3 100644
--- a/tests/acceptance/features/webUIRestrictSharing/restrictReSharing.feature
+++ b/tests/acceptance/features/webUIRestrictSharing/restrictReSharing.feature
@@ -19,7 +19,7 @@ Feature: restrict resharing
And user "user2" has created folder "simple-folder"
And user "user2" has logged in using the webUI
- @skipOnMICROSOFTEDGE @TestAlsoOnExternalUserBackend @files_sharing-app-required
+ @skipOnMICROSOFTEDGE @skipOnFIREFOX @TestAlsoOnExternalUserBackend @files_sharing-app-required
@smokeTest
Scenario: share a folder with another internal user and prohibit resharing
Given the setting "Allow resharing" in the section "Sharing" has been enabled
diff --git a/tests/acceptance/features/webUISharingExternal/federationSharing.feature b/tests/acceptance/features/webUISharingExternal/federationSharing.feature
index f82883ac13da..e8fa99bd828b 100644
--- a/tests/acceptance/features/webUISharingExternal/federationSharing.feature
+++ b/tests/acceptance/features/webUISharingExternal/federationSharing.feature
@@ -278,8 +278,8 @@ Feature: Federation Sharing - sharing with users on other cloud storages
And user "user1" re-logs in to "%remote_server%" using the webUI
And the user accepts the offered remote shares using the webUI
And user "user1" from server "REMOTE" shares "/simple-folder (2)" with user "user2" from server "LOCAL" using the sharing API
- And the user sets the sharing permissions of user "user2@%local_server%/ (federated)" for "simple-folder (2)" using the webUI to
- | edit | no |
+ And the user updates the last share using the sharing API with
+ | permissions | read |
And user "user2" re-logs in to "%local_server%" using the webUI
And the user accepts the offered remote shares using the webUI
Then as "user2" folder "/simple-folder (2)" should exist
diff --git a/tests/acceptance/features/webUISharingInternalGroups/shareWithGroupUsingExpirationDate.feature b/tests/acceptance/features/webUISharingInternalGroups/shareWithGroupUsingExpirationDate.feature
new file mode 100644
index 000000000000..05a6da39b12c
--- /dev/null
+++ b/tests/acceptance/features/webUISharingInternalGroups/shareWithGroupUsingExpirationDate.feature
@@ -0,0 +1,285 @@
+@webUI @insulated @disablePreviews @skipOnOcV10.3
+Feature: Sharing files and folders with internal groups with expiration date set/unset
+ As a user
+ I want to share files and folders with groups and set an expiration date
+ So that I can provide them temporary access
+
+ As a administrator
+ I want to set default expiration dates and be able to enforce them
+ So that a user cannot have endless shares
+
+ Background:
+ Given these users have been created with default attributes and without skeleton files:
+ | username |
+ | user1 |
+ | user2 |
+ And user "user3" has been created with default attributes and skeleton files
+ And these groups have been created:
+ | groupname |
+ | grp1 |
+ And user "user1" has been added to group "grp1"
+ And user "user2" has been added to group "grp1"
+
+ Scenario: expiration date is disabled for sharing with groups, user shares with a group
+ Given user "user1" has uploaded file "filesForUpload/lorem.txt" to "/lorem.txt"
+ And parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "no"
+ And user "user1" has logged in using the webUI
+ When the user shares file "lorem.txt" with group "grp1" using the webUI without closing the share dialog
+ Then the expiration date input field should be visible for the group "grp1" in the share dialog
+ And the expiration date input field should be empty for the group "grp1" in the share dialog
+ And the information of the last share of user "user1" should include
+ | share_type | group |
+ | file_target | /lorem.txt |
+ | expiration | |
+ | uid_owner | user1 |
+
+ Scenario: expiration date is disabled for sharing with groups but enabled for sharing with users, user shares with a group
+ Given user "user1" has uploaded file "filesForUpload/lorem.txt" to "/lorem.txt"
+ And parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "no"
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And user "user1" has logged in using the webUI
+ When the user shares file "lorem.txt" with group "grp1" using the webUI without closing the share dialog
+ Then the expiration date input field should be visible for the group "grp1" in the share dialog
+ And the expiration date input field should be empty for the group "grp1" in the share dialog
+ And the information of the last share of user "user1" should include
+ | share_type | group |
+ | file_target | /lorem.txt |
+ | expiration | |
+ | uid_owner | user1 |
+
+ Scenario: expiration date is enabled for sharing with groups, user shares a file with a group
+ Given user "user1" has uploaded file "filesForUpload/lorem.txt" to "/lorem.txt"
+ And parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "yes"
+ And user "user1" has logged in using the webUI
+ When the user shares file "lorem.txt" with group "grp1" using the webUI without closing the share dialog
+ Then the expiration date input field should be visible for the group "grp1" in the share dialog
+ And the expiration date input field should be "+7 days" for the group "grp1" in the share dialog
+ When the user changes expiration date for share of group "grp1" to "+3 days" in the share dialog
+ Then the expiration date input field should be "+3 days" for the group "grp1" in the share dialog
+ And the information of the last share of user "user1" should include
+ | share_type | group |
+ | file_target | /lorem.txt |
+ | expiration | +3 days |
+ | uid_owner | user1 |
+
+ Scenario: expiration date is enforced for group, user shares a file
+ Given user "user1" has uploaded file "filesForUpload/lorem.txt" to "/lorem.txt"
+ And parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_expire_after_n_days_group_share" of app "core" has been set to "3"
+ And user "user1" has logged in using the webUI
+ When the user shares file "lorem.txt" with group "grp1" using the webUI without closing the share dialog
+ Then the expiration date input field should be visible for the group "grp1" in the share dialog
+ And the expiration date input field should be "+3 days" for the group "grp1" in the share dialog
+ And the information of the last share of user "user1" should include
+ | share_type | group |
+ | file_target | /lorem.txt |
+ | expiration | +3 days |
+ | uid_owner | user1 |
+
+ Scenario: expiration date is enforced for group, user shares and tries to change expiration date more than allowed
+ Given user "user1" has uploaded file "filesForUpload/lorem.txt" to "/lorem.txt"
+ And parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_expire_after_n_days_group_share" of app "core" has been set to "3"
+ And user "user1" has logged in using the webUI
+ When the user shares file "lorem.txt" with group "grp1" using the webUI without closing the share dialog
+ And the user changes expiration date for share of group "grp1" to "+4 days" in the share dialog
+ Then the expiration date input field should be "+3 days" for the group "grp1" in the share dialog
+ And the information of the last share of user "user1" should include
+ | share_type | group |
+ | file_target | /lorem.txt |
+ | expiration | +3 days |
+ | uid_owner | user1 |
+
+ Scenario: expiration date is enforced for group, user reshares received file with the group
+ Given user "user3" has shared file "lorem.txt" with user "user1"
+ And parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_expire_after_n_days_group_share" of app "core" has been set to "3"
+ And user "user1" has logged in using the webUI
+ When the user shares file "lorem.txt" with group "grp1" using the webUI without closing the share dialog
+ Then the expiration date input field should be visible for the group "grp1" in the share dialog
+ And the expiration date input field should be "+3 days" for the group "grp1" in the share dialog
+ And the information of the last share of user "user1" should include
+ | share_type | group |
+ | file_target | /lorem.txt |
+ | expiration | +3 days |
+ | uid_owner | user1 |
+
+ Scenario: expiration date is enabled but not enforced for group, user reshares received file with group
+ Given user "user3" has shared file "lorem.txt" with user "user1"
+ And parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_group_share" of app "core" has been set to "no"
+ And user "user1" has logged in using the webUI
+ When the user shares file "lorem.txt" with group "grp1" using the webUI without closing the share dialog
+ Then the expiration date input field should be visible for the group "grp1" in the share dialog
+ And the expiration date input field should be "+7 days" for the group "grp1" in the share dialog
+ And the information of the last share of user "user1" should include
+ | share_type | group |
+ | file_target | /lorem.txt |
+ | expiration | +7 days |
+ | uid_owner | user1 |
+
+ Scenario: expiration date is enabled but not enforced for group, user reshares received file with group, but removes default expiration date
+ Given user "user3" has shared file "lorem.txt" with user "user1"
+ And parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_group_share" of app "core" has been set to "no"
+ And user "user1" has logged in using the webUI
+ When the user shares file "lorem.txt" with group "grp1" using the webUI without closing the share dialog
+ And the user clears the expiration date input field for share of group "grp1" in the share dialog
+ Then the expiration date input field should be empty for the group "grp1" in the share dialog
+ And the information of the last share of user "user1" should include
+ | share_type | group |
+ | file_target | /lorem.txt |
+ | uid_owner | user1 |
+ | expiration | |
+
+ Scenario: expiration date is enabled but not enforced for group, user reshares received file with user, but changes expiration date
+ Given parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_group_share" of app "core" has been set to "no"
+ And user "user3" has shared file "lorem.txt" with user "user1"
+ And user "user1" has logged in using the webUI
+ When the user shares file "lorem.txt" with group "grp1" using the webUI without closing the share dialog
+ And the user changes expiration date for share of group "grp1" to "+15 days" in the share dialog
+ Then the expiration date input field should be "+15 days" for the group "grp1" in the share dialog
+ And the information of the last share of user "user1" should include
+ | share_type | group |
+ | file_target | /lorem.txt |
+ | uid_owner | user1 |
+ | expiration | +15 days |
+
+ Scenario: expiration date is enabled but not enforced for group, user shares to group through api and checks the expiration date on webUI
+ Given parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_group_share" of app "core" has been set to "no"
+ And user "user3" has created a share with settings
+ | path | /lorem.txt |
+ | shareType | group |
+ | shareWith | grp1 |
+ | permissions | read,share |
+ | expireDate | +15 days |
+ And user "user3" has logged in using the webUI
+ When the user opens the share dialog for file "lorem.txt"
+ Then the expiration date input field should be "+15 days" for the group "grp1" in the share dialog
+
+ Scenario: expiration date is enabled but not enforced for group, user receives a share with expiration date and reshares with expiration date less than the original
+ Given parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_group_share" of app "core" has been set to "no"
+ And user "user3" has created a share with settings
+ | path | /lorem.txt |
+ | shareType | user |
+ | shareWith | user1 |
+ | permissions | read,share |
+ | expireDate | +15 days |
+ And user "user1" has logged in using the webUI
+ When the user shares file "lorem.txt" with group "grp1" using the webUI without closing the share dialog
+ Then the expiration date input field should be "+7 days" for the group "grp1" in the share dialog
+ When the user changes expiration date for share of group "grp1" to "+10 days" in the share dialog
+ Then the expiration date input field should be "+10 days" for the group "grp1" in the share dialog
+ And the information of the last share of user "user1" should include
+ | share_type | group |
+ | file_target | /lorem.txt |
+ | uid_owner | user1 |
+ | expiration | +10 days |
+
+ Scenario: expiration date is enabled but not enforced for group, user receives a share with expiration date and reshares with expiration date in future than the original
+ Given parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_group_share" of app "core" has been set to "no"
+ And user "user3" has created a share with settings
+ | path | /lorem.txt |
+ | shareType | user |
+ | shareWith | user1 |
+ | permissions | read,share |
+ | expireDate | +15 days |
+ And user "user1" has logged in using the webUI
+ When the user shares file "lorem.txt" with group "grp1" using the webUI without closing the share dialog
+ Then the expiration date input field should be "+7 days" for the group "grp1" in the share dialog
+ When the user changes expiration date for share of group "grp1" to "+20 days" in the share dialog
+ Then the expiration date input field should be "+20 days" for the group "grp1" in the share dialog
+ And the information of the last share of user "user1" should include
+ | share_type | group |
+ | file_target | /lorem.txt |
+ | uid_owner | user1 |
+ | expiration | +20 days |
+
+ Scenario: expiration date is enabled and enforced for group, user receives a share with expiration date and tries to reshare with expiration date less than the original
+ Given parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_expire_after_n_days_group_share" of app "core" has been set to "30"
+ And user "user3" has created a share with settings
+ | path | /lorem.txt |
+ | shareType | user |
+ | shareWith | user1 |
+ | permissions | read,share |
+ | expireDate | +15 days |
+ And user "user1" has logged in using the webUI
+ When the user shares file "lorem.txt" with group "grp1" using the webUI without closing the share dialog
+ Then the expiration date input field should be "+30 days" for the group "grp1" in the share dialog
+ When the user changes expiration date for share of group "grp1" to "+20 days" in the share dialog
+ Then the expiration date input field should be "+20 days" for the group "grp1" in the share dialog
+ And the information of the last share of user "user1" should include
+ | share_type | group |
+ | file_target | /lorem.txt |
+ | uid_owner | user1 |
+ | expiration | +20 days |
+
+ Scenario: expiration date is enabled and enforced for group, user receives a share with expiration date and tries to reshare with expiration date further in future than the original
+ Given parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_expire_after_n_days_group_share" of app "core" has been set to "30"
+ And user "user3" has created a share with settings
+ | path | /lorem.txt |
+ | shareType | user |
+ | shareWith | user1 |
+ | permissions | read,share |
+ | expireDate | +15 days |
+ And user "user1" has logged in using the webUI
+ When the user shares file "lorem.txt" with group "grp1" using the webUI without closing the share dialog
+ Then the expiration date input field should be "+30 days" for the group "grp1" in the share dialog
+ When the user changes expiration date for share of group "grp1" to "+40 days" in the share dialog
+ Then the expiration date input field should be "+30 days" for the group "grp1" in the share dialog
+ And the information of the last share of user "user1" should include
+ | share_type | group |
+ | file_target | /lorem.txt |
+ | uid_owner | user1 |
+ | expiration | +30 days |
+
+ Scenario: expiration date is enabled and enforced for group, user receives a folder from a group share with expiration date and shares sub-folder with group
+ Given parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_group_share" of app "core" has been set to "yes"
+ And parameter "shareapi_expire_after_n_days_group_share" of app "core" has been set to "30"
+ And group "grp2" has been created
+ And user "user1" has been added to group "grp2"
+ And user "user3" has created a share with settings
+ | path | /simple-folder |
+ | shareType | group |
+ | shareWith | grp2 |
+ | permissions | read,share |
+ | expireDate | +15 days |
+ And user "user1" has logged in using the webUI
+ When the user opens folder "simple-folder" using the webUI
+ And the user shares file "simple-empty-folder" with group "grp1" using the webUI without closing the share dialog
+ Then the expiration date input field should be "+30 days" for the group "grp1" in the share dialog
+ When the user changes expiration date for share of group "grp1" to "+20 days" in the share dialog
+ And the information of the last share of user "user1" should include
+ | share_type | group |
+ | file_target | /simple-empty-folder |
+ | uid_owner | user1 |
+ | expiration | +20 days |
+ | share_with | grp1 |
+
+ Scenario: expiration date is disabled for sharing with group, user shares file with group and sets expiration date
+ Given parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "no"
+ And parameter "shareapi_enforce_expire_date_group_share" of app "core" has been set to "no"
+ And user "user1" has uploaded file "filesForUpload/lorem.txt" to "lorem.txt"
+ And user "user1" has logged in using the webUI
+ When the user shares file "lorem.txt" with group "grp1" using the webUI without closing the share dialog
+ And the user changes expiration date for share of group "grp1" to "+15 days" in the share dialog
+ Then the expiration date input field should be visible for the group "grp1" in the share dialog
+ And the expiration date input field should be "+15 days" for the group "grp1" in the share dialog
+ And the information of the last share of user "user1" should include
+ | share_type | group |
+ | file_target | /lorem.txt |
+ | expiration | +15 days |
+ | uid_owner | user1 |
+ | share_with | grp1 |
diff --git a/tests/acceptance/features/webUISharingInternalUsers/shareWithUserUsingExpirationDate.feature b/tests/acceptance/features/webUISharingInternalUsers/shareWithUserUsingExpirationDate.feature
new file mode 100644
index 000000000000..89a61f0559b2
--- /dev/null
+++ b/tests/acceptance/features/webUISharingInternalUsers/shareWithUserUsingExpirationDate.feature
@@ -0,0 +1,265 @@
+@webUI @insulated @disablePreviews @skipOnOcV10.3
+Feature: Sharing files and folders with internal users with expiration date set/unset
+ As a user
+ I want to share files and folders with users with expiration date set
+ So that I can provide them temporary access
+
+ Background:
+ Given these users have been created with default attributes and without skeleton files:
+ | username |
+ | user1 |
+ | user2 |
+ And user "user3" has been created with default attributes and skeleton files
+
+ Scenario: expiration date is disabled for sharing with users, user shares with an other user
+ Given user "user1" has uploaded file "filesForUpload/lorem.txt" to "/lorem.txt"
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "no"
+ And user "user1" has logged in using the webUI
+ When the user shares file "lorem.txt" with user "User Two" using the webUI without closing the share dialog
+ Then the expiration date input field should be visible for the user "User Two" in the share dialog
+ And the expiration date input field should be empty for the user "User Two" in the share dialog
+ And the information of the last share of user "user1" should include
+ | share_type | user |
+ | file_target | /lorem.txt |
+ | expiration | |
+ | uid_owner | user1 |
+
+ Scenario: expiration date is disabled for sharing with users but enabled for sharing with groups, user shares with an other user
+ Given user "user1" has uploaded file "filesForUpload/lorem.txt" to "/lorem.txt"
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "no"
+ And parameter "shareapi_default_expire_date_group_share" of app "core" has been set to "yes"
+ And user "user1" has logged in using the webUI
+ When the user shares file "lorem.txt" with user "User Two" using the webUI without closing the share dialog
+ Then the expiration date input field should be visible for the user "User Two" in the share dialog
+
+ Scenario: expiration date is enabled for sharing with users, user shares file with another user
+ Given user "user1" has uploaded file "filesForUpload/lorem.txt" to "/lorem.txt"
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And user "user1" has logged in using the webUI
+ When the user shares file "lorem.txt" with user "User Two" using the webUI without closing the share dialog
+ Then the expiration date input field should be visible for the user "User Two" in the share dialog
+ And the expiration date input field should be "+7 days" for the user "User Two" in the share dialog
+ And the information of the last share of user "user1" should include
+ | share_type | user |
+ | file_target | /lorem.txt |
+ | expiration | +7 days |
+ | uid_owner | user1 |
+
+ Scenario: expiration date is enforced for user, user shares file
+ Given user "user1" has uploaded file "filesForUpload/lorem.txt" to "/lorem.txt"
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_expire_after_n_days_user_share" of app "core" has been set to "3"
+ And user "user1" has logged in using the webUI
+ When the user shares file "lorem.txt" with user "User Two" using the webUI without closing the share dialog
+ Then the expiration date input field should be visible for the user "User Two" in the share dialog
+ And the expiration date input field should be "+3 days" for the user "User Two" in the share dialog
+ And the information of the last share of user "user1" should include
+ | share_type | user |
+ | file_target | /lorem.txt |
+ | expiration | +3 days |
+ | uid_owner | user1 |
+
+ Scenario: expiration date is enforced for user, user shares and tries to change expiration date more than allowed
+ Given user "user1" has uploaded file "filesForUpload/lorem.txt" to "/lorem.txt"
+ And parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_expire_after_n_days_user_share" of app "core" has been set to "3"
+ And user "user1" has logged in using the webUI
+ When the user shares file "lorem.txt" with user "User Two" using the webUI without closing the share dialog
+ And the user changes expiration date for share of user "User Two" to "+4 days" in the share dialog
+ Then the expiration date input field should be "+3 days" for the user "User Two" in the share dialog
+ And the information of the last share of user "user1" should include
+ | share_type | user |
+ | file_target | /lorem.txt |
+ | expiration | +3 days |
+ | uid_owner | user1 |
+
+ Scenario: expiration date is enforced for user, user reshares received file with another user
+ Given parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_expire_after_n_days_user_share" of app "core" has been set to "3"
+ And user "user3" has shared file "lorem.txt" with user "user1"
+ And user "user1" has logged in using the webUI
+ When the user shares file "lorem.txt" with user "User Two" using the webUI without closing the share dialog
+ Then the expiration date input field should be visible for the user "User Two" in the share dialog
+ And the expiration date input field should be "+3 days" for the user "User Two" in the share dialog
+ Then the information of the last share of user "user1" should include
+ | share_type | user |
+ | file_target | /lorem.txt |
+ | expiration | +3 days |
+ | uid_owner | user1 |
+
+ Scenario: expiration date is enabled but not enforced for user, user reshares received file with another user
+ Given parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to "no"
+ And user "user3" has shared file "lorem.txt" with user "user1"
+ And user "user1" has logged in using the webUI
+ When the user shares file "lorem.txt" with user "User Two" using the webUI without closing the share dialog
+ Then the expiration date input field should be visible for the user "User Two" in the share dialog
+ And the expiration date input field should be "+7 days" for the user "User Two" in the share dialog
+ Then the information of the last share of user "user1" should include
+ | share_type | user |
+ | file_target | /lorem.txt |
+ | expiration | +7 days |
+ | uid_owner | user1 |
+
+ Scenario: expiration date is enabled but not enforced for user, user reshares received file with another user, but removes default expiration date
+ Given parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to "no"
+ And user "user3" has shared file "lorem.txt" with user "user1"
+ And user "user1" has logged in using the webUI
+ When the user shares file "lorem.txt" with user "User Two" using the webUI without closing the share dialog
+ And the user clears the expiration date input field for share of user "User Two" in the share dialog
+ Then the expiration date input field should be empty for the user "User Two" in the share dialog
+ And the information of the last share of user "user1" should include
+ | share_type | user |
+ | file_target | /lorem.txt |
+ | uid_owner | user1 |
+ | expiration | |
+
+ Scenario: expiration date is enabled but not enforced for user, user reshares received file with another user, but changes expiration date
+ Given parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to "no"
+ And user "user3" has shared file "lorem.txt" with user "user1"
+ And user "user1" has logged in using the webUI
+ When the user shares file "lorem.txt" with user "User Two" using the webUI without closing the share dialog
+ And the user changes expiration date for share of user "User Two" to "+15 days" in the share dialog
+ Then the expiration date input field should be "+15 days" for the user "User Two" in the share dialog
+ And the information of the last share of user "user1" should include
+ | share_type | user |
+ | file_target | /lorem.txt |
+ | uid_owner | user1 |
+ | expiration | +15 days |
+
+ Scenario: expiration date is enabled but not enforced, user shares through api and checks the expiration date on webUI
+ Given parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to "no"
+ And user "user3" has created a share with settings
+ | path | /lorem.txt |
+ | shareType | user |
+ | shareWith | user1 |
+ | permissions | read,share |
+ | expireDate | +15 days |
+ And user "user3" has logged in using the webUI
+ When the user opens the share dialog for file "lorem.txt"
+ Then the expiration date input field should be "+15 days" for the user "User One" in the share dialog
+
+ Scenario: expiration date is enabled but not enforced, user receives a share with expiration date and reshares with expiration date less than the original
+ Given parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to "no"
+ And user "user3" has created a share with settings
+ | path | /lorem.txt |
+ | shareType | user |
+ | shareWith | user1 |
+ | permissions | read,share |
+ | expireDate | +15 days |
+ And user "user1" has logged in using the webUI
+ When the user shares file "lorem.txt" with user "User Two" using the webUI without closing the share dialog
+ Then the expiration date input field should be "+7 days" for the user "User Two" in the share dialog
+ When the user changes expiration date for share of user "User Two" to "+10 days" in the share dialog
+ Then the expiration date input field should be "+10 days" for the user "User Two" in the share dialog
+ And the information of the last share of user "user1" should include
+ | share_type | user |
+ | file_target | /lorem.txt |
+ | uid_owner | user1 |
+ | expiration | +10 days |
+
+ Scenario: expiration date is enabled but not enforced, user receives a share with expiration date and reshares it, setting a date further in future than the original
+ Given parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to "no"
+ And user "user3" has created a share with settings
+ | path | /lorem.txt |
+ | shareType | user |
+ | shareWith | user1 |
+ | permissions | read,share |
+ | expireDate | +15 days |
+ And user "user1" has logged in using the webUI
+ When the user shares file "lorem.txt" with user "User Two" using the webUI without closing the share dialog
+ Then the expiration date input field should be "+7 days" for the user "User Two" in the share dialog
+ When the user changes expiration date for share of user "User Two" to "+20 days" in the share dialog
+ Then the expiration date input field should be "+20 days" for the user "User Two" in the share dialog
+ And the information of the last share of user "user1" should include
+ | share_type | user |
+ | file_target | /lorem.txt |
+ | uid_owner | user1 |
+ | expiration | +20 days |
+
+ Scenario: expiration date is enabled and enforced, user receives a share with expiration date and tries to reshare with expiration date less than the original
+ Given parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_expire_after_n_days_user_share" of app "core" has been set to "30"
+ And user "user3" has created a share with settings
+ | path | /lorem.txt |
+ | shareType | user |
+ | shareWith | user1 |
+ | permissions | read,share |
+ | expireDate | +15 days |
+ And user "user1" has logged in using the webUI
+ When the user shares file "lorem.txt" with user "User Two" using the webUI without closing the share dialog
+ Then the expiration date input field should be "+30 days" for the user "User Two" in the share dialog
+ When the user changes expiration date for share of user "User Two" to "+20 days" in the share dialog
+ Then the expiration date input field should be "+20 days" for the user "User Two" in the share dialog
+ And the information of the last share of user "user1" should include
+ | share_type | user |
+ | file_target | /lorem.txt |
+ | uid_owner | user1 |
+ | expiration | +20 days |
+
+ Scenario: expiration date is enabled and enforced, user receives a share with expiration date and tries to reshare it with a date further in future than the original
+ Given parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_expire_after_n_days_user_share" of app "core" has been set to "30"
+ And user "user3" has created a share with settings
+ | path | /lorem.txt |
+ | shareType | user |
+ | shareWith | user1 |
+ | permissions | read,share |
+ | expireDate | +15 days |
+ And user "user1" has logged in using the webUI
+ When the user shares file "lorem.txt" with user "User Two" using the webUI without closing the share dialog
+ Then the expiration date input field should be "+30 days" for the user "User Two" in the share dialog
+ When the user changes expiration date for share of user "User Two" to "+40 days" in the share dialog
+ Then the expiration date input field should be "+30 days" for the user "User Two" in the share dialog
+ And the information of the last share of user "user1" should include
+ | share_type | user |
+ | file_target | /lorem.txt |
+ | uid_owner | user1 |
+ | expiration | +30 days |
+
+ Scenario: expiration date is enabled and enforced, user receives a folder from a user share with expiration date and shares sub-folder with another user
+ Given parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to "yes"
+ And parameter "shareapi_expire_after_n_days_user_share" of app "core" has been set to "30"
+ And user "user3" has created a share with settings
+ | path | /simple-folder |
+ | shareType | user |
+ | shareWith | user1 |
+ | permissions | read,share |
+ | expireDate | +15 days |
+ And user "user1" has logged in using the webUI
+ When the user opens folder "simple-folder" using the webUI
+ And the user shares file "simple-empty-folder" with user "User Two" using the webUI without closing the share dialog
+ Then the expiration date input field should be "+30 days" for the user "User Two" in the share dialog
+ When the user changes expiration date for share of user "User Two" to "+20 days" in the share dialog
+ And the information of the last share of user "user1" should include
+ | share_type | user |
+ | file_target | /simple-empty-folder |
+ | uid_owner | user1 |
+ | expiration | +20 days |
+ | share_with | user2 |
+
+ Scenario: expiration date is disabled for sharing with users, user shares file with another user and sets expiration date
+ Given parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "no"
+ And parameter "shareapi_enforce_expire_date_user_share" of app "core" has been set to "no"
+ And user "user1" has uploaded file "filesForUpload/lorem.txt" to "/lorem.txt"
+ And user "user1" has logged in using the webUI
+ When the user shares file "lorem.txt" with user "User Two" using the webUI without closing the share dialog
+ And the user changes expiration date for share of user "User Two" to "+15 days" in the share dialog
+ Then the expiration date input field should be visible for the user "User Two" in the share dialog
+ And the expiration date input field should be "+15 days" for the user "User Two" in the share dialog
+ And the information of the last share of user "user1" should include
+ | share_type | user |
+ | file_target | /lorem.txt |
+ | expiration | +15 days |
+ | uid_owner | user1 |
diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php
index 0452011f4906..2be4e68cd11e 100644
--- a/tests/lib/Share20/ManagerTest.php
+++ b/tests/lib/Share20/ManagerTest.php
@@ -1014,7 +1014,9 @@ public function testvalidateExpirationDateEnforceButNotSet() {
$this->expectExceptionMessage('Expiration date is enforced');
$share = $this->manager->newShare();
- $share->setProviderId('foo')->setId('bar');
+ $share->setId(43)
+ ->setProviderId('prov')
+ ->setShareType(\OCP\Share::SHARE_TYPE_LINK);
$this->config->method('getAppValue')
->will($this->returnValueMap([
@@ -1027,7 +1029,7 @@ public function testvalidateExpirationDateEnforceButNotSet() {
public function testvalidateExpirationDateEnforceButNotEnabledAndNotSet() {
$share = $this->manager->newShare();
- $share->setProviderId('foo')->setId('bar');
+ $share->setShareType(\OCP\Share::SHARE_TYPE_LINK);
$this->config->method('getAppValue')
->will($this->returnValueMap([
@@ -1041,13 +1043,13 @@ public function testvalidateExpirationDateEnforceButNotEnabledAndNotSet() {
public function testvalidateExpirationDateEnforceButNotSetNewShare() {
$share = $this->manager->newShare();
+ $share->setShareType(\OCP\Share::SHARE_TYPE_LINK);
$this->config->method('getAppValue')
->will($this->returnValueMap([
['core', 'shareapi_enforce_expire_date', 'no', 'yes'],
['core', 'shareapi_expire_after_n_days', '7', '3'],
['core', 'shareapi_default_expire_date', 'no', 'yes'],
- ['core', 'shareapi_enforce_expire_date', 'no', 'yes'],
]));
$expected = new \DateTime();
@@ -1064,7 +1066,8 @@ public function testvalidateExpirationDateEnforceToFarIntoFuture() {
$future->add(new \DateInterval('P7D'));
$share = $this->manager->newShare();
- $share->setExpirationDate($future);
+ $share->setShareType(\OCP\Share::SHARE_TYPE_LINK)
+ ->setExpirationDate($future);
$this->config->method('getAppValue')
->will($this->returnValueMap([
@@ -3770,6 +3773,10 @@ class DummyFactory implements IProviderFactory {
public function __construct(\OCP\IServerContainer $serverContainer) {
}
+ public function getProviders() {
+ return [$this->provider];
+ }
+
/**
* @param IShareProvider $provider
*/