diff --git a/apps/user_ldap/lib/AppInfo/Application.php b/apps/user_ldap/lib/AppInfo/Application.php index 76462698280..79766682872 100644 --- a/apps/user_ldap/lib/AppInfo/Application.php +++ b/apps/user_ldap/lib/AppInfo/Application.php @@ -1,5 +1,7 @@ getContainer(); - - /** - * Controller - */ - $container->registerService('RenewPasswordController', function (ContainerInterface $appContainer) { - return new RenewPasswordController( - $appContainer->get('AppName'), - $appContainer->get(IRequest::class), - $appContainer->get(IUserManager::class), - $appContainer->get(IConfig::class), - $appContainer->get(IUserConfig::class), - $appContainer->get(IL10N::class), - $appContainer->get('Session'), - $appContainer->get(IURLGenerator::class), - $appContainer->get(IInitialState::class), - ); - }); - - $container->registerService(ILDAPWrapper::class, function (ContainerInterface $appContainer) { - return new LDAP( - $appContainer->get(IConfig::class)->getSystemValueString('ldap_log_file') - ); - }); } public function register(IRegistrationContext $context): void { + $context->registerService(ILDAPWrapper::class, function (ContainerInterface $c) { + return new LDAP( + $c->get(IConfig::class)->getSystemValueString('ldap_log_file') + ); + }); + $context->registerNotifierService(Notifier::class); $context->registerService( diff --git a/apps/user_ldap/lib/LDAPProvider.php b/apps/user_ldap/lib/LDAPProvider.php index fad0da7f206..a15031b0e3c 100644 --- a/apps/user_ldap/lib/LDAPProvider.php +++ b/apps/user_ldap/lib/LDAPProvider.php @@ -5,38 +5,38 @@ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\User_LDAP; use OCA\User_LDAP\User\DeletedUsersIndex; -use OCP\IServerContainer; +use OCP\GroupInterface; +use OCP\IGroupManager; +use OCP\IUserManager; use OCP\LDAP\IDeletionFlagSupport; use OCP\LDAP\ILDAPProvider; +use OCP\UserInterface; use Psr\Log\LoggerInterface; /** * LDAP provider for public access to the LDAP backend. */ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport { - private $userBackend; - private $groupBackend; - private $logger; + private IUserLDAP&UserInterface $userBackend; + private IGroupLDAP&GroupInterface $groupBackend; /** - * Create new LDAPProvider - * @param IServerContainer $serverContainer - * @param Helper $helper - * @param DeletedUsersIndex $deletedUsersIndex * @throws \Exception if user_ldap app was not enabled */ public function __construct( - IServerContainer $serverContainer, + IUserManager $userManager, + IGroupManager $groupManager, private Helper $helper, private DeletedUsersIndex $deletedUsersIndex, + private LoggerInterface $logger, ) { - $this->logger = $serverContainer->get(LoggerInterface::class); $userBackendFound = false; $groupBackendFound = false; - foreach ($serverContainer->getUserManager()->getBackends() as $backend) { + foreach ($userManager->getBackends() as $backend) { $this->logger->debug('instance ' . get_class($backend) . ' user backend.', ['app' => 'user_ldap']); if ($backend instanceof IUserLDAP) { $this->userBackend = $backend; @@ -44,7 +44,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport { break; } } - foreach ($serverContainer->getGroupManager()->getBackends() as $backend) { + foreach ($groupManager->getBackends() as $backend) { $this->logger->debug('instance ' . get_class($backend) . ' group backend.', ['app' => 'user_ldap']); if ($backend instanceof IGroupLDAP) { $this->groupBackend = $backend; diff --git a/apps/user_ldap/lib/LDAPProviderFactory.php b/apps/user_ldap/lib/LDAPProviderFactory.php index 8fad9d52206..b91f92f2519 100644 --- a/apps/user_ldap/lib/LDAPProviderFactory.php +++ b/apps/user_ldap/lib/LDAPProviderFactory.php @@ -1,20 +1,22 @@