diff --git a/tests/acceptance/bootstrap/SpacesContext.php b/tests/acceptance/bootstrap/SpacesContext.php index 826dddf2d9..4db2ad2095 100644 --- a/tests/acceptance/bootstrap/SpacesContext.php +++ b/tests/acceptance/bootstrap/SpacesContext.php @@ -30,7 +30,6 @@ use Psr\Http\Message\ResponseInterface; use TestHelpers\HttpRequestHelper; use TestHelpers\WebDavHelper; use TestHelpers\GraphHelper; -use TestHelpers\OcHelper; use TestHelpers\BehatHelper; use TestHelpers\WaitHelper; use Behat\Step\Given; @@ -249,8 +248,7 @@ class SpacesContext implements Context { $this->featureContext->getStepLineRef(), $user, $this->featureContext->getPasswordForUser($user), - $this->featureContext->getAttributeOfCreatedUser($user, 'id'), - $this->featureContext->getStepLineRef() + $this->featureContext->getAttributeOfCreatedUser($user, 'id') ); $space = json_decode($resource->getBody()->getContents(), true); diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml index 1cd13bfa88..d226cf53ba 100644 --- a/tests/acceptance/config/behat.yml +++ b/tests/acceptance/config/behat.yml @@ -201,6 +201,7 @@ default: - NotificationContext: - GuestLinkContext: - OcConfigContext: + - WebDavPropertiesContext: apiAntivirus: paths: diff --git a/tests/acceptance/features/apiGuestLink/guestLinkInvitation.feature b/tests/acceptance/features/apiGuestLink/guestLinkInvitation.feature index bba9358777..02f8425981 100644 --- a/tests/acceptance/features/apiGuestLink/guestLinkInvitation.feature +++ b/tests/acceptance/features/apiGuestLink/guestLinkInvitation.feature @@ -136,6 +136,83 @@ Feature: share a resource with a guest via email address } """ + + Scenario: sharer lists the permissions of a resource shared with a guest + Given user "Alice" has sent the following resource share invitation: + | resource | textfile.txt | + | space | Personal | + | sharee | guest@example.org | + | shareType | guest | + | permissionsRole | Viewer | + When user "Alice" gets permissions list for file "textfile.txt" of the space "Personal" using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": ["value"], + "properties": { + "value": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": ["id", "roles", "grantedToV2", "invitation"], + "properties": { + "id": { + "type": "string", + "pattern": "^%permissions_id_pattern%$" + }, + "roles": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { "const": "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" } + }, + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["@libre.graph.userType", "displayName", "id"], + "properties": { + "@libre.graph.userType": { "const": "Guest" }, + "displayName": { "const": "guest@example.org" }, + "id": { "const": "guest@example.org" } + } + } + } + }, + "invitation": { + "type": "object", + "required": ["invitedBy"], + "properties": { + "invitedBy": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["@libre.graph.userType", "displayName", "id"], + "properties": { + "@libre.graph.userType": { "const": "Member" }, + "displayName": { "const": "Alice Hansen" }, + "id": { "type": "string", "pattern": "^%user_id_pattern%$" } + } + } + } + } + } + } + } + } + } + } + } + """ + @email Scenario: guest receives an email with a guest link When user "Alice" sends the following resource share invitation using the Graph API: diff --git a/tests/acceptance/features/apiGuestLink/guestLinkShareTypes.feature b/tests/acceptance/features/apiGuestLink/guestLinkShareTypes.feature new file mode 100644 index 0000000000..bb05475075 --- /dev/null +++ b/tests/acceptance/features/apiGuestLink/guestLinkShareTypes.feature @@ -0,0 +1,77 @@ +@email +Feature: share types of resources shared with a guest + As a user + I want to see which of my resources are shared with a guest + So that I know who has access to them + + Background: + Given using SharingNG + And user "Alice" has been created with default attributes + And user "Alice" has created folder "parent" + And user "Alice" has created folder "parent/folderToShare" + And user "Alice" has uploaded file with content "to share" to "parent/textfile.txt" + + + Scenario Outline: check the share-types property of a resource shared with a guest + Given user "Alice" has sent the following resource share invitation: + | resource | | + | space | Personal | + | sharee | guest@example.org | + | shareType | guest | + | permissionsRole | Viewer | + When user "Alice" gets the following properties of resource "" inside space "Personal" using the WebDAV API + | propertyName | + | oc:share-types | + Then the HTTP status code should be "207" + And the response should contain a share-types property with + | 4 | + Examples: + | resource | + | parent/textfile.txt | + | parent/folderToShare | + + + Scenario: check the share-types property of a resource shared with a user, a group and a guest + Given user "Brian" has been created with default attributes + And user "Alice" has sent the following resource share invitation: + | resource | parent/textfile.txt | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + And group "grp1" has been created + And user "Alice" has sent the following resource share invitation: + | resource | parent/textfile.txt | + | space | Personal | + | sharee | grp1 | + | shareType | group | + | permissionsRole | Viewer | + And user "Alice" has sent the following resource share invitation: + | resource | parent/textfile.txt | + | space | Personal | + | sharee | guest@example.org | + | shareType | guest | + | permissionsRole | Viewer | + When user "Alice" gets the following properties of resource "parent/textfile.txt" inside space "Personal" using the WebDAV API + | propertyName | + | oc:share-types | + Then the HTTP status code should be "207" + And the response should contain a share-types property with + | 0 | + | 1 | + | 4 | + + + Scenario: check the share-types property of a resource after the guest share is removed + Given user "Alice" has sent the following resource share invitation: + | resource | parent/textfile.txt | + | space | Personal | + | sharee | guest@example.org | + | shareType | guest | + | permissionsRole | Viewer | + And user "Alice" has removed the access of guest "guest@example.org" from resource "parent/textfile.txt" of space "Personal" + When user "Alice" gets the following properties of resource "parent/textfile.txt" inside space "Personal" using the WebDAV API + | propertyName | + | oc:share-types | + Then the HTTP status code should be "207" + And the response should contain an empty property "oc:share-types"