Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests-only][full-ci] added test to reshare resources to other users SharingNg #8275

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 125 additions & 0 deletions tests/acceptance/features/apiSharingNg/reshare.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
Feature: Reshare a share invitation
As a user
I want to be able to reshare the share invitations to other users
So that they can have access to it

https://owncloud.dev/libre-graph-api/#/drives.permissions/Invite

Background:
Given these users have been created with default attributes and without skeleton files:
| username |
| Alice |
| Brian |
| Carol |


Scenario Outline: reshare a file to a user with different roles
Given user "Alice" has uploaded file with content "to share" to "/textfile1.txt"
And user "Alice" has sent the following share invitation:
| resourceType | file |
| resource | textfile1.txt |
| space | Personal |
| sharee | Brian |
| shareType | user |
| permissionsRole | <permissions-role> |
When user "Brian" sends the following share invitation using the Graph API:
| resourceType | file |
| resource | textfile1.txt |
| space | Shares |
| sharee | Carol |
| shareType | user |
| permissionsRole | <reshare-permissions-role> |
Then the HTTP status code should be "200"
And for user "Carol" the space Shares should contain these entries:
| textfile1.txt |
Examples:
| permissions-role | reshare-permissions-role |
| Viewer | Viewer |
| File Editor | Viewer |
| File Editor | File Editor |
PrajwolAmatya marked this conversation as resolved.
Show resolved Hide resolved


Scenario Outline: reshare a folder to a user with different roles
Given user "Alice" has created folder "FolderToShare"
And user "Alice" has sent the following share invitation:
| resourceType | folder |
| resource | FolderToShare |
| space | Personal |
| sharee | Brian |
| shareType | user |
| permissionsRole | <permissions-role> |
When user "Brian" sends the following share invitation using the Graph API:
| resourceType | folder |
| resource | FolderToShare |
| space | Shares |
| sharee | Carol |
| shareType | user |
| permissionsRole | <reshare-permissions-role> |
Then the HTTP status code should be "200"
And for user "Carol" the space Shares should contain these entries:
| FolderToShare |
Examples:
| permissions-role | reshare-permissions-role |
| Viewer | Viewer |
| Editor | Viewer |
| Editor | Editor |
| Editor | Uploader |
PrajwolAmatya marked this conversation as resolved.
Show resolved Hide resolved


Scenario Outline: reshare a file inside project space to a user with different roles
Given using spaces DAV path
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Alice" has created a space "NewSpace" with the default quota using the Graph API
And user "Alice" has uploaded a file inside space "NewSpace" with content "to share" to "textfile1.txt"
And user "Alice" has sent the following share invitation:
| resourceType | file |
| resource | textfile1.txt |
| space | NewSpace |
| sharee | Brian |
| shareType | user |
| permissionsRole | <permissions-role> |
When user "Brian" sends the following share invitation using the Graph API:
| resourceType | file |
| resource | textfile1.txt |
| space | Shares |
| sharee | Carol |
| shareType | user |
| permissionsRole | <reshare-permissions-role> |
Then the HTTP status code should be "200"
And for user "Carol" the space Shares should contain these entries:
| textfile1.txt |
Examples:
| permissions-role | reshare-permissions-role |
| Viewer | Viewer |
| File Editor | Viewer |
| File Editor | File Editor |


Scenario Outline: reshare a folder inside project space to a user with different roles
Given using spaces DAV path
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Alice" has created a space "NewSpace" with the default quota using the Graph API
And user "Alice" has created a folder "FolderToShare" in space "NewSpace"
And user "Alice" has sent the following share invitation:
| resourceType | folder |
| resource | FolderToShare |
| space | NewSpace |
| sharee | Brian |
| shareType | user |
| permissionsRole | <permissions-role> |
When user "Brian" sends the following share invitation using the Graph API:
| resourceType | folder |
| resource | FolderToShare |
| space | Shares |
| sharee | Carol |
| shareType | user |
| permissionsRole | <reshare-permissions-role> |
Then the HTTP status code should be "200"
And for user "Carol" the space Shares should contain these entries:
| FolderToShare |
Examples:
| permissions-role | reshare-permissions-role |
| Viewer | Viewer |
| Editor | Viewer |
| Editor | Editor |
| Editor | Uploader |
17 changes: 14 additions & 3 deletions tests/acceptance/features/bootstrap/SharingNgContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,20 @@ public function sendShareInvitation(string $user, TableNode $table): ResponseInt
$rows = $table->getRowsHash();
$spaceId = ($this->spacesContext->getSpaceByName($user, $rows['space']))["id"];

$itemId = ($rows['resourceType'] === 'folder')
? $this->spacesContext->getResourceId($user, $rows['space'], $rows['resource'])
: $this->spacesContext->getFileId($user, $rows['space'], $rows['resource']);
// for resharing a resource, "item-id" in API endpoint takes shareMountId
if ($rows['space'] === 'Shares') {
$itemId = GraphHelper::getShareMountId(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$user,
$this->featureContext->getPasswordForUser($user),
$rows['resource']
);
} else {
$itemId = ($rows['resourceType'] === 'folder')
? $this->spacesContext->getResourceId($user, $rows['space'], $rows['resource'])
: $this->spacesContext->getFileId($user, $rows['space'], $rows['resource']);
}

$sharees = array_map('trim', explode(',', $rows['sharee']));
$shareTypes = array_map('trim', explode(',', $rows['shareType']));
Expand Down