diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2019-10-24 15:51:56 +0200 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2019-10-29 13:20:08 +0100 |
commit | 2fd057513a4eafd1282128721fb6dbc443ffdeba (patch) | |
tree | 326066a72eb89e7d820baf96ad03dcb2e29ab5e5 /apps/files_sharing/tests | |
parent | 3331cdd74abb89692c9d37ba503a9d36768ae7d9 (diff) | |
download | nextcloud-server-2fd057513a4eafd1282128721fb6dbc443ffdeba.tar.gz nextcloud-server-2fd057513a4eafd1282128721fb6dbc443ffdeba.zip |
Fix current user edit/delete permissions
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files_sharing/tests')
-rw-r--r-- | apps/files_sharing/tests/Controller/ShareAPIControllerTest.php | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php index c972c5c794e..c741159cdb4 100644 --- a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php @@ -577,6 +577,8 @@ class ShareAPIControllerTest extends TestCase { 'displayname_file_owner' => 'ownerDisplay', 'mimetype' => 'myMimeType', 'hide_download' => 0, + 'can_edit' => false, + 'can_delete' => false, ]; $data[] = [$share, $expected]; @@ -623,6 +625,8 @@ class ShareAPIControllerTest extends TestCase { 'displayname_file_owner' => 'ownerDisplay', 'mimetype' => 'myFolderMimeType', 'hide_download' => 0, + 'can_edit' => false, + 'can_delete' => false, ]; $data[] = [$share, $expected]; @@ -676,6 +680,8 @@ class ShareAPIControllerTest extends TestCase { 'displayname_file_owner' => 'ownerDisplay', 'mimetype' => 'myFolderMimeType', 'hide_download' => 0, + 'can_edit' => false, + 'can_delete' => false, ]; $data[] = [$share, $expected]; @@ -3431,6 +3437,8 @@ class ShareAPIControllerTest extends TestCase { 'mail_send' => 0, 'mimetype' => 'myMimeType', 'hide_download' => 0, + 'can_edit' => false, + 'can_delete' => false, ], $share, [], false ]; // User backend up @@ -3462,6 +3470,8 @@ class ShareAPIControllerTest extends TestCase { 'mail_send' => 0, 'mimetype' => 'myMimeType', 'hide_download' => 0, + 'can_edit' => false, + 'can_delete' => false, ], $share, [ ['owner', $owner], ['initiator', $initiator], @@ -3509,6 +3519,53 @@ class ShareAPIControllerTest extends TestCase { 'mail_send' => 0, 'mimetype' => 'myMimeType', 'hide_download' => 0, + 'can_edit' => false, + 'can_delete' => false, + ], $share, [], false + ]; + + $share = \OC::$server->getShareManager()->newShare(); + $share->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setSharedWith('recipient') + ->setSharedBy('initiator') + ->setShareOwner('currentUser') + ->setPermissions(\OCP\Constants::PERMISSION_READ) + ->setNode($file) + ->setShareTime(new \DateTime('2000-01-01T00:01:02')) + ->setTarget('myTarget') + ->setNote('personal note') + ->setId(42); + // User backend down + $result[] = [ + [ + 'id' => 42, + 'share_type' => \OCP\Share::SHARE_TYPE_USER, + 'uid_owner' => 'initiator', + 'displayname_owner' => 'initiator', + 'permissions' => 1, + 'stime' => 946684862, + 'parent' => null, + 'expiration' => null, + 'token' => null, + 'uid_file_owner' => 'currentUser', + 'displayname_file_owner' => 'currentUser', + 'note' => 'personal note', + 'label' => null, + 'path' => 'file', + 'item_type' => 'file', + 'storage_id' => 'storageId', + 'storage' => 100, + 'item_source' => 3, + 'file_source' => 3, + 'file_parent' => 1, + 'file_target' => 'myTarget', + 'share_with' => 'recipient', + 'share_with_displayname' => 'recipient', + 'mail_send' => 0, + 'mimetype' => 'myMimeType', + 'hide_download' => 0, + 'can_edit' => true, + 'can_delete' => true, ], $share, [], false ]; @@ -3554,6 +3611,8 @@ class ShareAPIControllerTest extends TestCase { 'mail_send' => 0, 'mimetype' => 'myMimeType', 'hide_download' => 0, + 'can_edit' => false, + 'can_delete' => false, ], $share, [], false ]; @@ -3597,6 +3656,8 @@ class ShareAPIControllerTest extends TestCase { 'mail_send' => 0, 'mimetype' => 'myMimeType', 'hide_download' => 0, + 'can_edit' => false, + 'can_delete' => false, ], $share, [], false ]; @@ -3646,6 +3707,8 @@ class ShareAPIControllerTest extends TestCase { 'url' => 'myLink', 'mimetype' => 'myMimeType', 'hide_download' => 0, + 'can_edit' => false, + 'can_delete' => false, ], $share, [], false ]; @@ -3696,6 +3759,8 @@ class ShareAPIControllerTest extends TestCase { 'url' => 'myLink', 'mimetype' => 'myMimeType', 'hide_download' => 0, + 'can_edit' => false, + 'can_delete' => false, ], $share, [], false ]; @@ -3739,6 +3804,8 @@ class ShareAPIControllerTest extends TestCase { 'mail_send' => 0, 'mimetype' => 'myFolderMimeType', 'hide_download' => 0, + 'can_edit' => false, + 'can_delete' => false, ], $share, [], false ]; @@ -3785,6 +3852,8 @@ class ShareAPIControllerTest extends TestCase { 'mail_send' => 0, 'mimetype' => 'myFolderMimeType', 'hide_download' => 0, + 'can_edit' => false, + 'can_delete' => false, ], $share, [], false ]; @@ -3829,6 +3898,8 @@ class ShareAPIControllerTest extends TestCase { 'mail_send' => 0, 'mimetype' => 'myFolderMimeType', 'hide_download' => 0, + 'can_edit' => false, + 'can_delete' => false, ], $share, [], false ]; @@ -3873,6 +3944,8 @@ class ShareAPIControllerTest extends TestCase { 'mail_send' => 0, 'mimetype' => 'myFolderMimeType', 'hide_download' => 0, + 'can_edit' => false, + 'can_delete' => false, ], $share, [], false ]; @@ -3933,6 +4006,8 @@ class ShareAPIControllerTest extends TestCase { 'password' => 'password', 'send_password_by_talk' => false, 'hide_download' => 0, + 'can_edit' => false, + 'can_delete' => false, ], $share, [], false ]; @@ -3979,6 +4054,8 @@ class ShareAPIControllerTest extends TestCase { 'password' => 'password', 'send_password_by_talk' => true, 'hide_download' => 0, + 'can_edit' => false, + 'can_delete' => false, ], $share, [], false ]; @@ -4120,6 +4197,8 @@ class ShareAPIControllerTest extends TestCase { 'mimetype' => 'myMimeType', 'hide_download' => 0, 'label' => '', + 'can_edit' => false, + 'can_delete' => false, ], $share, false, [] ]; @@ -4163,6 +4242,8 @@ class ShareAPIControllerTest extends TestCase { 'mimetype' => 'myMimeType', 'hide_download' => 0, 'label' => '', + 'can_edit' => false, + 'can_delete' => false, ], $share, true, [ 'share_with_displayname' => 'recipientRoomName' ] |