From 5a89c3605f51e2f4d9b116514533acf438a9dc4c Mon Sep 17 00:00:00 2001 From: Viktor Scharf Date: Wed, 21 Feb 2024 11:14:58 +0100 Subject: [PATCH] [test-only] share items with share permission if resharing is disabled (#8461) * share item with share permission if resharing is disabled * php style fix * change error message --- .../shareSubItemOfSpace.feature | 47 +++++++++++++++++++ .../features/bootstrap/SpacesContext.php | 5 ++ 2 files changed, 52 insertions(+) diff --git a/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpace.feature b/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpace.feature index dc3094770a..1f6540a3b7 100644 --- a/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpace.feature +++ b/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpace.feature @@ -165,3 +165,50 @@ Feature: Share a file or folder that is inside a space When user "Alice" expires the last share Then the HTTP status code should be "200" And as "Brian" folder "Shares/folder" should not exist + + @issue-enterprise-6423 @env-config + Scenario Outline: user cannot share items in the project space with share permission if resharing is denied + Given the config "OCIS_ENABLE_RESHARING" has been set to "false" + And user "Alice" has shared a space "share sub-item" with settings: + | shareWith | Brian | + | role | viewer | + When user "Alice" creates a share inside of space "share sub-item" with settings: + | path | folder | + | shareWith | Bob | + | role | custom | + | permissions | | + Then the HTTP status code should be "400" + And the OCS status code should be "400" + And the OCS status message should be "resharing not supported" + Examples: + | permissions | description | + | 19 | view + edit | + | 21 | view + create | + | 23 | view + create + edit | + | 25 | view + delete | + | 27 | view + edit + delete | + | 29 | view + create + delete | + | 31 | view + create + edit +delete | + + + @issue-enterprise-6423 @env-config + Scenario Outline: user cannot share items in the personal space with share permission if resharing is denied + Given the config "OCIS_ENABLE_RESHARING" has been set to "false" + And user "Alice" has uploaded file with content "some content" to "/file.txt" + When user "Alice" creates a share inside of space "Alice Hansen" with settings: + | path | file.txt | + | shareWith | Bob | + | role | custom | + | permissions | | + Then the HTTP status code should be "400" + And the OCS status code should be "400" + And the OCS status message should be "resharing not supported" + Examples: + | permissions | description | + | 19 | view + edit | + | 21 | view + create | + | 23 | view + create + edit | + | 25 | view + delete | + | 27 | view + edit + delete | + | 29 | view + create + delete | + | 31 | view + create + edit +delete | diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index 5e61a12b0d..6ce5bd0b2d 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -2231,6 +2231,11 @@ class SpacesContext implements Context { "role" => $rows["role"] ]; + // share with custom permission + if (isset($rows["permissions"])) { + $body["permissions"] = $rows["permissions"]; + } + $fullUrl = $this->baseUrl . $this->ocsApiUrl; $response = $this->sendPostRequestToUrl( $fullUrl,