diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index 58cf03421..0717a1c25 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -45,6 +45,7 @@
use OCA\Circles\Notification\Notifier;
use OCA\Circles\Search\UnifiedSearchProvider;
use OCA\Circles\Service\ConfigService;
+use OCA\Circles\ShareByCircleProvider;
use OCP\Accounts\UserUpdatedEvent;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
@@ -57,6 +58,7 @@
use OCP\Group\Events\UserAddedEvent;
use OCP\Group\Events\UserRemovedEvent;
use OCP\IServerContainer;
+use OCP\Share\IManager as IShareManager;
use OCP\User\Events\UserChangedEvent;
use OCP\User\Events\UserCreatedEvent;
use OCP\User\Events\UserDeletedEvent;
@@ -131,6 +133,10 @@ public function register(IRegistrationContext $context): void {
public function boot(IBootContext $context): void {
$serverContainer = $context->getServerContainer();
+ $context->injectFn(function (IShareManager $shareManager) {
+ $shareManager->registerShareProvider(ShareByCircleProvider::class);
+ });
+
$this->configService = $context->getAppContainer()
->get(ConfigService::class);
diff --git a/lib/ShareByCircleProvider.php b/lib/ShareByCircleProvider.php
index 59651b111..c396eaa47 100644
--- a/lib/ShareByCircleProvider.php
+++ b/lib/ShareByCircleProvider.php
@@ -2,13 +2,11 @@
declare(strict_types=1);
-
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCA\Circles;
use Exception;
@@ -52,12 +50,9 @@
use OCP\Files\IRootFolder;
use OCP\Files\Node;
use OCP\Files\NotFoundException;
-use OCP\IDBConnection;
use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\IUserManager;
-use OCP\Security\ISecureRandom;
-use OCP\Server;
use OCP\Share\Exceptions\AlreadySharedException;
use OCP\Share\Exceptions\IllegalIDChangeException;
use OCP\Share\Exceptions\ShareNotFound;
@@ -75,54 +70,27 @@ class ShareByCircleProvider implements IShareProvider {
use TStringTools;
use TNCLogger;
-
public const IDENTIFIER = 'ocCircleShare';
-
- private IUserManager $userManager;
- private IRootFolder $rootFolder;
- private IL10N $l10n;
- private LoggerInterface $logger;
- private IURLGenerator $urlGenerator;
- private ShareWrapperService $shareWrapperService;
- private ShareTokenService $shareTokenService;
- private FederatedUserService $federatedUserService;
- private FederatedEventService $federatedEventService;
- private CircleService $circleService;
- private EventService $eventService;
-
public function __construct(
- IDBConnection $connection,
- ISecureRandom $secureRandom,
- IUserManager $userManager,
- IRootFolder $rootFolder,
- IL10N $l10n,
- mixed $logger, // unused, only kept for compatibility with server
- IURLGenerator $urlGenerator,
+ private IUserManager $userManager,
+ private IRootFolder $rootFolder,
+ private IL10N $l10n,
+ private LoggerInterface $logger,
+ private IURLGenerator $urlGenerator,
+ private ShareWrapperService $shareWrapperService,
+ private ShareTokenService $shareTokenService,
+ private FederatedUserService $federatedUserService,
+ private FederatedEventService $federatedEventService,
+ private CircleService $circleService,
+ private EventService $eventService,
) {
- $this->userManager = $userManager;
- $this->rootFolder = $rootFolder;
- $this->l10n = $l10n;
- $this->logger = Server::get(LoggerInterface::class);
- $this->urlGenerator = $urlGenerator;
-
- $this->federatedUserService = Server::get(FederatedUserService::class);
- $this->federatedEventService = Server::get(FederatedEventService::class);
- $this->shareWrapperService = Server::get(ShareWrapperService::class);
- $this->shareTokenService = Server::get(ShareTokenService::class);
- $this->circleService = Server::get(CircleService::class);
- $this->eventService = Server::get(EventService::class);
}
-
- /**
- * @return string
- */
public function identifier(): string {
return self::IDENTIFIER;
}
-
/**
* @param IShare $share
*
diff --git a/tests/psalm-baseline.xml b/tests/psalm-baseline.xml
index f17d28283..24c0b3ca5 100644
--- a/tests/psalm-baseline.xml
+++ b/tests/psalm-baseline.xml
@@ -335,9 +335,6 @@
logger)]]>
-
- logger)]]>
-