From 4bf22b054a8d44b263d47494299bb236fd913ecc Mon Sep 17 00:00:00 2001 From: Prarup Gurung Date: Fri, 10 May 2024 15:13:27 +0545 Subject: [PATCH 1/4] shareSpaces.feature: Used sharingNG for sharing in given step --- .../apiSpacesShares/shareSpaces.feature | 293 ++++++++++-------- 1 file changed, 160 insertions(+), 133 deletions(-) diff --git a/tests/acceptance/features/apiSpacesShares/shareSpaces.feature b/tests/acceptance/features/apiSpacesShares/shareSpaces.feature index 467f51d21..eada48549 100644 --- a/tests/acceptance/features/apiSpacesShares/shareSpaces.feature +++ b/tests/acceptance/features/apiSpacesShares/shareSpaces.feature @@ -114,9 +114,11 @@ Feature: Share spaces Scenario Outline: user with manager role can share a space to another user - Given user "Alice" has shared a space "share space" with settings: - | shareWith | Brian | - | role | manager | + Given user "Alice" has sent the following space share invitation: + | space | share space | + | sharee | Brian | + | shareType | user | + | permissionsRole | Manager | When user "Brian" shares a space "share space" with settings: | shareWith | Bob | | role | | @@ -132,9 +134,11 @@ Feature: Share spaces @skipOnRevaMaster Scenario Outline: user with editor or viewer role cannot share a space to another user - Given user "Alice" has shared a space "share space" with settings: - | shareWith | Brian | - | role | | + Given user "Alice" has sent the following space share invitation: + | space | share space | + | sharee | Brian | + | shareType | user | + | permissionsRole | | When user "Brian" shares a space "share space" with settings: | shareWith | Bob | | role | | @@ -143,54 +147,60 @@ Feature: Share spaces And the OCS status message should be "No share permission" And the user "Bob" should not have a space called "share space" Examples: - | space-role | share-space-role | - | editor | manager | - | editor | editor | - | editor | viewer | - | viewer | manager | - | viewer | editor | - | viewer | viewer | + | space-role | share-space-role | + | Space Editor | manager | + | Space Editor | editor | + | Space Editor | viewer | + | Space Viewer | manager | + | Space Viewer | editor | + | Space Viewer | viewer | Scenario Outline: space manager can change the role of space members - Given user "Alice" has shared a space "share space" with settings: - | shareWith | Brian | - | role | | + Given user "Alice" has sent the following space share invitation: + | space | share space | + | sharee | Brian | + | shareType | user | + | permissionsRole | | When user "Alice" shares a space "share space" with settings: - | shareWith | Brian | - | role | | + | shareWith | Brian | + | role | | Then the HTTP status code should be "200" And the OCS status code should be "200" - And the user "Alice" should have a space called "share space" granted to "Brian" with role "" + And the user "Alice" should have a space called "share space" granted to "Brian" with role "" Examples: - | space-role | new-space-role | - | editor | manager | - | editor | viewer | - | viewer | manager | - | viewer | editor | - | manager | editor | - | manager | viewer | + | space-role | share-space-role | + | Space Editor | manager | + | Space Editor | viewer | + | Space Viewer | manager | + | Space Viewer | editor | + | Manager | editor | + | Manager | viewer | @skipOnRevaMaster Scenario Outline: user without manager role cannot change the role of space members - Given user "Alice" has shared a space "share space" with settings: - | shareWith | Brian | - | role | | - And user "Alice" has shared a space "share space" with settings: - | shareWith | Bob | - | role | viewer | + Given user "Alice" has sent the following space share invitation: + | space | share space | + | sharee | Brian | + | shareType | user | + | permissionsRole | | + And user "Alice" has sent the following space share invitation: + | space | share space | + | sharee | Bob | + | shareType | user | + | permissionsRole | Space Viewer | When user "Brian" updates the space "share space" with settings: - | shareWith | Bob | - | role | | + | shareWith | Bob | + | role | | Then the HTTP status code should be "403" And the OCS status code should be "403" And the user "Alice" should have a space called "share space" granted to "Bob" with role "viewer" Examples: - | space-role | new-space-role | - | editor | manager | - | editor | viewer | - | viewer | manager | - | viewer | editor | + | space-role | share-space-role | + | Space Editor | manager | + | Space Editor | viewer | + | Space Viewer | manager | + | Space Viewer | editor | Scenario Outline: user shares a space with a group @@ -214,28 +224,30 @@ Feature: Share spaces Scenario Outline: user has no access to the space if access for the group has been removed Given group "group2" has been created And the administrator has added a user "Brian" to the group "group2" using the Graph API - And user "Alice" has shared a space "share space" with settings: - | shareWith | group2 | - | shareType | 8 | - | role | | + And user "Alice" has sent the following space share invitation: + | space | share space | + | sharee | group2 | + | shareType | group | + | permissionsRole | | When user "Alice" unshares a space "share space" to group "group2" Then the HTTP status code should be "200" And the user "Brian" should not have a space called "share space" Examples: - | space-role | - | manager | - | editor | - | viewer | + | space-role | + | Manager | + | Space Editor | + | Space Viewer | Scenario: user has no access to the space if he has been removed from the group Given group "group2" has been created And the administrator has added a user "Brian" to the group "group2" using the Graph API And the administrator has added a user "Bob" to the group "group2" using the Graph API - And user "Alice" has shared a space "share space" with settings: - | shareWith | group2 | - | shareType | 8 | - | role | editor | + And user "Alice" has sent the following space share invitation: + | space | share space | + | sharee | group2 | + | shareType | group | + | permissionsRole | Space Editor | When the administrator removes the following users from the following groups using the Graph API | username | groupname | | Brian | group2 | @@ -248,10 +260,11 @@ Feature: Share spaces Given group "group2" has been created And the administrator has added a user "Brian" to the group "group2" using the Graph API And the administrator has added a user "Bob" to the group "group2" using the Graph API - And user "Alice" has shared a space "share space" with settings: - | shareWith | group2 | - | shareType | 8 | - | role | editor | + And user "Alice" has sent the following space share invitation: + | space | share space | + | sharee | group2 | + | shareType | group | + | permissionsRole | Space Editor | When the administrator deletes group "group2" using the Graph API Then the HTTP status code should be "204" And the user "Bob" should not have a space called "share space" @@ -261,10 +274,11 @@ Feature: Share spaces Scenario: user increases permissions for one member of the group or for the entire group Given group "sales" has been created And the administrator has added a user "Brian" to the group "sales" using the Graph API - And user "Alice" has shared a space "share space" with settings: - | shareWith | sales | - | shareType | 8 | - | role | viewer | + And user "Alice" has sent the following space share invitation: + | space | share space | + | sharee | sales | + | shareType | group | + | permissionsRole | Space Viewer | When user "Brian" uploads a file inside space "share space" with content "Test" to "test.txt" using the WebDAV API Then the HTTP status code should be "403" When user "Alice" shares a space "share space" with settings: @@ -278,9 +292,11 @@ Feature: Share spaces Scenario: user increases permissions for the group, so the user's permissions are increased Given group "sales" has been created And the administrator has added a user "Brian" to the group "sales" using the Graph API - And user "Alice" has shared a space "share space" with settings: - | shareWith | Brian | - | role | viewer | + And user "Alice" has sent the following space share invitation: + | space | share space | + | sharee | Brian | + | shareType | user | + | permissionsRole | Space Viewer | When user "Brian" uploads a file inside space "share space" with content "Test" to "test.txt" using the WebDAV API Then the HTTP status code should be "403" When user "Alice" shares a space "share space" with settings: @@ -324,128 +340,137 @@ Feature: Share spaces Scenario Outline: update the expiration date of a space in user share - Given user "Alice" has shared a space "share space" with settings: - | shareWith | Brian | - | role | | - | expireDate | 2042-03-25T23:59:59+0100 | + Given user "Alice" has sent the following space share invitation: + | space | share space | + | sharee | Brian | + | shareType | user | + | permissionsRole | | + | expireDate | 2042-03-25T23:59:59.000Z | When user "Alice" updates the space "share space" with settings: | shareWith | Brian | | expireDate | 2044-01-01T23:59:59.999+01:00 | - | role | | + | role | | Then the HTTP status code should be "200" - And the user "Brian" should have a space called "share space" granted to user "Brian" with role "" and expiration date "2044-01-01" + And the user "Brian" should have a space called "share space" granted to user "Brian" with role "" and expiration date "2044-01-01" Examples: - | space-role | - | manager | - | editor | - | viewer | + | space-role | share-space-role | + | Manager | manager | + | Space Editor | editor | + | Space Viewer | viewer | Scenario Outline: update the expiration date of a space in group share Given group "sales" has been created And the administrator has added a user "Brian" to the group "sales" using the Graph API - And user "Alice" has shared a space "share space" with settings: - | shareWith | sales | - | shareType | 8 | - | role | | - | expireDate | 2042-03-25T23:59:59+0100 | + And user "Alice" has sent the following space share invitation: + | space | share space | + | sharee | sales | + | shareType | group | + | permissionsRole | | + | expireDate | 2042-03-25T23:59:59.000Z | When user "Alice" updates the space "share space" with settings: | shareWith | sales | | shareType | 8 | | expireDate | 2044-01-01T23:59:59.999+01:00 | - | role | | + | role | | Then the HTTP status code should be "200" - And the user "Brian" should have a space called "share space" granted to group "sales" with role "" and expiration date "2044-01-01" + And the user "Brian" should have a space called "share space" granted to group "sales" with role "" and expiration date "2044-01-01" Examples: - | space-role | - | manager | - | editor | - | viewer | + | space-role | share-space-role | + | Manager | manager | + | Space Editor | editor | + | Space Viewer | viewer | Scenario Outline: delete the expiration date of a space in user share - Given user "Alice" has shared a space "share space" with settings: - | shareWith | Brian | - | role | | - | expireDate | 2042-03-25T23:59:59+0100 | + Given user "Alice" has sent the following space share invitation: + | space | share space | + | sharee | Brian | + | shareType | user | + | permissionsRole | | + | expireDate | 2042-03-25T23:59:59.000Z | When user "Alice" updates the space "share space" with settings: - | shareWith | Brian | - | expireDate | | - | role | | + | shareWith | Brian | + | expireDate | | + | role | | Then the HTTP status code should be "200" - And the user "Brian" should have a space called "share space" granted to user "Brian" with role "" and expiration date "" + And the user "Brian" should have a space called "share space" granted to user "Brian" with role "" and expiration date "" Examples: - | space-role | - | manager | - | editor | - | viewer | + | space-role | share-space-role | + | Manager | manager | + | Space Editor | editor | + | Space Viewer | viewer | Scenario Outline: delete the expiration date of a space in group share Given group "sales" has been created And the administrator has added a user "Brian" to the group "sales" using the Graph API - And user "Alice" has shared a space "share space" with settings: - | shareWith | sales | - | shareType | 8 | - | role | | - | expireDate | 2042-03-25T23:59:59+0100 | + And user "Alice" has sent the following space share invitation: + | space | share space | + | sharee | sales | + | shareType | group | + | permissionsRole | | + | expireDate | 2042-03-25T23:59:59.000Z | When user "Alice" updates the space "share space" with settings: - | shareWith | sales | - | shareType | 8 | - | expireDate | | - | role | | + | shareWith | sales | + | shareType | 8 | + | expireDate | | + | role | | Then the HTTP status code should be "200" - And the user "Brian" should have a space called "share space" granted to group "sales" with role "" and expiration date "" + And the user "Brian" should have a space called "share space" granted to group "sales" with role "" and expiration date "" Examples: - | space-role | - | manager | - | editor | - | viewer | + | space-role | share-space-role | + | Manager | manager | + | Space Editor | editor | + | Space Viewer | viewer | Scenario Outline: check the end of expiration of a space in user share - Given user "Alice" has shared a space "share space" with settings: - | shareWith | Brian | - | role | | - | expireDate | 2042-03-25T23:59:59+0100 | + Given user "Alice" has sent the following space share invitation: + | space | share space | + | sharee | Brian | + | shareType | user | + | permissionsRole | | + | expireDate | 2042-03-25T23:59:59.000Z | When user "Alice" expires the user share of space "share space" for user "Brian" Then the HTTP status code should be "200" And the user "Brian" should not have a space called "share space" Examples: - | space-role | - | manager | - | editor | - | viewer | + | space-role | + | Manager | + | Space Editor | + | Space Viewer | Scenario Outline: check the end of expiration of a space in group share Given group "sales" has been created And the administrator has added a user "Brian" to the group "sales" using the Graph API - And user "Alice" has shared a space "share space" with settings: - | shareWith | sales | - | shareType | 8 | - | role | | - | expireDate | 2042-03-25T23:59:59+0100 | + And user "Alice" has sent the following space share invitation: + | space | share space | + | sharee | sales | + | shareType | group | + | permissionsRole | | + | expireDate | 2042-03-25T23:59:59.000Z | When user "Alice" expires the group share of space "share space" for group "sales" Then the HTTP status code should be "200" And the user "Brian" should not have a space called "share space" Examples: - | space-role | - | manager | - | editor | - | viewer | + | space-role | + | Manager | + | Space Editor | + | Space Viewer | Scenario Outline: user cannot share the personal space to an other user - Given the administrator has assigned the role "" to user "Brian" using the Graph API - And user "Brian" shares a space "Brian Murphy" with settings: + Given the administrator has assigned the role "" to user "Brian" using the Graph API + When user "Brian" shares a space "Brian Murphy" with settings: | shareWith | Bob | | role | viewer | Then the HTTP status code should be "400" And the OCS status message should be "can not add members to personal spaces" And the user "Bob" should not have a space called "Brian Murphy" Examples: - | space-role | + | user-role | | Space Admin | | Admin | | User | @@ -454,7 +479,7 @@ Feature: Share spaces Scenario: user cannot share the personal space to a group Given group "sales" has been created And the administrator has added a user "Brian" to the group "sales" using the Graph API - And user "Alice" shares a space "Alice Hansen" with settings: + When user "Alice" shares a space "Alice Hansen" with settings: | shareWith | sales | | shareType | 8 | | role | manager | @@ -464,9 +489,11 @@ Feature: Share spaces Scenario: last space manager cannot change his role - Given user "Alice" has shared a space "share space" with settings: - | shareWith | Brian | - | role | manager | + Given user "Alice" has sent the following space share invitation: + | space | share space | + | sharee | Brian | + | shareType | user | + | permissionsRole | Manager | When user "Alice" updates the space "share space" with settings: | shareWith | Alice | | role | editor | From 8a91df10ad5f76a0c3a284ae7378c1cc646fec90 Mon Sep 17 00:00:00 2001 From: Prarup Gurung Date: Fri, 10 May 2024 15:13:57 +0545 Subject: [PATCH 2/4] shareSpacesViaLink.feature: Used sharingNG for sharing in given step --- .../shareSpacesViaLink.feature | 188 ++++++++++-------- 1 file changed, 104 insertions(+), 84 deletions(-) diff --git a/tests/acceptance/features/apiSpacesShares/shareSpacesViaLink.feature b/tests/acceptance/features/apiSpacesShares/shareSpacesViaLink.feature index da2a450c0..e5b8950d7 100644 --- a/tests/acceptance/features/apiSpacesShares/shareSpacesViaLink.feature +++ b/tests/acceptance/features/apiSpacesShares/shareSpacesViaLink.feature @@ -83,9 +83,11 @@ Feature: Share spaces via link @skipOnRevaMaster Scenario Outline: user without manager role cannot share a space to public via link - Given user "Alice" has shared a space "share space" with settings: - | shareWith | Brian | - | role | | + Given user "Alice" has sent the following space share invitation: + | space | share space | + | sharee | Brian | + | shareType | user | + | permissionsRole | | When user "Brian" creates a public link share of the space "share space" with settings: | permissions | 1 | Then the HTTP status code should be "403" @@ -93,15 +95,17 @@ Feature: Share spaces via link And the OCS status message should be "No share permission" And for user "Alice" the space "share space" should not contain the last created public link Examples: - | space-role | - | viewer | - | editor | + | space-role | + | Space Viewer | + | Space Editor | Scenario: user with manager role can share a space to public via link - Given user "Alice" has shared a space "share space" with settings: - | shareWith | Brian | - | role | manager | + Given user "Alice" has sent the following space share invitation: + | space | share space | + | sharee | Brian | + | shareType | user | + | permissionsRole | Manager | When user "Brian" creates a public link share of the space "share space" with settings: | permissions | 1 | | password | %public% | @@ -132,28 +136,30 @@ Feature: Share spaces via link Scenario Outline: space admin removes password of a public link share of a space (read/invite permission) Given using OCS API version "" - And user "Alice" has created a public link share of the space "share space" with settings: - | permissions | | - | password | %public% | + And using SharingNG + And user "Alice" has created the following space link share: + | space | share space | + | permissionsRole | view | + | password | %public% | When user "Alice" updates the last public link share using the sharing API with - | permissions | | - | password | | + | permissions | 1 | + | password | | Then the HTTP status code should be "200" And the OCS status code should be "" And the OCS status message should be "OK" Examples: - | ocs-api-version | ocs-status-code | permissions | - | 1 | 100 | 1 | - | 1 | 100 | 0 | - | 2 | 200 | 1 | - | 2 | 200 | 0 | + | ocs-api-version | ocs-status-code | + | 1 | 100 | + | 2 | 200 | Scenario Outline: space admin tries to remove password of a public link share of a space (various permission) Given using OCS API version "" - And user "Alice" has created a public link share of the space "share space" with settings: - | permissions | | - | password | %public% | + And using SharingNG + And user "Alice" has created the following space link share: + | space | share space | + | permissionsRole | | + | password | %public% | When user "Alice" updates the last public link share using the sharing API with | permissions | | | password | | @@ -161,20 +167,22 @@ Feature: Share spaces via link And the OCS status code should be "400" And the OCS status message should be "missing required password" Examples: - | ocs-api-version | permissions | http-status-code | - | 1 | 5 | 200 | - | 2 | 5 | 400 | - | 1 | 15 | 200 | - | 2 | 15 | 400 | - | 1 | 4 | 200 | - | 2 | 4 | 400 | + | ocs-api-version | permissions | http-status-code | permissions-role | + | 1 | 5 | 200 | upload | + | 2 | 5 | 400 | upload | + | 1 | 15 | 200 | edit | + | 2 | 15 | 400 | edit | + | 1 | 4 | 200 | createOnly | + | 2 | 4 | 400 | createOnly | Scenario Outline: space admin removes password of a public link share of a space (invite permission) Given using OCS API version "" - And user "Alice" has created a public link share of the space "share space" with settings: - | permissions | 1 | - | password | %public% | + And using SharingNG + And user "Alice" has created the following space link share: + | space | share space | + | permissionsRole | view | + | password | %public% | When user "Alice" updates the last public link share using the sharing API with | permissions | 0 | | password | | @@ -189,12 +197,16 @@ Feature: Share spaces via link Scenario Outline: space manager tries to remove password of a public link share of a space (read permission) Given using OCS API version "" - And user "Alice" has shared a space "share space" with settings: - | shareWith | Brian | - | role | manager | - And user "Brian" has created a public link share of the space "share space" with settings: - | permissions | 1 | - | password | %public% | + And using SharingNG + And user "Alice" has sent the following space share invitation: + | space | share space | + | sharee | Brian | + | shareType | user | + | permissionsRole | Manager | + And user "Brian" has created the following space link share: + | space | share space | + | permissionsRole | view | + | password | %public% | When user "Brian" updates the last public link share using the sharing API with | permissions | 1 | | password | | @@ -209,12 +221,16 @@ Feature: Share spaces via link Scenario Outline: space manager tries to remove password of a public link share of a space (various permission) Given using OCS API version "" - And user "Alice" has shared a space "share space" with settings: - | shareWith | Brian | - | role | manager | - And user "Brian" has created a public link share of the space "share space" with settings: - | permissions | | - | password | %public% | + And using SharingNG + And user "Alice" has sent the following space share invitation: + | space | share space | + | sharee | Brian | + | shareType | user | + | permissionsRole | Manager | + And user "Brian" has created the following space link share: + | space | share space | + | permissionsRole | | + | password | %public% | When user "Brian" updates the last public link share using the sharing API with | permissions | | | password | | @@ -222,23 +238,27 @@ Feature: Share spaces via link And the OCS status code should be "400" And the OCS status message should be "missing required password" Examples: - | ocs-api-version | permissions | http-status-code | - | 1 | 5 | 200 | - | 2 | 5 | 400 | - | 1 | 15 | 200 | - | 2 | 15 | 400 | - | 1 | 4 | 200 | - | 2 | 4 | 400 | + | ocs-api-version | permissions | http-status-code | permissions-role | + | 1 | 5 | 200 | upload | + | 2 | 5 | 400 | upload | + | 1 | 15 | 200 | edit | + | 2 | 15 | 400 | edit | + | 1 | 4 | 200 | createOnly | + | 2 | 4 | 400 | createOnly | Scenario Outline: space manager removes password of a public link share of a space (invite permission) Given using OCS API version "" - And user "Alice" has shared a space "share space" with settings: - | shareWith | Brian | - | role | manager | - And user "Brian" has created a public link share of the space "share space" with settings: - | permissions | 1 | - | password | %public% | + And using SharingNG + And user "Alice" has sent the following space share invitation: + | space | share space | + | sharee | Brian | + | shareType | user | + | permissionsRole | Manager | + And user "Brian" has created the following space link share: + | space | share space | + | permissionsRole | view | + | password | %public% | When user "Brian" updates the last public link share using the sharing API with | permissions | 0 | | password | | @@ -253,12 +273,16 @@ Feature: Share spaces via link Scenario Outline: space member tries to remove the password of a public link share of a space Given using OCS API version "" - And user "Alice" has shared a space "share space" with settings: - | shareWith | Brian | - | role | | - And user "Alice" has created a public link share of the space "share space" with settings: - | permissions | | - | password | %public% | + And using SharingNG + And user "Alice" has sent the following space share invitation: + | space | share space | + | sharee | Brian | + | shareType | user | + | permissionsRole | | + And user "Alice" has created the following space link share: + | space | share space | + | permissionsRole | | + | password | %public% | When user "Brian" updates the last public link share using the sharing API with | permissions | | | password | | @@ -266,24 +290,20 @@ Feature: Share spaces via link And the OCS status code should be "997" And the OCS status message should be "missing permissions to update share" Examples: - | ocs-api-version | http-status-code | space-role | permissions | - | 1 | 200 | viewer | 1 | - | 2 | 401 | viewer | 1 | - | 1 | 200 | viewer | 5 | - | 2 | 401 | viewer | 5 | - | 1 | 200 | viewer | 15 | - | 2 | 401 | viewer | 15 | - | 1 | 200 | viewer | 4 | - | 2 | 401 | viewer | 4 | - | 1 | 200 | viewer | 0 | - | 2 | 401 | viewer | 0 | - | 1 | 200 | editor | 1 | - | 2 | 401 | editor | 1 | - | 1 | 200 | editor | 5 | - | 2 | 401 | editor | 5 | - | 1 | 200 | editor | 15 | - | 2 | 401 | editor | 15 | - | 1 | 200 | editor | 4 | - | 2 | 401 | editor | 4 | - | 1 | 200 | editor | 0 | - | 2 | 401 | editor | 0 | + | ocs-api-version | http-status-code | space-role | permissions | permissions-role | + | 1 | 200 | Space Viewer | 1 | view | + | 2 | 401 | Space Viewer | 1 | view | + | 1 | 200 | Space Viewer | 5 | upload | + | 2 | 401 | Space Viewer | 5 | upload | + | 1 | 200 | Space Viewer | 15 | edit | + | 2 | 401 | Space Viewer | 15 | edit | + | 1 | 200 | Space Viewer | 4 | createOnly | + | 2 | 401 | Space Viewer | 4 | createOnly | + | 1 | 200 | Space Editor | 1 | view | + | 2 | 401 | Space Editor | 1 | view | + | 1 | 200 | Space Editor | 5 | upload | + | 2 | 401 | Space Editor | 5 | upload | + | 1 | 200 | Space Editor | 15 | edit | + | 2 | 401 | Space Editor | 15 | edit | + | 1 | 200 | Space Editor | 4 | createOnly | + | 2 | 401 | Space Editor | 4 | createOnly | From f2f2439284007c5b7980ffcff527f0c9e82ed5e5 Mon Sep 17 00:00:00 2001 From: Prarup Gurung Date: Mon, 13 May 2024 16:28:53 +0545 Subject: [PATCH 3/4] shareSubItemOfSpace.feature: Used sharingNG for sharing in given step --- ...ected-failures-localAPI-on-OCIS-storage.md | 2 +- .../shareSubItemOfSpace.feature | 114 ++++++++++-------- .../acceptance/features/bootstrap/Sharing.php | 3 +- .../features/bootstrap/SpacesContext.php | 54 +++++++-- 4 files changed, 114 insertions(+), 59 deletions(-) diff --git a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md index 07b4e21fe..d1592cadc 100644 --- a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md @@ -294,7 +294,7 @@ The expected failures in this file are from features in the owncloud/ocis repo. ### [500 when deleting share role](https://github.com/owncloud/ocis/issues/8747) -- [apiSpacesShares/shareSubItemOfSpace.feature:147](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpace.feature#L147) +- [apiSpacesShares/shareSubItemOfSpace.feature:159](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpace.feature#L159) - Note: always have an empty line at the end of this file. The bash script that processes this file requires that the last line has a newline on the end. diff --git a/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpace.feature b/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpace.feature index 7eb6b4578..fc49f3b9a 100644 --- a/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpace.feature +++ b/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpace.feature @@ -41,9 +41,11 @@ Feature: Share a file or folder that is inside a space Scenario Outline: user participant of the project space with manager role can share an entity to another user - Given user "Alice" has shared a space "share sub-item" with settings: - | shareWith | Brian | - | role | manager | + Given user "Alice" has sent the following space share invitation: + | space | share sub-item | + | sharee | Brian | + | shareType | user | + | permissionsRole | Manager | When user "Brian" creates a share inside of space "share sub-item" with settings: | path | | | shareWith | Bob | @@ -64,9 +66,11 @@ Feature: Share a file or folder that is inside a space @skipOnRevaMaster Scenario Outline: user participant of the project space without space manager role cannot share an entity to another user - Given user "Alice" has shared a space "share sub-item" with settings: - | shareWith | Brian | - | role | | + Given user "Alice" has sent the following space share invitation: + | space | share sub-item | + | sharee | Brian | + | shareType | user | + | permissionsRole | | When user "Brian" creates a share inside of space "share sub-item" with settings: | path | | | shareWith | Bob | @@ -75,17 +79,19 @@ Feature: Share a file or folder that is inside a space And the OCS status code should be "403" And the OCS status message should be "No share permission" Examples: - | resource | space-role | - | folder | editor | - | file.txt | editor | - | file.txt | viewer | - | folder | viewer | + | resource | space-role | + | folder | Space Editor | + | file.txt | Space Editor | + | file.txt | Space Viewer | + | folder | Space Viewer | Scenario Outline: user participant of the project space can see the created resources share - Given user "Alice" has shared a space "share sub-item" with settings: - | shareWith | Brian | - | role | | + Given user "Alice" has sent the following space share invitation: + | space | share sub-item | + | sharee | Brian | + | shareType | user | + | permissionsRole | | When user "Alice" creates a share inside of space "share sub-item" with settings: | path | file.txt | | shareWith | Bob | @@ -93,10 +99,10 @@ Feature: Share a file or folder that is inside a space Then for user "Alice" the space "share sub-item" should contain the last created share of the file "file.txt" And for user "Brian" the space "share sub-item" should contain the last created share of the file "file.txt" Examples: - | space-role | - | editor | - | viewer | - | manager | + | space-role | + | Space Editor | + | Space Viewer | + | Manager | Scenario: user shares the folder to the group @@ -117,11 +123,14 @@ Feature: Share a file or folder that is inside a space Scenario: user changes the expiration date - Given user "Alice" has created a share inside of space "share sub-item" with settings: - | path | folder | - | shareWith | Brian | - | role | viewer | - | expireDate | 2042-01-01T23:59:59+0100 | + Given using SharingNG + And user "Alice" has sent the following resource share invitation: + | resource | folder | + | space | share sub-item | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + | expireDate | 2042-01-01T23:59:59.000Z | When user "Alice" changes the last share with settings: | expireDate | 2044-01-01T23:59:59.999+01:00 | | role | viewer | @@ -131,11 +140,14 @@ Feature: Share a file or folder that is inside a space Scenario: user deletes the expiration date - Given user "Alice" has created a share inside of space "share sub-item" with settings: - | path | folder | - | shareWith | Brian | - | role | viewer | - | expireDate | 2042-01-01T23:59:59+0100 | + Given using SharingNG + And user "Alice" has sent the following resource share invitation: + | resource | folder | + | space | share sub-item | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + | expireDate | 2042-01-01T23:59:59.000Z | When user "Alice" changes the last share with settings: | expireDate | | | role | viewer | @@ -143,39 +155,47 @@ Feature: Share a file or folder that is inside a space And the information about the last share for user "Brian" should include | expiration | | - + @issue-8747 Scenario: user cannot delete share role Given using OCS API version "" - And user "Alice" has created a share inside of space "share sub-item" with settings: - | path | folder | - | shareWith | Brian | - | role | viewer | - | expireDate | 2042-01-01T23:59:59+0100 | + And using SharingNG + And user "Alice" has sent the following resource share invitation: + | resource | folder | + | space | share sub-item | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + | expireDate | 2042-01-01T23:59:59.000Z | When user "Alice" changes the last share with settings: | role | | Then the HTTP status code should be "400" Scenario: check the end of expiration date in user share - Given user "Alice" has created a share inside of space "share sub-item" with settings: - | path | folder | - | shareWith | Brian | - | role | viewer | - | expireDate | 2042-01-01T23:59:59+0100 | - When user "Alice" expires the last share + Given using SharingNG + And user "Alice" has sent the following resource share invitation: + | resource | folder | + | space | share sub-item | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + | expireDate | 2042-01-01T23:59:59.000Z | + When user "Alice" expires the last share of resource "folder" inside of the space "share sub-item" Then the HTTP status code should be "200" And as "Brian" folder "Shares/folder" should not exist @issue-5823 Scenario: check the end of expiration date in group share Given group "sales" has been created + And using SharingNG And the administrator has added a user "Brian" to the group "sales" using the Graph API - And user "Alice" has created a share inside of space "share sub-item" with settings: - | path | folder | - | shareWith | sales | - | shareType | 1 | - | role | viewer | - | expireDate | 2042-01-01T23:59:59+0100 | - When user "Alice" expires the last share + And user "Alice" has sent the following resource share invitation: + | resource | folder | + | space | share sub-item | + | sharee | sales | + | shareType | group | + | permissionsRole | Viewer | + | expireDate | 2042-01-01T23:59:59.000Z | + When user "Alice" expires the last share of resource "folder" inside of the space "share sub-item" Then the HTTP status code should be "200" And as "Brian" folder "Shares/folder" should not exist diff --git a/tests/acceptance/features/bootstrap/Sharing.php b/tests/acceptance/features/bootstrap/Sharing.php index 9d25f8b08..32ce38d1e 100755 --- a/tests/acceptance/features/bootstrap/Sharing.php +++ b/tests/acceptance/features/bootstrap/Sharing.php @@ -1934,10 +1934,11 @@ trait Sharing { * @param TableNode $table * * @return void + * @throws Exception */ public function userGetsTheLastShareSharedWithHimUsingTheSharingApi(string $user, TableNode $table):void { $user = $this->getActualUsername($user); - $shareId = (string) $this->getLastCreatedPublicShare()->id; + $shareId = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedUserGroupShareID() : $this->getLastCreatedUserGroupShareId(); $response = $this->getShareData($user, $shareId); $this->checkFields($user, $table, $response); } diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index 26ec04968..cbc8e7986 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -2244,7 +2244,8 @@ class SpacesContext implements Context { $this->featureContext->getStepLineRef() ); $responseXml = $this->featureContext->getResponseXml($response, __METHOD__); - $this->featureContext->addToCreatedPublicShares($responseXml->data); + $sharer = (string) $responseXml->data->uid_owner; + $this->featureContext->addToCreatedUserGroupshares($sharer, $responseXml->data); return $response; } @@ -2314,7 +2315,7 @@ class SpacesContext implements Context { * @throws JsonException */ public function updateSharedResource(string $user, array $rows):ResponseInterface { - $shareId = (string) $this->featureContext->getLastCreatedPublicShare()->id; + $shareId = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedUserGroupShareID() : $this->featureContext->getLastCreatedUserGroupShareId(); $fullUrl = $this->baseUrl . $this->ocsApiUrl . '/' . $shareId; return HttpRequestHelper::sendRequest( $fullUrl, @@ -2328,17 +2329,44 @@ class SpacesContext implements Context { } /** - * @When /^user "([^"]*)" expires the last share$/ + * @When user :user expires the last share of resource :resource inside of the space :spaceName * * @param string $user + * @param string $resource + * @param string $spaceName * * @return void + * @throws GuzzleException|JsonException */ - public function userExpiresLastResourceShare(string $user): void { + public function userExpiresTheLastShareOfResourceInsideOfTheSpace(string $user, string $resource, string $spaceName): void { $dateTime = new DateTime('yesterday'); $rows['expireDate'] = $dateTime->format('Y-m-d\\TH:i:sP'); - $rows['permissions'] = (string) $this->featureContext->getLastCreatedPublicShare()->permissions; - $this->featureContext->setResponse($this->updateSharedResource($user, $rows)); + if ($this->featureContext->isUsingSharingNG()) { + if (!\in_array($spaceName, ['Personal', 'Shares'])) { + $space = $this->getSpaceByName($user, $spaceName); + $itemId = $this->getResourceId($user, $spaceName, $resource); + } else { + $space = $this->getCreatedSpace($spaceName); + $itemId = $space['fileId']; + } + $body['expirationDateTime'] = $rows['expireDate']; + $permissionID = $this->featureContext->shareNgGetLastCreatedUserGroupShareID(); + $this->featureContext->setResponse( + GraphHelper::updateShare( + $this->featureContext->getBaseUrl(), + $this->featureContext->getStepLineRef(), + $user, + $this->featureContext->getPasswordForUser($user), + $space["id"], + $itemId, + \json_encode($body), + $permissionID + ) + ); + } else { + $rows['permissions'] = (string)$this->featureContext->getLastCreatedUserGroupShare()->permissions; + $this->featureContext->setResponse($this->updateSharedResource($user, $rows)); + } } /** @@ -3410,12 +3438,12 @@ class SpacesContext implements Context { /** * @Then /^for user "([^"]*)" the space "([^"]*)" should (not|)\s?contain the last created public link$/ - * @Then /^for user "([^"]*)" the space "([^"]*)" should (not|)\s?contain the last created public link of the file "([^"]*)"$/ - * @Then /^for user "([^"]*)" the space "([^"]*)" should (not|)\s?contain the last created share of the file "([^"]*)"$/ + * @Then /^for user "([^"]*)" the space "([^"]*)" should (not|)\s?contain the last created (public link|share) of the file "([^"]*)"$/ * * @param string $user * @param string $spaceName * @param string $shouldOrNot (not|) + * @param string $shareType * @param string $fileName * * @return void @@ -3426,6 +3454,7 @@ class SpacesContext implements Context { string $user, string $spaceName, string $shouldOrNot, + string $shareType = 'public link', string $fileName = '' ): void { if (!empty($fileName)) { @@ -3449,8 +3478,13 @@ class SpacesContext implements Context { if ($should) { Assert::assertNotEmpty($responseArray, __METHOD__ . ' Response should contain a link, but it is empty'); foreach ($responseArray as $element) { - $expectedLinkId = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedLinkShareID() : (string) $this->featureContext->getLastCreatedPublicShare()->id; - Assert::assertEquals($element["id"], $expectedLinkId, "link IDs are different"); + if ($shareType === 'public link') { + $expectedLinkId = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedLinkShareID() : (string) $this->featureContext->getLastCreatedPublicShare()->id; + Assert::assertEquals($element["id"], $expectedLinkId, "link IDs are different"); + } else { + $expectedShareId = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedUserGroupShareID() : (string)$this->featureContext->getLastCreatedUserGroupShareId(); + Assert::assertEquals($element["id"], $expectedShareId, "share IDs are different"); + } } } else { Assert::assertEmpty($responseArray, __METHOD__ . ' Response should be empty'); From 8f659e302462862791441a73c820e72b88b425d3 Mon Sep 17 00:00:00 2001 From: Prarup Gurung Date: Tue, 14 May 2024 14:22:07 +0545 Subject: [PATCH 4/4] Addressed reviews --- tests/acceptance/features/bootstrap/SpacesContext.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index cbc8e7986..0ab0da5ee 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -2342,13 +2342,8 @@ class SpacesContext implements Context { $dateTime = new DateTime('yesterday'); $rows['expireDate'] = $dateTime->format('Y-m-d\\TH:i:sP'); if ($this->featureContext->isUsingSharingNG()) { - if (!\in_array($spaceName, ['Personal', 'Shares'])) { - $space = $this->getSpaceByName($user, $spaceName); - $itemId = $this->getResourceId($user, $spaceName, $resource); - } else { - $space = $this->getCreatedSpace($spaceName); - $itemId = $space['fileId']; - } + $space = $this->getSpaceByName($user, $spaceName); + $itemId = $this->getResourceId($user, $spaceName, $resource); $body['expirationDateTime'] = $rows['expireDate']; $permissionID = $this->featureContext->shareNgGetLastCreatedUserGroupShareID(); $this->featureContext->setResponse(