File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 */
88use OC \Files \Filesystem ;
99use OC \Files \Storage \Wrapper \DirPermissionsMask ;
10+ use OC \Files \Storage \Wrapper \PermissionsMask ;
1011use OC \Files \View ;
1112use OCA \DAV \Connector \Sabre \PublicAuth ;
1213use OCA \DAV \Connector \Sabre \ServerFactory ;
2122use OCP \BeforeSabrePubliclyLoadedEvent ;
2223use OCP \Constants ;
2324use OCP \EventDispatcher \IEventDispatcher ;
25+ use OCP \Files \IHomeStorage ;
2426use OCP \Files \IRootFolder ;
2527use OCP \Files \Mount \IMountManager ;
2628use OCP \ICacheFactory ;
115117 $ mask |= Constants::PERMISSION_READ | Constants::PERMISSION_DELETE ;
116118 }
117119
118- return new DirPermissionsMask ([
119- 'storage ' => $ storage ,
120- 'mask ' => $ mask ,
121- 'path ' => 'files ' ,
122- ]);
120+ if ($ storage instanceof IHomeStorage) {
121+ return new DirPermissionsMask ([
122+ 'storage ' => $ storage ,
123+ 'mask ' => $ mask ,
124+ 'path ' => 'files ' ,
125+ ]);
126+ } else {
127+ return new PermissionsMask (['storage ' => $ storage , 'mask ' => $ mask ]);
128+ }
123129 });
124130
125131 /** @psalm-suppress MissingClosureParamType */
Original file line number Diff line number Diff line change @@ -334,6 +334,23 @@ public function downloadedContentShouldStartWith($start) {
334334 }
335335 }
336336
337+ /**
338+ * @When Uploading public file :filename with content :content
339+ */
340+ public function uploadingPublicFile (string $ filename , string $ content ) {
341+ $ token = $ this ->lastShareData ->data ->token ;
342+ $ fullUrl = substr ($ this ->baseUrl , 0 , -4 ) . "public.php/dav/files/ $ token/ $ filename " ;
343+
344+ $ client = new GClient ();
345+ try {
346+ $ this ->response = $ client ->request ('PUT ' , $ fullUrl , [
347+ 'body ' => $ content
348+ ]);
349+ } catch (\GuzzleHttp \Exception \ClientException $ e ) {
350+ $ this ->response = $ e ->getResponse ();
351+ }
352+ }
353+
337354 /**
338355 * @Then /^as "([^"]*)" gets properties of (file|folder|entry) "([^"]*)" with$/
339356 * @param string $user
Original file line number Diff line number Diff line change @@ -556,7 +556,28 @@ Feature: sharing
556556 And Share fields of last share match with
557557 | expiration | +3 days |
558558
559- Scenario : getting all shares of a user using that user
559+ Scenario : Writing to a read-only link share of an external storage
560+ Given user "user0" exists
561+ Then As an "user0"
562+ When creating a share with
563+ | path | local_storage |
564+ | shareType | 3 |
565+ And the OCS status code should be "100"
566+ And the HTTP status code should be "200"
567+ Then Uploading public file "foo.txt" with content "bar"
568+ And the HTTP status code should be "403"
569+
570+ Scenario : Writing to a read-write link share of an external storage
571+ Given user "user0" exists
572+ Then As an "user0"
573+ When creating a share with
574+ | path | local_storage |
575+ | shareType | 3 |
576+ | permissions | 7 |
577+ Then Uploading public file "foo.txt" with content "bar"
578+ And the HTTP status code should be "201"
579+
580+ Scenario : getting all shares of a user using that user
560581 Given user "user0" exists
561582 And user "user1" exists
562583 When User "user1" deletes file "/textfile0.txt"
You can’t perform that action at this time.
0 commit comments