diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 68729db6de85e..18fe936427791 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -491,15 +491,18 @@ public function createShare( 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/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index ca668e24e7f2c..84f357376ed9e 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -616,11 +616,6 @@ protected function linkCreateChecks(\OCP\Share\IShare $share) { throw new \Exception('Link sharing is not allowed'); } - // Link shares by definition can't have share permissions - if ($share->getPermissions() & \OCP\Constants::PERMISSION_SHARE) { - throw new \InvalidArgumentException('Link shares can’t have reshare permissions'); - } - // Check if public upload is allowed if (!$this->shareApiLinkAllowPublicUpload() && ($share->getPermissions() & (\OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE))) {