@@ -553,6 +553,8 @@ public function dataGetShare() {
553553
554554 $ parentFolder = $ this ->getMockBuilder ('OCP\Files\Folder ' )->getMock ();
555555 $ parentFolder ->method ('getId ' )->willReturn (3 );
556+ $ mountPoint = $ this ->createMock (IMountPoint::class);
557+ $ mountPoint ->method ('getMountType ' )->willReturn ('' );
556558
557559 $ file = $ this ->getMockBuilder ('OCP\Files\File ' )->getMock ();
558560 $ file ->method ('getId ' )->willReturn (1 );
@@ -562,6 +564,7 @@ public function dataGetShare() {
562564 $ file ->method ('getSize ' )->willReturn (123465 );
563565 $ file ->method ('getMTime ' )->willReturn (1234567890 );
564566 $ file ->method ('getMimeType ' )->willReturn ('myMimeType ' );
567+ $ file ->method ('getMountPoint ' )->willReturn ($ mountPoint );
565568
566569 $ folder = $ this ->getMockBuilder ('OCP\Files\Folder ' )->getMock ();
567570 $ folder ->method ('getId ' )->willReturn (2 );
@@ -571,6 +574,7 @@ public function dataGetShare() {
571574 $ folder ->method ('getSize ' )->willReturn (123465 );
572575 $ folder ->method ('getMTime ' )->willReturn (1234567890 );
573576 $ folder ->method ('getMimeType ' )->willReturn ('myFolderMimeType ' );
577+ $ folder ->method ('getMountPoint ' )->willReturn ($ mountPoint );
574578
575579 [$ shareAttributes , $ shareAttributesReturnJson ] = $ this ->mockShareAttributes ();
576580
@@ -626,6 +630,9 @@ public function dataGetShare() {
626630 'item_size ' => 123465 ,
627631 'item_mtime ' => 1234567890 ,
628632 'attributes ' => null ,
633+ 'item_permissions ' => 4 ,
634+ 'is-mount-root ' => false ,
635+ 'mount-type ' => '' ,
629636 ];
630637 $ data [] = [$ share , $ expected ];
631638
@@ -680,6 +687,9 @@ public function dataGetShare() {
680687 'item_size ' => 123465 ,
681688 'item_mtime ' => 1234567890 ,
682689 'attributes ' => null ,
690+ 'item_permissions ' => 4 ,
691+ 'is-mount-root ' => false ,
692+ 'mount-type ' => '' ,
683693 ];
684694 $ data [] = [$ share , $ expected ];
685695
@@ -740,6 +750,9 @@ public function dataGetShare() {
740750 'item_size ' => 123465 ,
741751 'item_mtime ' => 1234567890 ,
742752 'attributes ' => null ,
753+ 'item_permissions ' => 4 ,
754+ 'is-mount-root ' => false ,
755+ 'mount-type ' => '' ,
743756 ];
744757 $ data [] = [$ share , $ expected ];
745758
@@ -3745,6 +3758,12 @@ public function dataFormatShare() {
37453758 $ folder ->method ('getMimeType ' )->willReturn ('myFolderMimeType ' );
37463759 $ fileWithPreview ->method ('getMimeType ' )->willReturn ('mimeWithPreview ' );
37473760
3761+ $ mountPoint = $ this ->createMock (IMountPoint::class);
3762+ $ mountPoint ->method ('getMountType ' )->willReturn ('' );
3763+ $ file ->method ('getMountPoint ' )->willReturn ($ mountPoint );
3764+ $ folder ->method ('getMountPoint ' )->willReturn ($ mountPoint );
3765+ $ fileWithPreview ->method ('getMountPoint ' )->willReturn ($ mountPoint );
3766+
37483767 $ file ->method ('getPath ' )->willReturn ('file ' );
37493768 $ folder ->method ('getPath ' )->willReturn ('folder ' );
37503769 $ fileWithPreview ->method ('getPath ' )->willReturn ('fileWithPreview ' );
@@ -3842,6 +3861,9 @@ public function dataFormatShare() {
38423861 'item_size ' => 123456 ,
38433862 'item_mtime ' => 1234567890 ,
38443863 'attributes ' => '[{"scope":"permissions","key":"download","enabled":true}] ' ,
3864+ 'item_permissions ' => 1 ,
3865+ 'is-mount-root ' => false ,
3866+ 'mount-type ' => '' ,
38453867 ], $ share , [], false
38463868 ];
38473869 // User backend up
@@ -3881,6 +3903,9 @@ public function dataFormatShare() {
38813903 'item_size ' => 123456 ,
38823904 'item_mtime ' => 1234567890 ,
38833905 'attributes ' => '[{"scope":"permissions","key":"download","enabled":true}] ' ,
3906+ 'item_permissions ' => 1 ,
3907+ 'is-mount-root ' => false ,
3908+ 'mount-type ' => '' ,
38843909 ], $ share , [
38853910 ['owner ' , $ owner ],
38863911 ['initiator ' , $ initiator ],
@@ -3938,6 +3963,7 @@ public function dataFormatShare() {
39383963 'is-mount-root ' => false ,
39393964 'mount-type ' => '' ,
39403965 'attributes ' => null ,
3966+ 'item_permissions ' => 1 ,
39413967 ], $ share , [], false
39423968 ];
39433969
@@ -3991,6 +4017,7 @@ public function dataFormatShare() {
39914017 'is-mount-root ' => false ,
39924018 'mount-type ' => '' ,
39934019 'attributes ' => null ,
4020+ 'item_permissions ' => 11 ,
39944021 ], $ share , [], false
39954022 ];
39964023
@@ -4045,6 +4072,7 @@ public function dataFormatShare() {
40454072 'is-mount-root ' => false ,
40464073 'mount-type ' => '' ,
40474074 'attributes ' => null ,
4075+ 'item_permissions ' => 1 ,
40484076 ], $ share , [], false
40494077 ];
40504078
@@ -4096,6 +4124,7 @@ public function dataFormatShare() {
40964124 'is-mount-root ' => false ,
40974125 'mount-type ' => '' ,
40984126 'attributes ' => null ,
4127+ 'item_permissions ' => 1 ,
40994128 ], $ share , [], false
41004129 ];
41014130
@@ -4154,6 +4183,7 @@ public function dataFormatShare() {
41544183 'is-mount-root ' => false ,
41554184 'mount-type ' => '' ,
41564185 'attributes ' => null ,
4186+ 'item_permissions ' => 1 ,
41574187 ], $ share , [], false
41584188 ];
41594189
@@ -4212,6 +4242,7 @@ public function dataFormatShare() {
42124242 'is-mount-root ' => false ,
42134243 'mount-type ' => '' ,
42144244 'attributes ' => null ,
4245+ 'item_permissions ' => 1 ,
42154246 ], $ share , [], false
42164247 ];
42174248
@@ -4264,6 +4295,7 @@ public function dataFormatShare() {
42644295 'is-mount-root ' => false ,
42654296 'mount-type ' => '' ,
42664297 'attributes ' => null ,
4298+ 'item_permissions ' => 1 ,
42674299 ], $ share , [], false
42684300 ];
42694301
@@ -4316,6 +4348,7 @@ public function dataFormatShare() {
43164348 'is-mount-root ' => false ,
43174349 'mount-type ' => '' ,
43184350 'attributes ' => null ,
4351+ 'item_permissions ' => 1 ,
43194352 ], $ share , [], false
43204353 ];
43214354
@@ -4371,6 +4404,7 @@ public function dataFormatShare() {
43714404 'is-mount-root ' => false ,
43724405 'mount-type ' => '' ,
43734406 'attributes ' => null ,
4407+ 'item_permissions ' => 1 ,
43744408 ], $ share , [], false
43754409 ];
43764410
@@ -4423,6 +4457,7 @@ public function dataFormatShare() {
44234457 'is-mount-root ' => false ,
44244458 'mount-type ' => '' ,
44254459 'attributes ' => null ,
4460+ 'item_permissions ' => 1 ,
44264461 ], $ share , [], false
44274462 ];
44284463
@@ -4475,6 +4510,7 @@ public function dataFormatShare() {
44754510 'is-mount-root ' => false ,
44764511 'mount-type ' => '' ,
44774512 'attributes ' => null ,
4513+ 'item_permissions ' => 1 ,
44784514 ], $ share , [], false
44794515 ];
44804516
@@ -4544,6 +4580,7 @@ public function dataFormatShare() {
45444580 'is-mount-root ' => false ,
45454581 'mount-type ' => '' ,
45464582 'attributes ' => null ,
4583+ 'item_permissions ' => 1 ,
45474584 ], $ share , [], false
45484585 ];
45494586
@@ -4599,6 +4636,7 @@ public function dataFormatShare() {
45994636 'is-mount-root ' => false ,
46004637 'mount-type ' => '' ,
46014638 'attributes ' => null ,
4639+ 'item_permissions ' => 1 ,
46024640 ], $ share , [], false
46034641 ];
46044642
@@ -4652,6 +4690,7 @@ public function dataFormatShare() {
46524690 'is-mount-root ' => false ,
46534691 'mount-type ' => '' ,
46544692 'attributes ' => null ,
4693+ 'item_permissions ' => 11 ,
46554694 ], $ share , [], false
46564695 ];
46574696
@@ -4816,6 +4855,7 @@ public function dataFormatRoomShare() {
48164855 'is-mount-root ' => false ,
48174856 'mount-type ' => '' ,
48184857 'attributes ' => null ,
4858+ 'item_permissions ' => 1 ,
48194859 ], $ share , false , []
48204860 ];
48214861
@@ -4867,6 +4907,7 @@ public function dataFormatRoomShare() {
48674907 'is-mount-root ' => false ,
48684908 'mount-type ' => '' ,
48694909 'attributes ' => null ,
4910+ 'item_permissions ' => 9 ,
48704911 ], $ share , true , [
48714912 'share_with_displayname ' => 'recipientRoomName '
48724913 ]
@@ -4906,11 +4947,14 @@ public function testFormatRoomShare(array $expects, \OCP\Share\IShare $share, bo
49064947 ->willReturn (true );
49074948
49084949 $ helper = $ this ->getMockBuilder ('\OCA\Talk\Share\Helper\ShareAPIController ' )
4909- ->setMethods (['formatShare ' ])
4950+ ->setMethods (['formatShare ' , ' canAccessShare ' ])
49104951 ->getMock ();
49114952 $ helper ->method ('formatShare ' )
49124953 ->with ($ share )
49134954 ->willReturn ($ formatShareByHelper );
4955+ $ helper ->method ('canAccessShare ' )
4956+ ->with ($ share )
4957+ ->willReturn (true );
49144958
49154959 $ this ->serverContainer ->method ('get ' )
49164960 ->with ('\OCA\Talk\Share\Helper\ShareAPIController ' )
0 commit comments