diff --git a/tests/acceptance/features/apiSharingNg/sharedByMe.feature b/tests/acceptance/features/apiSharingNg/sharedByMe.feature index ecdd5a34eea..427f9e17f6e 100644 --- a/tests/acceptance/features/apiSharingNg/sharedByMe.feature +++ b/tests/acceptance/features/apiSharingNg/sharedByMe.feature @@ -1533,4 +1533,82 @@ Feature: resources shared by user } } } - """ \ No newline at end of file + """ + + + @issue-8131 + Scenario Outline: user updates role of a share + Given user "Alice" has uploaded file with content "to share" to "/textfile1.txt" + And user "Alice" has created folder "FolderToShare" + And user "Alice" has sent the following share invitation: + | resource | | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | | + When user "Alice" updates the last share with the following using the Graph API: + | updatedRole | | + | space | Personal | + | resource | | + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": [ + "grantedToV2", + "id", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": [ + "user" + ], + "properties":{ + "user": { + "type": "object", + "required": [ + "displayName", + "id" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["Brian Murphy"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + } + } + } + } + }, + "id": { + "type": "string", + "pattern": "^%permissions_id_pattern%$" + }, + "roles": { + "type": "array", + "items": [ + { + "type": "string", + "pattern": "^%role_id_pattern%$" + } + ] + } + } + } + """ + Examples: + | permissions-role | path | updated-role | + | Viewer | textfile1.txt | File Editor | + | File Editor | textfile1.txt | Viewer | + | Viewer | FolderToShare | Uploader | + | Viewer | FolderToShare | Editor | + | Editor | FolderToShare | Viewer | + | Editor | FolderToShare | Uploader | + | Uploader | FolderToShare | Editor | + | Uploader | FolderToShare | Viewer | \ No newline at end of file diff --git a/tests/acceptance/features/bootstrap/SharingNgContext.php b/tests/acceptance/features/bootstrap/SharingNgContext.php index da74b956074..dc254cc6fd6 100644 --- a/tests/acceptance/features/bootstrap/SharingNgContext.php +++ b/tests/acceptance/features/bootstrap/SharingNgContext.php @@ -337,6 +337,12 @@ public function updateShare(string $user, TableNode $body, string $permissionID "type" => $bodyRows['permissionsRole'] ] ]; + } elseif (\array_key_exists('updatedRole', $bodyRows)) { + $body = [ + "roles" => [ + GraphHelper::getPermissionsRoleIdByName($bodyRows['updatedRole']) + ] + ]; } elseif (\array_key_exists('permissionsRole', $bodyRows)) { $body = [ "link" => [