Skip to content

Commit 64032f9

Browse files
authored
Merge pull request #27002 from nextcloud/backport/26946/stable19
[stable19] Respect default share permissions for federated reshares
2 parents fb4ec36 + 8da0ea6 commit 64032f9

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

apps/federatedfilesharing/lib/ocm/CloudFederationProviderFiles.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
use OCP\Federation\ICloudFederationShare;
4646
use OCP\Federation\ICloudIdManager;
4747
use OCP\Files\NotFoundException;
48+
use OCP\IConfig;
4849
use OCP\IDBConnection;
4950
use OCP\IGroupManager;
5051
use OCP\ILogger;
@@ -101,6 +102,9 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
101102
/** @var IGroupManager */
102103
private $groupManager;
103104

105+
/** @var IConfig */
106+
private $config;
107+
104108
/**
105109
* CloudFederationProvider constructor.
106110
*
@@ -132,7 +136,8 @@ public function __construct(IAppManager $appManager,
132136
ICloudFederationFactory $cloudFederationFactory,
133137
ICloudFederationProviderManager $cloudFederationProviderManager,
134138
IDBConnection $connection,
135-
IGroupManager $groupManager
139+
IGroupManager $groupManager,
140+
IConfig $config
136141
) {
137142
$this->appManager = $appManager;
138143
$this->federatedShareProvider = $federatedShareProvider;
@@ -148,6 +153,7 @@ public function __construct(IAppManager $appManager,
148153
$this->cloudFederationProviderManager = $cloudFederationProviderManager;
149154
$this->connection = $connection;
150155
$this->groupManager = $groupManager;
156+
$this->config = $config;
151157
}
152158

153159

@@ -636,6 +642,11 @@ protected function reshareRequested($id, array $notification) {
636642
$senderId = $notification['senderId'];
637643

638644
$share = $this->federatedShareProvider->getShareById($id);
645+
646+
// We have to respect the default share permissions
647+
$permissions = $share->getPermissions() & (int)$this->config->getAppValue('core', 'shareapi_default_permissions', (string)Constants::PERMISSION_ALL);
648+
$share->setPermissions($permissions);
649+
639650
// don't allow to share a file back to the owner
640651
try {
641652
list($user, $remote) = $this->addressHandler->splitUserRemote($shareWith);

0 commit comments

Comments
 (0)