diff options
author | Julius Härtl <jus@bitgrid.net> | 2020-03-05 14:56:31 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2020-04-21 14:35:29 +0200 |
commit | 5646f7c76168b490574fadf9489872efa0dbd808 (patch) | |
tree | e6ceeac44ea8d01da197e9528c4116de3fa34ed1 /apps | |
parent | 45c3ee7f368d0980fca6729c10f62d7234529733 (diff) | |
download | nextcloud-server-5646f7c76168b490574fadf9489872efa0dbd808.tar.gz nextcloud-server-5646f7c76168b490574fadf9489872efa0dbd808.zip |
Link shares have reshare permission if outgoing federated shares are enabled
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/lib/Controller/ShareAPIController.php | 13 | ||||
-rw-r--r-- | apps/files_sharing/tests/ApiTest.php | 7 |
2 files changed, 13 insertions, 7 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 37dc76faaaf..12324daea39 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -492,15 +492,18 @@ class ShareAPIController extends OCSController { throw new OCSNotFoundException($this->l->t('Public upload is only possible for publicly shared folders')); } - $share->setPermissions( - Constants::PERMISSION_READ | + $permissions = Constants::PERMISSION_READ | Constants::PERMISSION_CREATE | Constants::PERMISSION_UPDATE | - Constants::PERMISSION_DELETE - ); + Constants::PERMISSION_DELETE; } else { - $share->setPermissions(Constants::PERMISSION_READ); + $permissions = Constants::PERMISSION_READ; + } + // TODO: It might make sense to have a dedicated setting to allow/deny converting link shares into federated ones + if ($this->shareManager->outgoingServer2ServerSharesAllowed()) { + $permissions |= Constants::PERMISSION_SHARE; } + $share->setPermissions($permissions); // Set password if ($password !== '') { diff --git a/apps/files_sharing/tests/ApiTest.php b/apps/files_sharing/tests/ApiTest.php index 6bbb62d6090..f4100bd5e82 100644 --- a/apps/files_sharing/tests/ApiTest.php +++ b/apps/files_sharing/tests/ApiTest.php @@ -203,7 +203,9 @@ class ApiTest extends TestCase { $ocs->cleanup(); $data = $result->getData(); - $this->assertEquals(1, $data['permissions']); + $this->assertEquals(\OCP\Constants::PERMISSION_READ | + \OCP\Constants::PERMISSION_SHARE, + $data['permissions']); $this->assertEmpty($data['expiration']); $this->assertTrue(is_string($data['token'])); @@ -228,7 +230,8 @@ class ApiTest extends TestCase { \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE | - \OCP\Constants::PERMISSION_DELETE, + \OCP\Constants::PERMISSION_DELETE | + \OCP\Constants::PERMISSION_SHARE, $data['permissions'] ); $this->assertEmpty($data['expiration']); |