aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/tests
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2022-12-22 15:42:42 +0100
committerGitHub <noreply@github.com>2022-12-22 15:42:42 +0100
commit628b0d8fc43249e9116421133eda7ff6be72a706 (patch)
tree7b98d118b8f617b924b07246f0b855353614f483 /apps/files_sharing/tests
parentff2b8ca8f558853fcf679a6c14db7cf8dfc73635 (diff)
parenta7abe2c35a170d60b6860aa929fe9c3c658c4bc8 (diff)
downloadnextcloud-server-628b0d8fc43249e9116421133eda7ff6be72a706.tar.gz
nextcloud-server-628b0d8fc43249e9116421133eda7ff6be72a706.zip
Merge pull request #35213 from PLUTEX/32611-ocs-api-share-permissions
Honor permissions of new link share via OCS API
Diffstat (limited to 'apps/files_sharing/tests')
-rw-r--r--apps/files_sharing/tests/ApiTest.php3
-rw-r--r--apps/files_sharing/tests/Controller/ShareAPIControllerTest.php8
2 files changed, 5 insertions, 6 deletions
diff --git a/apps/files_sharing/tests/ApiTest.php b/apps/files_sharing/tests/ApiTest.php
index 9b88297a309..4d7389be24e 100644
--- a/apps/files_sharing/tests/ApiTest.php
+++ b/apps/files_sharing/tests/ApiTest.php
@@ -211,8 +211,7 @@ class ApiTest extends TestCase {
$ocs->cleanup();
$data = $result->getData();
- $this->assertEquals(\OCP\Constants::PERMISSION_READ |
- \OCP\Constants::PERMISSION_SHARE,
+ $this->assertEquals(\OCP\Constants::PERMISSION_ALL,
$data['permissions']);
$this->assertEmpty($data['expiration']);
$this->assertTrue(is_string($data['token']));
diff --git a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
index 6f053eef124..6405181d0dc 100644
--- a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
+++ b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
@@ -2055,7 +2055,7 @@ class ShareAPIControllerTest extends TestCase {
$this->callback(function (\OCP\Share\IShare $share) use ($path) {
return $share->getNode() === $path &&
$share->getShareType() === IShare::TYPE_LINK &&
- $share->getPermissions() === \OCP\Constants::PERMISSION_READ &&
+ $share->getPermissions() === \OCP\Constants::PERMISSION_ALL &&
$share->getSharedBy() === 'currentUser' &&
$share->getPassword() === 'password' &&
$share->getExpirationDate() === null;
@@ -2095,7 +2095,7 @@ class ShareAPIControllerTest extends TestCase {
$this->callback(function (\OCP\Share\IShare $share) use ($path) {
return $share->getNode() === $path &&
$share->getShareType() === IShare::TYPE_LINK &&
- $share->getPermissions() === \OCP\Constants::PERMISSION_READ &&
+ $share->getPermissions() === \OCP\Constants::PERMISSION_ALL &&
$share->getSharedBy() === 'currentUser' &&
$share->getPassword() === 'password' &&
$share->getSendPasswordByTalk() === true &&
@@ -2179,7 +2179,7 @@ class ShareAPIControllerTest extends TestCase {
return $share->getNode() === $path &&
$share->getShareType() === IShare::TYPE_LINK &&
- $share->getPermissions() === \OCP\Constants::PERMISSION_READ &&
+ $share->getPermissions() === \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE &&
$share->getSharedBy() === 'currentUser' &&
$share->getPassword() === null &&
$share->getExpirationDate() == $date;
@@ -2187,7 +2187,7 @@ class ShareAPIControllerTest extends TestCase {
)->willReturnArgument(0);
$expected = new DataResponse([]);
- $result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', '', null, '2000-01-01');
+ $result = $ocs->createShare('valid-path', null, IShare::TYPE_LINK, null, 'false', '', null, '2000-01-01');
$this->assertInstanceOf(get_class($expected), $result);
$this->assertEquals($expected->getData(), $result->getData());