diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2021-04-19 12:53:49 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2021-04-19 12:53:49 +0200 |
commit | 5c42c303e46ca1a83e3c02cc79e46f72ff38d5b2 (patch) | |
tree | 6d69d57f5e35cddf41db07f776eb911eb99e1333 /apps/federatedfilesharing/lib | |
parent | 8c82dd37b4cd023e3a5b8ee492800134e4544f4a (diff) | |
download | nextcloud-server-5c42c303e46ca1a83e3c02cc79e46f72ff38d5b2.tar.gz nextcloud-server-5c42c303e46ca1a83e3c02cc79e46f72ff38d5b2.zip |
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 <roeland@famdouma.nl>
Diffstat (limited to 'apps/federatedfilesharing/lib')
-rw-r--r-- | apps/federatedfilesharing/lib/FederatedShareProvider.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/apps/federatedfilesharing/lib/FederatedShareProvider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php index 045bfecd5a2..733ce27b596 100644 --- a/apps/federatedfilesharing/lib/FederatedShareProvider.php +++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php @@ -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; @@ -208,6 +209,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()); |