Skip to content

Commit f856eaf

Browse files
use displayname of permissions role in steps
Signed-off-by: prashant-gurung899 <[email protected]>
1 parent 2d30d12 commit f856eaf

39 files changed

+497
-475
lines changed

tests/acceptance/bootstrap/SharingNgContext.php

+24-2
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,10 @@ public function createLinkShare(string $user, TableNode $body): ResponseInterfac
9090
$bodyRows['expirationDateTime'] = \array_key_exists('expirationDateTime', $bodyRows)
9191
? \date('Y-m-d', \strtotime($bodyRows['expirationDateTime'])) . 'T14:00:00.000Z' : null;
9292
$bodyRows['password'] = $bodyRows['password'] ?? null;
93+
94+
$type = self::mapRole($bodyRows['permissionsRole']);
9395
$body = [
94-
'type' => $bodyRows['permissionsRole'],
96+
'type' => $type,
9597
"@libre.graph.quickLink" => filter_var($bodyRows['quickLink'], FILTER_VALIDATE_BOOLEAN),
9698
'displayName' => $bodyRows['displayName'],
9799
'expirationDateTime' => $bodyRows['expirationDateTime'],
@@ -109,6 +111,26 @@ public function createLinkShare(string $user, TableNode $body): ResponseInterfac
109111
);
110112
}
111113

