diff options
author | Roeland Jago Douma <rullzer@owncloud.com> | 2016-04-01 17:02:59 +0200 |
---|---|---|
committer | Roeland Jago Douma <rullzer@owncloud.com> | 2016-04-08 14:17:05 +0200 |
commit | bd3bde2f3bccb8550f1dbe3c8b254052e8b38865 (patch) | |
tree | f447d2e8aeda717e389a1e9f9c92ce82d4da01f5 /tests | |
parent | 6eefea1bb65897b0a1cf8668b15998a12ae197b9 (diff) | |
download | nextcloud-server-bd3bde2f3bccb8550f1dbe3c8b254052e8b38865.tar.gz nextcloud-server-bd3bde2f3bccb8550f1dbe3c8b254052e8b38865.zip |
Set proper permissions on link share
If we do not allow public upload we should limit the permissions on
links shares upon retrieval.
* Added unit test
* Allow fetching federated shares by token as well
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/share20/managertest.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/lib/share20/managertest.php b/tests/lib/share20/managertest.php index 029c8cd8543..d8eb3e0a31e 100644 --- a/tests/lib/share20/managertest.php +++ b/tests/lib/share20/managertest.php @@ -2084,6 +2084,25 @@ class ManagerTest extends \Test\TestCase { $this->assertSame($share, $res); } + public function testGetShareByTokenPublicSharingDisabled() { + $share = $this->manager->newShare(); + $share->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setPermissions(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE); + + $this->config->method('getAppValue')->will($this->returnValueMap([ + ['core', 'shareapi_allow_public_upload', 'yes', 'no'], + ])); + + $this->defaultProvider->expects($this->once()) + ->method('getShareByToken') + ->willReturn('validToken') + ->willReturn($share); + + $res = $this->manager->getShareByToken('validToken'); + + $this->assertSame(\OCP\Constants::PERMISSION_READ, $res->getPermissions()); + } + public function testCheckPasswordNoLinkShare() { $share = $this->getMock('\OCP\Share\IShare'); $share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_USER); |