From 0324e078f8a9c9ac8141cbcd03929c66e51319ca Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Mon, 19 Apr 2021 12:53:49 +0200 Subject: [PATCH] Require read permissions for federated shares Else they end up as weird shares that can't be properly utilized by other parties anyway. Signed-off-by: Roeland Jago Douma --- apps/federatedfilesharing/lib/FederatedShareProvider.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/federatedfilesharing/lib/FederatedShareProvider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php index dfcc7175545..4660e1ccf33 100644 --- a/apps/federatedfilesharing/lib/FederatedShareProvider.php +++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php @@ -37,6 +37,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; @@ -206,6 +207,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()); -- 2.39.5