diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2015-05-04 15:07:37 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2015-05-04 15:07:37 +0200 |
commit | 59c657da5354d646cd69b58f9860b991f5b627b6 (patch) | |
tree | 141e83661e8bbc00f057a3886ef3d75361afa707 /tests | |
parent | 17fedc80dac7acd3d85f1f132455e94d4fd920c6 (diff) | |
parent | f524ae261ae53b7d3ea88f952ad29d72eb48dcb4 (diff) | |
download | nextcloud-server-59c657da5354d646cd69b58f9860b991f5b627b6.tar.gz nextcloud-server-59c657da5354d646cd69b58f9860b991f5b627b6.zip |
Merge pull request #15772 from owncloud/issue-15771-dont-restrict-permissions-for-share-owner
Do not restrict permissions for the original owner
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/share/share.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/lib/share/share.php b/tests/lib/share/share.php index abdddfb5584..5909102f797 100644 --- a/tests/lib/share/share.php +++ b/tests/lib/share/share.php @@ -501,6 +501,38 @@ class Test_Share extends \Test\TestCase { } + public function testSharingAFolderThatIsSharedWithAGroupOfTheOwner() { + OC_User::setUserId($this->user1); + $view = new \OC\Files\View('/' . $this->user1 . '/'); + $view->mkdir('files/test'); + $view->mkdir('files/test/sub1'); + $view->mkdir('files/test/sub1/sub2'); + + $fileInfo = $view->getFileInfo('files/test/sub1'); + $fileId = $fileInfo->getId(); + + $this->assertTrue( + OCP\Share::shareItem('folder', $fileId, OCP\Share::SHARE_TYPE_GROUP, $this->group1, \OCP\Constants::PERMISSION_READ + \OCP\Constants::PERMISSION_CREATE), + 'Failed asserting that user 1 successfully shared "test/sub1" with group 1.' + ); + + $result = OCP\Share::getItemShared('folder', $fileId, Test_Share_Backend::FORMAT_SOURCE); + $this->assertNotEmpty($result); + $this->assertEquals(\OCP\Constants::PERMISSION_READ + \OCP\Constants::PERMISSION_CREATE, $result['permissions']); + + $fileInfo = $view->getFileInfo('files/test/sub1/sub2'); + $fileId = $fileInfo->getId(); + + $this->assertTrue( + OCP\Share::shareItem('folder', $fileId, OCP\Share::SHARE_TYPE_USER, $this->user4, \OCP\Constants::PERMISSION_READ), + 'Failed asserting that user 1 successfully shared "test/sub1/sub2" with user 4.' + ); + + $result = OCP\Share::getItemShared('folder', $fileId, Test_Share_Backend::FORMAT_SOURCE); + $this->assertNotEmpty($result); + $this->assertEquals(\OCP\Constants::PERMISSION_READ, $result['permissions']); + } + protected function shareUserOneTestFileWithGroupOne() { OC_User::setUserId($this->user1); $this->assertTrue( @@ -766,6 +798,7 @@ class Test_Share extends \Test\TestCase { /** * @param boolean|string $token + * @return array */ protected function getShareByValidToken($token) { $row = OCP\Share::getShareByToken($token); |