Skip to content

Commit

Permalink
use displayname of permissions role in steps
Browse files Browse the repository at this point in the history
Signed-off-by: prashant-gurung899 <[email protected]>
  • Loading branch information
prashant-gurung899 committed Jan 14, 2025
1 parent f035740 commit 718ffda
Show file tree
Hide file tree
Showing 40 changed files with 494 additions and 475 deletions.
17 changes: 17 additions & 0 deletions tests/acceptance/TestHelpers/GraphHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2470,4 +2470,21 @@ public static function getAllUsers(
self::getRequestHeaders()
);
}

/**
* @param string $role
*
* @return string
*/
public static function mapRole(string $role): string {
$roleMappings = [
'View' => 'view',
'Internal' => 'internal',
'Edit' => 'edit',
'Upload' => 'upload',
'File Drop' => 'createOnly',
'Secure View' => 'blocksDownload',
];
return $roleMappings[$role] ?? $role;
}
}
6 changes: 4 additions & 2 deletions tests/acceptance/bootstrap/SharingNgContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,10 @@ public function createLinkShare(string $user, TableNode $body): ResponseInterfac
$bodyRows['expirationDateTime'] = \array_key_exists('expirationDateTime', $bodyRows)
? \date('Y-m-d', \strtotime($bodyRows['expirationDateTime'])) . 'T14:00:00.000Z' : null;
$bodyRows['password'] = $bodyRows['password'] ?? null;

