diff options
author | Robin Appelman <robin@icewind.nl> | 2021-08-13 18:02:27 +0300 |
---|---|---|
committer | John Molakvoæ <skjnldsv@protonmail.com> | 2021-10-19 12:32:15 +0300 |
commit | 033a83b0ace2dd12be7329c458a93e89da0ca207 (patch) | |
tree | ce8db32554400e855789515d9e5009a2603106fb /apps/federatedfilesharing/lib | |
parent | ef93d2ea1c089d65660591857e5f6a1608210d3c (diff) |
fix federated sharing
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/federatedfilesharing/lib')
-rw-r--r-- | apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php | 59 |
1 files changed, 25 insertions, 34 deletions
diff --git a/apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php b/apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php index 916a8538c6e..370ef8dc32a 100644 --- a/apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php +++ b/apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php @@ -33,10 +33,10 @@ use OC\Files\Filesystem; use OCA\FederatedFileSharing\AddressHandler; use OCA\FederatedFileSharing\FederatedShareProvider; use OCA\Files_Sharing\Activity\Providers\RemoteShares; +use OCA\Files_Sharing\External\Manager; use OCP\Activity\IManager as IActivityManager; use OCP\App\IAppManager; use OCP\Constants; -use OCP\EventDispatcher\IEventDispatcher; use OCP\Federation\Exceptions\ActionNotSupportedException; use OCP\Federation\Exceptions\AuthenticationFailedException; use OCP\Federation\Exceptions\BadRequestException; @@ -59,7 +59,6 @@ use OCP\Share\Exceptions\ShareNotFound; use OCP\Share\IManager; use OCP\Share\IShare; use OCP\Util; -use Psr\Log\LoggerInterface; class CloudFederationProviderFiles implements ICloudFederationProvider { @@ -108,6 +107,9 @@ class CloudFederationProviderFiles implements ICloudFederationProvider { /** @var IConfig */ private $config; + /** @var Manager */ + private $externalShareManager; + /** * CloudFederationProvider constructor. * @@ -125,22 +127,26 @@ class CloudFederationProviderFiles implements ICloudFederationProvider { * @param ICloudFederationProviderManager $cloudFederationProviderManager * @param IDBConnection $connection * @param IGroupManager $groupManager + * @param IConfig $config + * @param Manager $externalShareManager */ - public function __construct(IAppManager $appManager, - FederatedShareProvider $federatedShareProvider, - AddressHandler $addressHandler, - ILogger $logger, - IUserManager $userManager, - IManager $shareManager, - ICloudIdManager $cloudIdManager, - IActivityManager $activityManager, - INotificationManager $notificationManager, - IURLGenerator $urlGenerator, - ICloudFederationFactory $cloudFederationFactory, - ICloudFederationProviderManager $cloudFederationProviderManager, - IDBConnection $connection, - IGroupManager $groupManager, - IConfig $config + public function __construct( + IAppManager $appManager, + FederatedShareProvider $federatedShareProvider, + AddressHandler $addressHandler, + ILogger $logger, + IUserManager $userManager, + IManager $shareManager, + ICloudIdManager $cloudIdManager, + IActivityManager $activityManager, + INotificationManager $notificationManager, + IURLGenerator $urlGenerator, + ICloudFederationFactory $cloudFederationFactory, + ICloudFederationProviderManager $cloudFederationProviderManager, + IDBConnection $connection, + IGroupManager $groupManager, + IConfig $config, + Manager $externalShareManager ) { $this->appManager = $appManager; $this->federatedShareProvider = $federatedShareProvider; @@ -157,6 +163,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider { $this->connection = $connection; $this->groupManager = $groupManager; $this->config = $config; + $this->externalShareManager = $externalShareManager; } @@ -239,24 +246,8 @@ class CloudFederationProviderFiles implements ICloudFederationProvider { throw new ProviderCouldNotAddShareException('Group does not exists', '',Http::STATUS_BAD_REQUEST); } - $externalManager = new \OCA\Files_Sharing\External\Manager( - \OC::$server->getDatabaseConnection(), - Filesystem::getMountManager(), - Filesystem::getLoader(), - \OC::$server->getHTTPClientService(), - \OC::$server->getNotificationManager(), - \OC::$server->query(\OCP\OCS\IDiscoveryService::class), - \OC::$server->getCloudFederationProviderManager(), - \OC::$server->getCloudFederationFactory(), - \OC::$server->getGroupManager(), - \OC::$server->getUserManager(), - $shareWith, - \OC::$server->query(IEventDispatcher::class), - \OC::$server->get(LoggerInterface::class) - ); - try { - $externalManager->addShare($remote, $token, '', $name, $owner, $shareType,false, $shareWith, $remoteId); + $this->externalShareManager->addShare($remote, $token, '', $name, $owner, $shareType,false, $shareWith, $remoteId); $shareId = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share_external'); if ($shareType === IShare::TYPE_USER) { |