Skip to content

Commit

Permalink
Link shares have reshare permission if outgoing federated shares are …
Browse files Browse the repository at this point in the history
…enabled

Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliusknorr committed Mar 5, 2020
1 parent 58b5dad commit ea47311
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
13 changes: 8 additions & 5 deletions apps/files_sharing/lib/Controller/ShareAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 !== '') {
Expand Down
5 changes: 0 additions & 5 deletions lib/private/Share20/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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))) {
Expand Down

0 comments on commit ea47311

Please sign in to comment.