Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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);

Expand Down
54 changes: 11 additions & 43 deletions lib/ShareByCircleProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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
*
Expand Down
3 changes: 0 additions & 3 deletions tests/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,6 @@
<RedundantCondition>
<code><![CDATA[isset($this->logger)]]></code>
</RedundantCondition>
<RedundantPropertyInitializationCheck>
<code><![CDATA[isset($this->logger)]]></code>
</RedundantPropertyInitializationCheck>
<UndefinedClass>
<code><![CDATA[HintException]]></code>
</UndefinedClass>
Expand Down
Loading