diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-05-25 12:18:28 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-05-25 12:18:28 +0200 |
commit | add59d2309cc902923aab60dd4348164eed033fc (patch) | |
tree | e513b103bc6f71e20364b32dcd891e5a34201131 /apps/user_ldap/lib | |
parent | 47bb12b226065f18d7b8b166c45903180ffb654a (diff) | |
download | nextcloud-server-add59d2309cc902923aab60dd4348164eed033fc.tar.gz nextcloud-server-add59d2309cc902923aab60dd4348164eed033fc.zip |
Use DI for DeletedUsersIndex and fix tests
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/user_ldap/lib')
-rw-r--r-- | apps/user_ldap/lib/User_LDAP.php | 36 | ||||
-rw-r--r-- | apps/user_ldap/lib/User_Proxy.php | 21 |
2 files changed, 33 insertions, 24 deletions
diff --git a/apps/user_ldap/lib/User_LDAP.php b/apps/user_ldap/lib/User_LDAP.php index 61abb1627f9..fcd5a009e41 100644 --- a/apps/user_ldap/lib/User_LDAP.php +++ b/apps/user_ldap/lib/User_LDAP.php @@ -56,33 +56,27 @@ use OCP\UserInterface; use Psr\Log\LoggerInterface; class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, IUserLDAP, ICountUsersBackend, ICountMappedUsersBackend, IProvideEnabledStateBackend { - /** @var \OCP\IConfig */ - protected $ocConfig; - - /** @var INotificationManager */ - protected $notificationManager; - - /** @var UserPluginManager */ - protected $userPluginManager; - - /** @var LoggerInterface */ - protected $logger; - + protected IConfig $ocConfig; + protected INotificationManager $notificationManager; + protected UserPluginManager $userPluginManager; + protected LoggerInterface $logger; protected DeletedUsersIndex $deletedUsersIndex; - /** - * @param Access $access - * @param \OCP\IConfig $ocConfig - * @param \OCP\Notification\IManager $notificationManager - * @param IUserSession $userSession - */ - public function __construct(Access $access, IConfig $ocConfig, INotificationManager $notificationManager, IUserSession $userSession, UserPluginManager $userPluginManager) { + public function __construct( + Access $access, + IConfig $ocConfig, + INotificationManager $notificationManager, + IUserSession $userSession, + UserPluginManager $userPluginManager, + LoggerInterface $logger, + DeletedUsersIndex $deletedUsersIndex, + ) { parent::__construct($access); $this->ocConfig = $ocConfig; $this->notificationManager = $notificationManager; $this->userPluginManager = $userPluginManager; - $this->logger = \OC::$server->get(LoggerInterface::class); - $this->deletedUsersIndex = \OC::$server->get(DeletedUsersIndex::class); + $this->logger = $logger; + $this->deletedUsersIndex = $deletedUsersIndex; } /** diff --git a/apps/user_ldap/lib/User_Proxy.php b/apps/user_ldap/lib/User_Proxy.php index 59f72c2c2f3..c95329cebed 100644 --- a/apps/user_ldap/lib/User_Proxy.php +++ b/apps/user_ldap/lib/User_Proxy.php @@ -31,6 +31,7 @@ */ namespace OCA\User_LDAP; +use OCA\User_LDAP\User\DeletedUsersIndex; use OCA\User_LDAP\User\User; use OCP\IConfig; use OCP\IUserBackend; @@ -40,6 +41,7 @@ use OCP\UserInterface; use OCP\User\Backend\ICountMappedUsersBackend; use OCP\User\Backend\ICountUsersBackend; use OCP\User\Backend\IProvideEnabledStateBackend; +use Psr\Log\LoggerInterface; class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP, ICountUsersBackend, ICountMappedUsersBackend, IProvideEnabledStateBackend { /** @var User_LDAP[] */ @@ -52,6 +54,8 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP private INotificationManager $notificationManager; private IUserSession $userSession; private UserPluginManager $userPluginManager; + private LoggerInterface $logger; + private DeletedUsersIndex $deletedUsersIndex; public function __construct( Helper $helper, @@ -60,7 +64,9 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP IConfig $ocConfig, INotificationManager $notificationManager, IUserSession $userSession, - UserPluginManager $userPluginManager + UserPluginManager $userPluginManager, + LoggerInterface $logger, + DeletedUsersIndex $deletedUsersIndex, ) { parent::__construct($ldap, $accessFactory); $this->helper = $helper; @@ -68,6 +74,8 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP $this->notificationManager = $notificationManager; $this->userSession = $userSession; $this->userPluginManager = $userPluginManager; + $this->logger = $logger; + $this->deletedUsersIndex = $deletedUsersIndex; } protected function setup(): void { @@ -77,8 +85,15 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP $serverConfigPrefixes = $this->helper->getServerConfigurationPrefixes(true); foreach ($serverConfigPrefixes as $configPrefix) { - $this->backends[$configPrefix] = - new User_LDAP($this->getAccess($configPrefix), $this->ocConfig, $this->notificationManager, $this->userSession, $this->userPluginManager); + $this->backends[$configPrefix] = new User_LDAP( + $this->getAccess($configPrefix), + $this->ocConfig, + $this->notificationManager, + $this->userSession, + $this->userPluginManager, + $this->logger, + $this->deletedUsersIndex, + ); if (is_null($this->refBackend)) { $this->refBackend = &$this->backends[$configPrefix]; |