Merge pull request #27002 from nextcloud/backport/26946/stable19
[stable19] Respect default share permissions for federated reshares
This commit is contained in:
commit
64032f9241
|
@ -45,6 +45,7 @@ use OCP\Federation\ICloudFederationProviderManager;
|
||||||
use OCP\Federation\ICloudFederationShare;
|
use OCP\Federation\ICloudFederationShare;
|
||||||
use OCP\Federation\ICloudIdManager;
|
use OCP\Federation\ICloudIdManager;
|
||||||
use OCP\Files\NotFoundException;
|
use OCP\Files\NotFoundException;
|
||||||
|
use OCP\IConfig;
|
||||||
use OCP\IDBConnection;
|
use OCP\IDBConnection;
|
||||||
use OCP\IGroupManager;
|
use OCP\IGroupManager;
|
||||||
use OCP\ILogger;
|
use OCP\ILogger;
|
||||||
|
@ -101,6 +102,9 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
|
||||||
/** @var IGroupManager */
|
/** @var IGroupManager */
|
||||||
private $groupManager;
|
private $groupManager;
|
||||||
|
|
||||||
|
/** @var IConfig */
|
||||||
|
private $config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CloudFederationProvider constructor.
|
* CloudFederationProvider constructor.
|
||||||
*
|
*
|
||||||
|
@ -132,7 +136,8 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
|
||||||
ICloudFederationFactory $cloudFederationFactory,
|
ICloudFederationFactory $cloudFederationFactory,
|
||||||
ICloudFederationProviderManager $cloudFederationProviderManager,
|
ICloudFederationProviderManager $cloudFederationProviderManager,
|
||||||
IDBConnection $connection,
|
IDBConnection $connection,
|
||||||
IGroupManager $groupManager
|
IGroupManager $groupManager,
|
||||||
|
IConfig $config
|
||||||
) {
|
) {
|
||||||
$this->appManager = $appManager;
|
$this->appManager = $appManager;
|
||||||
$this->federatedShareProvider = $federatedShareProvider;
|
$this->federatedShareProvider = $federatedShareProvider;
|
||||||
|
@ -148,6 +153,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
|
||||||
$this->cloudFederationProviderManager = $cloudFederationProviderManager;
|
$this->cloudFederationProviderManager = $cloudFederationProviderManager;
|
||||||
$this->connection = $connection;
|
$this->connection = $connection;
|
||||||
$this->groupManager = $groupManager;
|
$this->groupManager = $groupManager;
|
||||||
|
$this->config = $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -636,6 +642,11 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
|
||||||
$senderId = $notification['senderId'];
|
$senderId = $notification['senderId'];
|
||||||
|
|
||||||
$share = $this->federatedShareProvider->getShareById($id);
|
$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
|
// don't allow to share a file back to the owner
|
||||||
try {
|
try {
|
||||||
list($user, $remote) = $this->addressHandler->splitUserRemote($shareWith);
|
list($user, $remote) = $this->addressHandler->splitUserRemote($shareWith);
|
||||||
|
|
Loading…
Reference in New Issue