Merge pull request #26636 from nextcloud/backport/26615/stable21

[stable21] Require read permissions for federated shares
This commit is contained in:
Morris Jobke 2021-04-20 09:06:06 +02:00 committed by GitHub
commit 44bbc2454b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -38,6 +38,7 @@ namespace OCA\FederatedFileSharing;
use OC\Share20\Exception\InvalidShare;
use OC\Share20\Share;
use OCP\Constants;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\Federation\ICloudFederationProviderManager;
use OCP\Federation\ICloudIdManager;
@ -207,6 +208,13 @@ class FederatedShareProvider implements IShareProvider {
throw new \Exception($message_t);
}
// Federated shares always have read permissions
if (($share->getPermissions() & Constants::PERMISSION_READ) === 0) {
$message = 'Federated shares require read permissions';
$message_t = $this->l->t('Federated shares require read permissions');
$this->logger->debug($message, ['app' => 'Federated File Sharing']);
throw new \Exception($message_t);
}
$share->setSharedWith($cloudId->getId());