114+
/**
115+
* Map permissions role to corresponding type
116+
*
117+
* @param string $role
118+
*
119+
* @return string
120+
*/
121+
public static function mapRole(string $role): string {
122+
$roleMappings = [
123+
'View' => 'view',
124+
'Internal' => 'internal',
125+
'Edit' => 'edit',
126+
'Upload' => 'upload',
127+
'File Drop' => 'createOnly',
128+
'Secure View' => 'blocksDownload',
129+
'Denied' => 'denied'
130+
];
131+
return $roleMappings[$role];
132+
}
133+
112134
/**
113135
* Create link share of drive (space) using drives.root endpoint
114136
*
@@ -842,7 +864,7 @@ public function updateLinkShare(string $user, TableNode $body, string $permissi
842864
$body = [];
843865

844866
if (\array_key_exists('permissionsRole', $bodyRows)) {
845-
$body['link']['type'] = $bodyRows['permissionsRole'];
867+
$body['link']['type'] = self::mapRole($bodyRows['permissionsRole']);
846868
}
847869

848870
if (\array_key_exists('expirationDateTime', $bodyRows)) {

tests/acceptance/features/apiActivities/shareActivities.feature

+12-12
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ Feature: check share activity
273273
Given user "Alice" has created the following resource link share:
274274
| resource | textfile.txt |
275275
| space | Personal |
276-
| permissionsRole | view |
276+
| permissionsRole | View |
277277
| password | %public% |
278278
When user "Alice" lists the activities of file "textfile.txt" from space "Personal" using the Graph API
279279
Then the HTTP status code should be "200"
@@ -378,7 +378,7 @@ Feature: check share activity
378378
Given user "Alice" has created the following resource link share:
379379
| resource | textfile.txt |
380380
| space | Personal |
381-
| permissionsRole | view |
381+
| permissionsRole | View |
382382
| password | %public% |
383383
And user "Alice" has removed the last link share of file "textfile.txt" from space "Personal"
384384
When user "Alice" lists the activities of file "textfile.txt" from space "Personal" using the Graph API
@@ -1071,7 +1071,7 @@ Feature: check share activity
10711071
| password | %public% |
10721072
And user "Alice" has updated the last resource link share with
10731073
| space | new-space |
1074-
| permissionsRole | edit |
1074+
| permissionsRole | Edit |
10751075
| expirationDateTime | 2200-07-15T14:00:00.000Z |
10761076
And user "Alice" has set the following password for the last link share:
10771077
| resource | |
@@ -1543,12 +1543,12 @@ Feature: check share activity
15431543
And user "Alice" has created the following resource link share:
15441544
| resource | textfile.txt |
15451545
| space | new-space |
1546-
| permissionsRole | view |
1546+
| permissionsRole | View |
15471547
| password | %public% |
15481548
And user "Alice" has updated the last resource link share with
15491549
| resource | textfile.txt |
15501550
| space | new-space |
1551-
| permissionsRole | edit |
1551+
| permissionsRole | Edit |
15521552
| expirationDateTime | 2200-07-15T14:00:00.000Z |
15531553
And user "Alice" has set the following password for the last link share:
15541554
| resource | textfile.txt |
@@ -1853,7 +1853,7 @@ Feature: check share activity
18531853
| password | %public% |
18541854
And user "Alice" has updated the last resource link share with
18551855
| space | new-space |
1856-
| permissionsRole | edit |
1856+
| permissionsRole | Edit |
18571857
| expirationDateTime | 2200-07-15T14:00:00.000Z |
18581858
And user "Alice" has set the following password for the last link share:
18591859
| resource | |
@@ -1871,12 +1871,12 @@ Feature: check share activity
18711871
And user "Alice" has created the following resource link share:
18721872
| resource | textfile.txt |
18731873
| space | new-space |
1874-
| permissionsRole | view |
1874+
| permissionsRole | View |
18751875
| password | %public% |
18761876
And user "Alice" has updated the last resource link share with
18771877
| resource | textfile.txt |
18781878
| space | new-space |
1879-
| permissionsRole | edit |
1879+
| permissionsRole | Edit |
18801880
| expirationDateTime | 2200-07-15T14:00:00.000Z |
18811881
And user "Alice" has set the following password for the last link share:
18821882
| resource | textfile.txt |
@@ -1894,12 +1894,12 @@ Feature: check share activity
18941894
And user "Alice" has created the following resource link share:
18951895
| resource | project-folder |
18961896
| space | new-space |
1897-
| permissionsRole | view |
1897+
| permissionsRole | View |
18981898
| password | %public% |
18991899
And user "Alice" has updated the last resource link share with
19001900
| resource | project-folder |
19011901
| space | new-space |
1902-
| permissionsRole | edit |
1902+
| permissionsRole | Edit |
19031903
| expirationDateTime | 2200-07-15T14:00:00.000Z |
19041904
And user "Alice" has set the following password for the last link share:
19051905
| resource | project-folder |
@@ -1958,7 +1958,7 @@ Feature: check share activity
19581958
And user "Alice" has created the following resource link share:
19591959
| resource | textfile.txt |
19601960
| space | Personal |
1961-
| permissionsRole | edit |
1961+
| permissionsRole | Edit |
19621962
| password | %public% |
19631963
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
19641964
When user "Alice" lists the activities of file "textfile.txt" from space "Personal" using the Graph API
@@ -2098,7 +2098,7 @@ Feature: check share activity
20982098
And user "Alice" has created the following resource link share:
20992099
| resource | /FOLDER |
21002100
| space | Personal |
2101-
| permissionsRole | edit |
2101+
| permissionsRole | Edit |
21022102
| password | %public% |
21032103
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
21042104
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

tests/acceptance/features/apiAntivirus/antivirus.feature

+3-3
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Feature: antivirus
101101
And user "Alice" has created the following resource link share:
102102
| resource | uploadFolder |
103103
| space | Personal |
104-
| permissionsRole | edit |
104+
| permissionsRole | Edit |
105105
| expirationDateTime | 2040-01-01T23:59:59.000Z |
106106
When the public uploads file "filesForUpload/filesWithVirus/<file-name>" to "<new-file-name>" inside last link shared folder using the public WebDAV API
107107
Then the HTTP status code should be "201"
@@ -126,7 +126,7 @@ Feature: antivirus
126126
And user "Alice" has created the following resource link share:
127127
| resource | uploadFolder |
128128
| space | Personal |
129-
| permissionsRole | edit |
129+
| permissionsRole | Edit |
130130
| password | %public% |
131131
| expirationDateTime | 2040-01-01T23:59:59.000Z |
132132
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
@@ -344,7 +344,7 @@ Feature: antivirus
344344
And user "Alice" has created the following resource link share:
345345
| resource | test.txt |
346346
| space | Personal |
347-
| permissionsRole | edit |
347+
| permissionsRole | Edit |
348348
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
349349
Then the HTTP status code should be "204"
350350
And user "Alice" should get a notification with subject "Virus found" and message:

tests/acceptance/features/apiCollaboration/wopi.feature

+6-6
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ Feature: collaboration (wopi)
181181
And user "Alice" has created the following resource link share:
182182
| resource | simple.odt |
183183
| space | Personal |
184-
| permissionsRole | view |
184+
| permissionsRole | View |
185185
| password | %public% |
186186
When the public sends HTTP method "POST" to URL "<app-endpoint>" with password "%public%"
187187
Then the HTTP status code should be "200"
@@ -411,7 +411,7 @@ Feature: collaboration (wopi)
411411
And user "Alice" has created the following resource link share:
412412
| resource | simple.odt |
413413
| space | Personal |
414-
| permissionsRole | view |
414+
| permissionsRole | View |
415415
| password | %public% |
416416
When the public sends HTTP method "POST" to URL "<app-endpoint>" with password "%public%"
417417
Then the HTTP status code should be "200"
@@ -953,17 +953,17 @@ Feature: collaboration (wopi)
953953
And as "Alice" file "publicFolder/simple.odt" should exist
954954
Examples:
955955
| permissions-role |
956-
| edit |
957-
| upload |
958-
| createOnly |
956+
| Edit |
957+
| Upload |
958+
| File Drop |
959959

960960
@issue-10126 @issue-10331
961961
Scenario: public user with permission view tries to creates odt file inside public folder using wopi endpoint
962962
Given user "Alice" has created folder "publicFolder"
963963
And user "Alice" has created the following resource link share:
964964
| resource | publicFolder |
965965
| space | Personal |
966-
| permissionsRole | view |
966+
| permissionsRole | View |
967967
| password | %public% |
968968
When the public tries to create a file "simple.odt" inside the last shared public link folder with password "%public%" using wopi endpoint
969969
Then the HTTP status code should be "403"

tests/acceptance/features/apiDepthInfinity/propfind.feature

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Feature: PROPFIND with depth:infinity
8080
And user "Alice" has created the following resource link share:
8181
| resource | simple-folder |
8282
| space | Personal |
83-
| permissionsRole | view |
83+
| permissionsRole | View |
8484
When the public lists the resources in the last created public link with depth "infinity" using the WebDAV API
8585
Then the HTTP status code should be "207"
8686
And the last public link DAV response should contain these nodes
@@ -130,7 +130,7 @@ Feature: PROPFIND with depth:infinity
130130
And user "Alice" has created the following resource link share:
131131
| resource | simple-folder |
132132
| space | Personal |
133-
| permissionsRole | view |
133+
| permissionsRole | View |
134134
When the public lists the resources in the last created public link with depth "infinity" using the WebDAV API
135135
Then the HTTP status code should be "400"
136136

tests/acceptance/features/apiGraph/enforcePasswordPublicLink.feature

+4-4
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Feature: enforce password on public link
6464
And user "Alice" has created the following resource link share:
6565
| resource | testfile.txt |
6666
| space | Personal |
67-
| permissionsRole | view |
67+
| permissionsRole | View |
6868
When user "Alice" updates the last public link share using the sharing API with
6969
| permissions | 3 |
7070
| password | %public% |
@@ -156,7 +156,7 @@ Feature: enforce password on public link
156156
And user "Alice" has created the following resource link share:
157157
| resource | testfile.txt |
158158
| space | Personal |
159-
| permissionsRole | view |
159+
| permissionsRole | View |
160160
When user "Alice" updates the last public link share using the sharing API with
161161
| permissions | 3 |
162162
| password | 6a0Q;A3 +i^m[ |
@@ -189,7 +189,7 @@ Feature: enforce password on public link
189189
And user "Alice" has created the following resource link share:
190190
| resource | testfile.txt |
191191
| space | Personal |
192-
| permissionsRole | view |
192+
| permissionsRole | View |
193193
When user "Alice" updates the last public link share using the sharing API with
194194
| permissions | 3 |
195195
| password | Pws^ |
@@ -264,7 +264,7 @@ Feature: enforce password on public link
264264
And user "Alice" has created the following resource link share:
265265
| resource | testfile.txt |
266266
| space | Personal |
267-
| permissionsRole | internal |
267+
| permissionsRole | Internal |
268268
When user "Alice" updates the last public link share using the sharing API with
269269
| permissions | 3 |
270270
| password | <password> |

tests/acceptance/features/apiGraph/userGDPRExport.feature

+1-1
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ Feature: user GDPR (General Data Protection Regulation) report
719719
And user "Alice" has created the following resource link share:
720720
| resource | folderMain |
721721
| space | Personal |
722-
| permissionsRole | view |
722+
| permissionsRole | View |
723723
| password | %public% |
724724
| displayName | sharedlink |
725725
When user "Alice" exports her GDPR report to "/.personal_data_export.json" using the Graph API

tests/acceptance/features/apiLocks/lockFiles.feature

+2-2
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ Feature: lock files
475475
And user "Alice" has created the following resource link share:
476476
| resource | PARENT |
477477
| space | Personal |
478-
| permissionsRole | edit |
478+
| permissionsRole | Edit |
479479
| password | %public% |
480480
When the public locks "textfile0.txt" in the last public link shared folder using the public WebDAV API setting the following properties
481481
| lockscope | <lock-scope> |
@@ -498,7 +498,7 @@ Feature: lock files
498498
And user "Alice" has created the following resource link share:
499499
| resource | PARENT |
500500
| space | Personal |
501-
| permissionsRole | view |
501+
| permissionsRole | View |
502502
| password | %public% |
503503
When the public tries to lock "textfile0.txt" in the last public link shared folder using the public WebDAV API setting the following properties
504504
| lockscope | <lock-scope> |

tests/acceptance/features/apiLocks/unlockFiles.feature

+1-1
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ Feature: unlock locked items
307307
And user "Alice" has created the following resource link share:
308308
| resource | PARENT |
309309
| space | Personal |
310-
| permissionsRole | edit |
310+
| permissionsRole | Edit |
311311
| password | %public% |
312312
And the public has locked "textfile0.txt" in the last public link shared folder setting the following properties
313313
| lockscope | <lock-scope> |

tests/acceptance/features/apiSharingNg1/listPermissions.feature

+4-4
Original file line numberDiff line numberDiff line change
@@ -1748,7 +1748,7 @@ Feature: List a sharing permissions
17481748
And user "Alice" has created the following resource link share:
17491749
| resource | folder |
17501750
| space | Personal |
1751-
| permissionsRole | view |
1751+
| permissionsRole | View |
17521752
| password | %public% |
17531753
When user "Alice" gets permissions list for folder "folder" of the space "Personal" using the Graph API
17541754
Then the HTTP status code should be "200"
@@ -1853,7 +1853,7 @@ Feature: List a sharing permissions
18531853
And user "Alice" has created the following resource link share:
18541854
| resource | textfile0.txt |
18551855
| space | Personal |
1856-
| permissionsRole | view |
1856+
| permissionsRole | View |
18571857
| password | %public% |
18581858
When user "Alice" gets permissions list for file "textfile0.txt" of the space "Personal" using the Graph API
18591859
Then the HTTP status code should be "200"
@@ -1957,7 +1957,7 @@ Feature: List a sharing permissions
19571957
And user "Alice" has created the following resource link share:
19581958
| resource | folder |
19591959
| space | new-space |
1960-
| permissionsRole | view |
1960+
| permissionsRole | View |
19611961
| password | %public% |
19621962
When user "Alice" gets permissions list for folder "folder" of the space "new-space" using the Graph API
19631963
Then the HTTP status code should be "200"
@@ -2065,7 +2065,7 @@ Feature: List a sharing permissions
20652065
And user "Alice" has created the following resource link share:
20662066
| resource | textfile0.txt |
20672067
| space | new-space |
2068-
| permissionsRole | view |
2068+
| permissionsRole | View |
20692069
| password | %public% |
20702070
When user "Alice" gets permissions list for file "textfile0.txt" of the space "new-space" using the Graph API
20712071
Then the HTTP status code should be "200"

0 commit comments

Comments
 (0)