Link shares have reshare permission if outgoing federated shares are enabled

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2020-03-05 14:56:31 +01:00
parent 58b5dad875
commit ea473114b0
No known key found for this signature in database
GPG key ID: 4C614C6ED2CDE6DF
2 changed files with 8 additions and 10 deletions

View file

@ -491,15 +491,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 !== '') {

View file

@ -616,11 +616,6 @@ class Manager implements IManager {
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 cant 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))) {