summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2021-05-11 16:09:25 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2021-05-17 09:48:31 +0200
commit3854e7f8f00f18f8227c4b14a32eb0ca0ea000d4 (patch)
treedcd9a182ac0d997ad9a88c83484ed39a20e302f7 /apps
parent77a4368418e0e375215de94ab96daf4b5336a4cb (diff)
downloadnextcloud-server-3854e7f8f00f18f8227c4b14a32eb0ca0ea000d4.tar.gz
nextcloud-server-3854e7f8f00f18f8227c4b14a32eb0ca0ea000d4.zip
Respect default share permissions for federated reshares
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps')
-rw-r--r--apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php b/apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php
index e21ce633dd2..b5499ec6ec6 100644
--- a/apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php
+++ b/apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php
@@ -49,6 +49,7 @@ use OCP\Federation\ICloudFederationProviderManager;
use OCP\Federation\ICloudFederationShare;
use OCP\Federation\ICloudIdManager;
use OCP\Files\NotFoundException;
+use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IGroupManager;
use OCP\ILogger;
@@ -105,6 +106,9 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
/** @var IGroupManager */
private $groupManager;
+ /** @var IConfig */
+ private $config;
+
/**
* CloudFederationProvider constructor.
*
@@ -136,7 +140,8 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
ICloudFederationFactory $cloudFederationFactory,
ICloudFederationProviderManager $cloudFederationProviderManager,
IDBConnection $connection,
- IGroupManager $groupManager
+ IGroupManager $groupManager,
+ IConfig $config
) {
$this->appManager = $appManager;
$this->federatedShareProvider = $federatedShareProvider;
@@ -152,6 +157,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
$this->cloudFederationProviderManager = $cloudFederationProviderManager;
$this->connection = $connection;
$this->groupManager = $groupManager;
+ $this->config = $config;
}
@@ -641,6 +647,11 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
$senderId = $notification['senderId'];
$share = $this->federatedShareProvider->getShareById($id);
+
+ // We have to respect the default share permissions
+ $permissions = $share->getPermissions() & (int)$this->config->getAppValue('core', 'shareapi_default_permissions', (string)Constants::PERMISSION_ALL);
+ $share->setPermissions($permissions);
+
// don't allow to share a file back to the owner
try {
[$user, $remote] = $this->addressHandler->splitUserRemote($shareWith);