$type = GraphHelper::mapRole($bodyRows['permissionsRole']);
$body = [
'type' => $bodyRows['permissionsRole'],
'type' => $type,
"@libre.graph.quickLink" => filter_var($bodyRows['quickLink'], FILTER_VALIDATE_BOOLEAN),
'displayName' => $bodyRows['displayName'],
'expirationDateTime' => $bodyRows['expirationDateTime'],
Expand Down Expand Up @@ -842,7 +844,7 @@ public function updateLinkShare(string $user, TableNode $body, string $permissi
$body = [];

if (\array_key_exists('permissionsRole', $bodyRows)) {
$body['link']['type'] = $bodyRows['permissionsRole'];
$body['link']['type'] = GraphHelper::mapRole($bodyRows['permissionsRole']);
}

if (\array_key_exists('expirationDateTime', $bodyRows)) {
Expand Down
24 changes: 12 additions & 12 deletions tests/acceptance/features/apiActivities/shareActivities.feature
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ Feature: check share activity
Given user "Alice" has created the following resource link share:
| resource | textfile.txt |
| space | Personal |
| permissionsRole | view |
| permissionsRole | View |
| password | %public% |
When user "Alice" lists the activities of file "textfile.txt" from space "Personal" using the Graph API
Then the HTTP status code should be "200"
Expand Down Expand Up @@ -378,7 +378,7 @@ Feature: check share activity
Given user "Alice" has created the following resource link share:
| resource | textfile.txt |
| space | Personal |
| permissionsRole | view |
| permissionsRole | View |
| password | %public% |
And user "Alice" has removed the last link share of file "textfile.txt" from space "Personal"
When user "Alice" lists the activities of file "textfile.txt" from space "Personal" using the Graph API
Expand Down Expand Up @@ -1071,7 +1071,7 @@ Feature: check share activity
| password | %public% |
And user "Alice" has updated the last resource link share with
| space | new-space |
| permissionsRole | edit |
| permissionsRole | Edit |
| expirationDateTime | 2200-07-15T14:00:00.000Z |
And user "Alice" has set the following password for the last link share:
| resource | |
Expand Down Expand Up @@ -1543,12 +1543,12 @@ Feature: check share activity
And user "Alice" has created the following resource link share:
| resource | textfile.txt |
| space | new-space |
| permissionsRole | view |
| permissionsRole | View |
| password | %public% |
And user "Alice" has updated the last resource link share with
| resource | textfile.txt |
| space | new-space |
| permissionsRole | edit |
| permissionsRole | Edit |
| expirationDateTime | 2200-07-15T14:00:00.000Z |
And user "Alice" has set the following password for the last link share:
| resource | textfile.txt |
Expand Down Expand Up @@ -1853,7 +1853,7 @@ Feature: check share activity
| password | %public% |
And user "Alice" has updated the last resource link share with
| space | new-space |
| permissionsRole | edit |
| permissionsRole | Edit |
| expirationDateTime | 2200-07-15T14:00:00.000Z |
And user "Alice" has set the following password for the last link share:
| resource | |
Expand All @@ -1871,12 +1871,12 @@ Feature: check share activity
And user "Alice" has created the following resource link share:
| resource | textfile.txt |
| space | new-space |
| permissionsRole | view |
| permissionsRole | View |
| password | %public% |
And user "Alice" has updated the last resource link share with
| resource | textfile.txt |
| space | new-space |
| permissionsRole | edit |
| permissionsRole | Edit |
| expirationDateTime | 2200-07-15T14:00:00.000Z |
And user "Alice" has set the following password for the last link share:
| resource | textfile.txt |
Expand All @@ -1894,12 +1894,12 @@ Feature: check share activity
And user "Alice" has created the following resource link share:
| resource | project-folder |
| space | new-space |
| permissionsRole | view |
| permissionsRole | View |
| password | %public% |
And user "Alice" has updated the last resource link share with
| resource | project-folder |
| space | new-space |
| permissionsRole | edit |
| permissionsRole | Edit |
| expirationDateTime | 2200-07-15T14:00:00.000Z |
And user "Alice" has set the following password for the last link share:
| resource | project-folder |
Expand Down Expand Up @@ -1958,7 +1958,7 @@ Feature: check share activity
And user "Alice" has created the following resource link share:
| resource | textfile.txt |
| space | Personal |
| permissionsRole | edit |
| permissionsRole | Edit |
| password | %public% |
And the public has uploaded file "textfile.txt" with content "public test" and password "%public%" to the last link share using the public WebDAV API
When user "Alice" lists the activities of file "textfile.txt" from space "Personal" using the Graph API
Expand Down Expand Up @@ -2098,7 +2098,7 @@ Feature: check share activity
And user "Alice" has created the following resource link share:
| resource | /FOLDER |
| space | Personal |
| permissionsRole | edit |
| permissionsRole | Edit |
| password | %public% |
And the public has uploaded file "text.txt" with content "added by public user" and password "%public%" to the last link share using the public WebDAV API
And the public has uploaded file "text.txt" with content "updated by public user" and password "%public%" to the last link share using the public WebDAV API
Expand Down
6 changes: 3 additions & 3 deletions tests/acceptance/features/apiAntivirus/antivirus.feature
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Feature: antivirus
And user "Alice" has created the following resource link share:
| resource | uploadFolder |
| space | Personal |
| permissionsRole | edit |
| permissionsRole | Edit |
| expirationDateTime | 2040-01-01T23:59:59.000Z |
When the public uploads file "filesForUpload/filesWithVirus/<file-name>" to "<new-file-name>" inside last link shared folder using the public WebDAV API
Then the HTTP status code should be "201"
Expand All @@ -126,7 +126,7 @@ Feature: antivirus
And user "Alice" has created the following resource link share:
| resource | uploadFolder |
| space | Personal |
| permissionsRole | edit |
| permissionsRole | Edit |
| password | %public% |
| expirationDateTime | 2040-01-01T23:59:59.000Z |
When the public uploads file "filesForUpload/filesWithVirus/<file-name>" to "<new-file-name>" inside last link shared folder with password "%public%" using the public WebDAV API
Expand Down Expand Up @@ -344,7 +344,7 @@ Feature: antivirus
And user "Alice" has created the following resource link share:
| resource | test.txt |
| space | Personal |
| permissionsRole | edit |
| permissionsRole | Edit |
When the public overwrites file "test.txt" with content "X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*" using the public WebDAV API
Then the HTTP status code should be "204"
And user "Alice" should get a notification with subject "Virus found" and message:
Expand Down
12 changes: 6 additions & 6 deletions tests/acceptance/features/apiCollaboration/wopi.feature
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ Feature: collaboration (wopi)
And user "Alice" has created the following resource link share:
| resource | simple.odt |
| space | Personal |
| permissionsRole | view |
| permissionsRole | View |
| password | %public% |
When the public sends HTTP method "POST" to URL "<app-endpoint>" with password "%public%"
Then the HTTP status code should be "200"
Expand Down Expand Up @@ -411,7 +411,7 @@ Feature: collaboration (wopi)
And user "Alice" has created the following resource link share:
| resource | simple.odt |
| space | Personal |
| permissionsRole | view |
| permissionsRole | View |
| password | %public% |
When the public sends HTTP method "POST" to URL "<app-endpoint>" with password "%public%"
Then the HTTP status code should be "200"
Expand Down Expand Up @@ -953,17 +953,17 @@ Feature: collaboration (wopi)
And as "Alice" file "publicFolder/simple.odt" should exist
Examples:
| permissions-role |
| edit |
| upload |
| createOnly |
| Edit |
| Upload |
| File Drop |

@issue-10126 @issue-10331
Scenario: public user with permission view tries to creates odt file inside public folder using wopi endpoint
Given user "Alice" has created folder "publicFolder"
And user "Alice" has created the following resource link share:
| resource | publicFolder |
| space | Personal |
| permissionsRole | view |
| permissionsRole | View |
| password | %public% |
When the public tries to create a file "simple.odt" inside the last shared public link folder with password "%public%" using wopi endpoint
Then the HTTP status code should be "403"
Expand Down
4 changes: 2 additions & 2 deletions tests/acceptance/features/apiDepthInfinity/propfind.feature
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Feature: PROPFIND with depth:infinity
And user "Alice" has created the following resource link share:
| resource | simple-folder |
| space | Personal |
| permissionsRole | view |
| permissionsRole | View |
When the public lists the resources in the last created public link with depth "infinity" using the WebDAV API
Then the HTTP status code should be "207"
And the last public link DAV response should contain these nodes
Expand Down Expand Up @@ -130,7 +130,7 @@ Feature: PROPFIND with depth:infinity
And user "Alice" has created the following resource link share:
| resource | simple-folder |
| space | Personal |
| permissionsRole | view |
| permissionsRole | View |
When the public lists the resources in the last created public link with depth "infinity" using the WebDAV API
Then the HTTP status code should be "400"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Feature: enforce password on public link
And user "Alice" has created the following resource link share:
| resource | testfile.txt |
| space | Personal |
| permissionsRole | view |
| permissionsRole | View |
When user "Alice" updates the last public link share using the sharing API with
| permissions | 3 |
| password | %public% |
Expand Down Expand Up @@ -156,7 +156,7 @@ Feature: enforce password on public link
And user "Alice" has created the following resource link share:
| resource | testfile.txt |
| space | Personal |
| permissionsRole | view |
| permissionsRole | View |
When user "Alice" updates the last public link share using the sharing API with
| permissions | 3 |
| password | 6a0Q;A3 +i^m[ |
Expand Down Expand Up @@ -189,7 +189,7 @@ Feature: enforce password on public link
And user "Alice" has created the following resource link share:
| resource | testfile.txt |
| space | Personal |
| permissionsRole | view |
| permissionsRole | View |
When user "Alice" updates the last public link share using the sharing API with
| permissions | 3 |
| password | Pws^ |
Expand Down Expand Up @@ -264,7 +264,7 @@ Feature: enforce password on public link
And user "Alice" has created the following resource link share:
| resource | testfile.txt |
| space | Personal |
| permissionsRole | internal |
| permissionsRole | Internal |
When user "Alice" updates the last public link share using the sharing API with
| permissions | 3 |
| password | <password> |
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/features/apiGraph/userGDPRExport.feature
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ Feature: user GDPR (General Data Protection Regulation) report
And user "Alice" has created the following resource link share:
| resource | folderMain |
| space | Personal |
| permissionsRole | view |
| permissionsRole | View |
| password | %public% |
| displayName | sharedlink |
When user "Alice" exports her GDPR report to "/.personal_data_export.json" using the Graph API
Expand Down
4 changes: 2 additions & 2 deletions tests/acceptance/features/apiLocks/lockFiles.feature
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ Feature: lock files
And user "Alice" has created the following resource link share:
| resource | PARENT |
| space | Personal |
| permissionsRole | edit |
| permissionsRole | Edit |
| password | %public% |
When the public locks "textfile0.txt" in the last public link shared folder using the public WebDAV API setting the following properties
| lockscope | <lock-scope> |
Expand All @@ -498,7 +498,7 @@ Feature: lock files
And user "Alice" has created the following resource link share:
| resource | PARENT |
| space | Personal |
| permissionsRole | view |
| permissionsRole | View |
| password | %public% |
When the public tries to lock "textfile0.txt" in the last public link shared folder using the public WebDAV API setting the following properties
| lockscope | <lock-scope> |
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/features/apiLocks/unlockFiles.feature
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ Feature: unlock locked items
And user "Alice" has created the following resource link share:
| resource | PARENT |
| space | Personal |
| permissionsRole | edit |
| permissionsRole | Edit |
| password | %public% |
And the public has locked "textfile0.txt" in the last public link shared folder setting the following properties
| lockscope | <lock-scope> |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1748,7 +1748,7 @@ Feature: List a sharing permissions
And user "Alice" has created the following resource link share:
| resource | folder |
| space | Personal |
| permissionsRole | view |
| permissionsRole | View |
| password | %public% |
When user "Alice" gets permissions list for folder "folder" of the space "Personal" using the Graph API
Then the HTTP status code should be "200"
Expand Down Expand Up @@ -1853,7 +1853,7 @@ Feature: List a sharing permissions
And user "Alice" has created the following resource link share:
| resource | textfile0.txt |
| space | Personal |
| permissionsRole | view |
| permissionsRole | View |
| password | %public% |
When user "Alice" gets permissions list for file "textfile0.txt" of the space "Personal" using the Graph API
Then the HTTP status code should be "200"
Expand Down Expand Up @@ -1957,7 +1957,7 @@ Feature: List a sharing permissions
And user "Alice" has created the following resource link share:
| resource | folder |
| space | new-space |
| permissionsRole | view |
| permissionsRole | View |
| password | %public% |
When user "Alice" gets permissions list for folder "folder" of the space "new-space" using the Graph API
Then the HTTP status code should be "200"
Expand Down Expand Up @@ -2065,7 +2065,7 @@ Feature: List a sharing permissions
And user "Alice" has created the following resource link share:
| resource | textfile0.txt |
| space | new-space |
| permissionsRole | view |
| permissionsRole | View |
| password | %public% |
When user "Alice" gets permissions list for file "textfile0.txt" of the space "new-space" using the Graph API
Then the HTTP status code should be "200"
Expand Down
Loading

0 comments on commit 718ffda

Please sign in to comment.