]> source.dussan.org Git - nextcloud-server.git/commitdiff
Do not use custom DI object names for user_ldap 21820/head
authorMorris Jobke <hey@morrisjobke.de>
Mon, 13 Jul 2020 15:22:19 +0000 (17:22 +0200)
committerMorris Jobke <hey@morrisjobke.de>
Mon, 13 Jul 2020 15:22:19 +0000 (17:22 +0200)
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
15 files changed:
apps/user_ldap/appinfo/app.php
apps/user_ldap/appinfo/register_command.php
apps/user_ldap/lib/Command/Search.php
apps/user_ldap/lib/Helper.php
apps/user_ldap/lib/Jobs/CleanUp.php
apps/user_ldap/lib/Jobs/UpdateGroups.php
apps/user_ldap/lib/Migration/UUIDFixGroup.php
apps/user_ldap/lib/Migration/UUIDFixUser.php
apps/user_ldap/tests/Integration/AbstractIntegrationTest.php
apps/user_ldap/tests/Integration/Lib/IntegrationTestAttributeDetection.php
apps/user_ldap/tests/Integration/Lib/IntegrationTestFetchUsersByLoginName.php
apps/user_ldap/tests/Integration/Lib/IntegrationTestPaging.php
apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserAvatar.php
apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserCleanUp.php
apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserDisplayName.php

index c2d61ba61a239bc0dd9df212de83bd96b1d1be9c..93a4253bd4f6df4266c08e0749d3166abc1ebea6 100644 (file)
  *
  */
 
-\OC::$server->registerService('LDAPUserPluginManager', function () {
-       return new OCA\User_LDAP\UserPluginManager();
-});
-\OC::$server->registerService('LDAPGroupPluginManager', function () {
-       return new OCA\User_LDAP\GroupPluginManager();
-});
-
 $app = \OC::$server->query(\OCA\User_LDAP\AppInfo\Application::class);
 
 $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
@@ -45,8 +38,8 @@ if (count($configPrefixes) > 0) {
        $notificationManager->registerNotifierService(\OCA\User_LDAP\Notification\Notifier::class);
        $userSession = \OC::$server->getUserSession();
 
-       $userPluginManager = \OC::$server->query('LDAPUserPluginManager');
-       $groupPluginManager = \OC::$server->query('LDAPGroupPluginManager');
+       $userPluginManager = \OC::$server->query(\OCA\User_LDAP\UserPluginManager::class);
+       $groupPluginManager = \OC::$server->query(\OCA\User_LDAP\GroupPluginManager::class);
 
        $userBackend  = new OCA\User_LDAP\User_Proxy(
                $configPrefixes, $ldapWrapper, $ocConfig, $notificationManager, $userSession, $userPluginManager
index 3f2fc4e78e8f9ca5b3eaa5467baea2ad2fa61369..cdfc6fd9b169718f84957ab7d35a7d1e6a208c3b 100644 (file)
@@ -41,7 +41,7 @@ $uBackend = new User_Proxy(
        $ocConfig,
        \OC::$server->getNotificationManager(),
        \OC::$server->getUserSession(),
-       \OC::$server->query('LDAPUserPluginManager')
+       \OC::$server->query(\OCA\User_LDAP\UserPluginManager::class)
 );
 $deletedUsersIndex = new DeletedUsersIndex(
        $ocConfig, $dbConnection, $userMapping
index f19c11a46665b853ed8ba84cdd3f10697cc34fd0..9592241924c3241944a0dd80908fcd904d420d8d 100644 (file)
 namespace OCA\User_LDAP\Command;
 
 use OCA\User_LDAP\Group_Proxy;
+use OCA\User_LDAP\GroupPluginManager;
 use OCA\User_LDAP\Helper;
 use OCA\User_LDAP\LDAP;
 use OCA\User_LDAP\User_Proxy;
+use OCA\User_LDAP\UserPluginManager;
 use OCP\IConfig;
 
 use Symfony\Component\Console\Command\Command;
@@ -115,7 +117,7 @@ class Search extends Command {
                $this->validateOffsetAndLimit($offset, $limit);
 
                if ($input->getOption('group')) {
-                       $proxy = new Group_Proxy($configPrefixes, $ldapWrapper, \OC::$server->query('LDAPGroupPluginManager'));
+                       $proxy = new Group_Proxy($configPrefixes, $ldapWrapper, \OC::$server->query(GroupPluginManager::class));
                        $getMethod = 'getGroups';
                        $printID = false;
                        // convert the limit of groups to null. This will show all the groups available instead of
@@ -130,7 +132,7 @@ class Search extends Command {
                                $this->ocConfig,
                                \OC::$server->getNotificationManager(),
                                \OC::$server->getUserSession(),
-                               \OC::$server->query('LDAPUserPluginManager')
+                               \OC::$server->query(UserPluginManager::class)
                        );
                        $getMethod = 'getDisplayNames';
                        $printID = true;
index 05e56c318afeb8d7185816f47dd3b59eba3dbe68..a8d66998148accbf1cef038b0922fa4745061f3d 100644 (file)
@@ -321,7 +321,7 @@ class Helper {
                $notificationManager = \OC::$server->getNotificationManager();
 
                $userSession = \OC::$server->getUserSession();
-               $userPluginManager = \OC::$server->query('LDAPUserPluginManager');
+               $userPluginManager = \OC::$server->query(UserPluginManager::class);
 
                $userBackend = new User_Proxy(
                        $configPrefixes, $ldapWrapper, $ocConfig, $notificationManager, $userSession, $userPluginManager
index c97eb237a649a0e32f967b1f8fee1d798c41c156..b516e08b9e195c665d6bff706772a7550b07e604 100644 (file)
@@ -35,6 +35,7 @@ use OCA\User_LDAP\Mapping\UserMapping;
 use OCA\User_LDAP\User\DeletedUsersIndex;
 use OCA\User_LDAP\User_LDAP;
 use OCA\User_LDAP\User_Proxy;
+use OCA\User_LDAP\UserPluginManager;
 
 /**
  * Class CleanUp
@@ -105,7 +106,7 @@ class CleanUp extends TimedJob {
                                $this->ocConfig,
                                \OC::$server->getNotificationManager(),
                                \OC::$server->getUserSession(),
-                               \OC::$server->query('LDAPUserPluginManager')
+                               \OC::$server->query(UserPluginManager::class)
                        );
                }
 
index 6241483cb92b785da95ab3b3a16e63b7c5b5b41a..58254bf41e9ecd0a5edf578f823cdead82994ce3 100644 (file)
@@ -37,6 +37,7 @@ namespace OCA\User_LDAP\Jobs;
 use OCA\User_LDAP\Access;
 use OCA\User_LDAP\Connection;
 use OCA\User_LDAP\FilesystemHelper;
+use OCA\User_LDAP\GroupPluginManager;
 use OCA\User_LDAP\Helper;
 use OCA\User_LDAP\LDAP;
 use OCA\User_LDAP\LogWrapper;
@@ -198,9 +199,9 @@ class UpdateGroups extends \OC\BackgroundJob\TimedJob {
                        $userMapper  = new UserMapping($dbc);
                        $ldapAccess->setGroupMapper($groupMapper);
                        $ldapAccess->setUserMapper($userMapper);
-                       self::$groupBE = new \OCA\User_LDAP\Group_LDAP($ldapAccess, \OC::$server->query('LDAPGroupPluginManager'));
+                       self::$groupBE = new \OCA\User_LDAP\Group_LDAP($ldapAccess, \OC::$server->query(GroupPluginManager::class));
                } else {
-                       self::$groupBE = new \OCA\User_LDAP\Group_Proxy($configPrefixes, $ldapWrapper, \OC::$server->query('LDAPGroupPluginManager'));
+                       self::$groupBE = new \OCA\User_LDAP\Group_Proxy($configPrefixes, $ldapWrapper, \OC::$server->query(GroupPluginManager::class));
                }
 
                return self::$groupBE;
index 8a6ac1caee09c5a9d96a8cd1e75b4550fee40ad1..f90908adf0d4a81325b9b94da1e41a983f37157f 100644 (file)
@@ -29,6 +29,7 @@ use OCA\User_LDAP\Helper;
 use OCA\User_LDAP\LDAP;
 use OCA\User_LDAP\Mapping\GroupMapping;
 use OCA\User_LDAP\User_Proxy;
+use OCA\User_LDAP\UserPluginManager;
 use OCP\IConfig;
 
 class UUIDFixGroup extends UUIDFix {
@@ -36,6 +37,6 @@ class UUIDFixGroup extends UUIDFix {
                $this->mapper = $mapper;
                $this->proxy = new User_Proxy($helper->getServerConfigurationPrefixes(true), $ldap, $config,
                        \OC::$server->getNotificationManager(), \OC::$server->getUserSession(),
-                       \OC::$server->query('LDAPUserPluginManager'));
+                       \OC::$server->query(UserPluginManager::class));
        }
 }
index c53f566f64e879cf188b335f00f48402b858a697..c62e4c53e50311808571c593197787f503a0134a 100644 (file)
@@ -26,6 +26,7 @@
 namespace OCA\User_LDAP\Migration;
 
 use OCA\User_LDAP\Group_Proxy;
+use OCA\User_LDAP\GroupPluginManager;
 use OCA\User_LDAP\Helper;
 use OCA\User_LDAP\LDAP;
 use OCA\User_LDAP\Mapping\UserMapping;
@@ -34,7 +35,7 @@ use OCP\IConfig;
 class UUIDFixUser extends UUIDFix {
        public function __construct(UserMapping $mapper, LDAP $ldap, IConfig $config, Helper $helper) {
                $this->mapper = $mapper;
-               $groupPluginManager = \OC::$server->query('LDAPGroupPluginManager');
+               $groupPluginManager = \OC::$server->query(GroupPluginManager::class);
                $this->proxy = new Group_Proxy($helper->getServerConfigurationPrefixes(true), $ldap, $groupPluginManager);
        }
 }
index ff57d56b47ea4e5c86a7709011b6e13da9163c09..2bbea237090e87756a4bcfc0bedcba59ef0411e4 100644 (file)
@@ -30,10 +30,12 @@ namespace OCA\User_LDAP\Tests\Integration;
 use OCA\User_LDAP\Access;
 use OCA\User_LDAP\Connection;
 use OCA\User_LDAP\FilesystemHelper;
+use OCA\User_LDAP\GroupPluginManager;
 use OCA\User_LDAP\Helper;
 use OCA\User_LDAP\LDAP;
 use OCA\User_LDAP\LogWrapper;
 use OCA\User_LDAP\User\Manager;
+use OCA\User_LDAP\UserPluginManager;
 
 abstract class AbstractIntegrationTest {
        /** @var  LDAP */
@@ -47,7 +49,7 @@ abstract class AbstractIntegrationTest {
 
        /** @var Manager */
        protected $userManager;
-       
+
        /** @var Helper */
        protected $helper;
 
@@ -72,10 +74,10 @@ abstract class AbstractIntegrationTest {
         * the LDAP backend.
         */
        public function init() {
-               \OC::$server->registerService('LDAPUserPluginManager', function () {
+               \OC::$server->registerService(UserPluginManager::class, function () {
                        return new \OCA\User_LDAP\UserPluginManager();
                });
-               \OC::$server->registerService('LDAPGroupPluginManager', function () {
+               \OC::$server->registerService(GroupPluginManager::class, function () {
                        return new \OCA\User_LDAP\GroupPluginManager();
                });
 
@@ -128,7 +130,7 @@ abstract class AbstractIntegrationTest {
                        \OC::$server->getNotificationManager()
                );
        }
-       
+
        /**
         * initializes the test Helper
         */
index bea527697b505e0d3d80be105cee9811fb7a67ac..e0c9e9b73dfb3dc15d3511ad1712e677f4d5426a 100644 (file)
 namespace OCA\user_ldap\tests\Integration\Lib;
 
 use OCA\User_LDAP\Group_LDAP;
+use OCA\User_LDAP\GroupPluginManager;
 use OCA\User_LDAP\Mapping\GroupMapping;
 use OCA\User_LDAP\Mapping\UserMapping;
 use OCA\User_LDAP\Tests\Integration\AbstractIntegrationTest;
 use OCA\User_LDAP\User_LDAP;
+use OCA\User_LDAP\UserPluginManager;
 
 require_once __DIR__ . '/../Bootstrap.php';
 
@@ -50,12 +52,12 @@ class IntegrationTestAttributeDetection extends AbstractIntegrationTest {
                $groupMapper->clear();
                $this->access->setGroupMapper($groupMapper);
 
-               $userBackend = new User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager(), \OC::$server->getUserSession(), \OC::$server->query('LDAPUserPluginManager'));
+               $userBackend = new User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager(), \OC::$server->getUserSession(), \OC::$server->query(UserPluginManager::class));
                $userManager = \OC::$server->getUserManager();
                $userManager->clearBackends();
                $userManager->registerBackend($userBackend);
 
-               $groupBackend = new Group_LDAP($this->access, \OC::$server->query('LDAPGroupPluginManager'));
+               $groupBackend = new Group_LDAP($this->access, \OC::$server->query(GroupPluginManager::class));
                $groupManger = \OC::$server->getGroupManager();
                $groupManger->clearBackends();
                $groupManger->addBackend($groupBackend);
index 01ac243729bc1d4530e54d5a5f7ecaed5cb7933e..95d218710d74e9f688f33b97992540ed6f089186 100644 (file)
@@ -28,6 +28,7 @@ namespace OCA\User_LDAP\Tests\Integration\Lib;
 use OCA\User_LDAP\Mapping\UserMapping;
 use OCA\User_LDAP\Tests\Integration\AbstractIntegrationTest;
 use OCA\User_LDAP\User_LDAP;
+use OCA\User_LDAP\UserPluginManager;
 
 require_once __DIR__ . '/../Bootstrap.php';
 
@@ -49,7 +50,7 @@ class IntegrationTestFetchUsersByLoginName extends AbstractIntegrationTest {
                $this->mapping = new UserMapping(\OC::$server->getDatabaseConnection());
                $this->mapping->clear();
                $this->access->setUserMapper($this->mapping);
-               $this->backend = new User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager(), \OC::$server->getUserSession(), \OC::$server->query('LDAPUserPluginManager'));
+               $this->backend = new User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager(), \OC::$server->getUserSession(), \OC::$server->query(UserPluginManager::class));
        }
 
        /**
index a6be4de5906fb53bef3e2ef05d1f7bbc8f5905fd..2648aec62ac29c2d3f5cf9109884247d9f2d538b 100644 (file)
@@ -29,6 +29,7 @@ namespace OCA\User_LDAP\Tests\Integration\Lib;
 use OCA\User_LDAP\Mapping\UserMapping;
 use OCA\User_LDAP\Tests\Integration\AbstractIntegrationTest;
 use OCA\User_LDAP\User_LDAP;
+use OCA\User_LDAP\UserPluginManager;
 
 require_once __DIR__ . '/../Bootstrap.php';
 
@@ -50,7 +51,7 @@ class IntegrationTestPaging extends AbstractIntegrationTest {
                require(__DIR__ . '/../setup-scripts/createExplicitUsers.php');
                parent::init();
 
-               $this->backend = new User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager(), \OC::$server->getUserSession(), \OC::$server->query('LDAPUserPluginManager'));
+               $this->backend = new User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager(), \OC::$server->getUserSession(), \OC::$server->query(UserPluginManager::class));
        }
 
        public function initConnection() {
index b75059dbbf9db243526bf23b3a904adbd7c662e5..9f8f6746505970f53f87344fdf87a6c78ebac7c2 100644 (file)
@@ -36,6 +36,7 @@ use OCA\User_LDAP\Tests\Integration\AbstractIntegrationTest;
 use OCA\User_LDAP\User\Manager;
 use OCA\User_LDAP\User\User;
 use OCA\User_LDAP\User_LDAP;
+use OCA\User_LDAP\UserPluginManager;
 use OCP\Image;
 
 require_once __DIR__ . '/../../Bootstrap.php';
@@ -54,7 +55,7 @@ class IntegrationTestUserAvatar extends AbstractIntegrationTest {
                $this->mapping = new UserMapping(\OC::$server->getDatabaseConnection());
                $this->mapping->clear();
                $this->access->setUserMapper($this->mapping);
-               $userBackend  = new User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager(), \OC::$server->getUserSession(), \OC::$server->query('LDAPUserPluginManager'));
+               $userBackend  = new User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager(), \OC::$server->getUserSession(), \OC::$server->query(UserPluginManager::class));
                \OC_User::useBackend($userBackend);
        }
 
index 1c60ce6b6fe111c0e588bdd7fa4ac6c48e78ed00..ee5f8982ff7d3dacff7f7643118418139567b6c9 100644 (file)
@@ -28,6 +28,7 @@ use OCA\User_LDAP\Jobs\CleanUp;
 use OCA\User_LDAP\Mapping\UserMapping;
 use OCA\User_LDAP\Tests\Integration\AbstractIntegrationTest;
 use OCA\User_LDAP\User_LDAP;
+use OCA\User_LDAP\UserPluginManager;
 
 require_once __DIR__ . '/../../Bootstrap.php';
 
@@ -46,7 +47,7 @@ class IntegrationTestUserCleanUp extends AbstractIntegrationTest {
                $this->mapping->clear();
                $this->access->setUserMapper($this->mapping);
 
-               $userBackend  = new User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager(), \OC::$server->getUserSession(), \OC::$server->query('LDAPUserPluginManager'));
+               $userBackend  = new User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager(), \OC::$server->getUserSession(), \OC::$server->query(UserPluginManager::class));
                \OC_User::useBackend($userBackend);
        }
 
index 0ae26e423c18cb430c113a505e54aa25533f189f..b6038666619f54c187ea14b2b9607ab6f2db947d 100644 (file)
@@ -27,6 +27,7 @@ namespace OCA\User_LDAP\Tests\Integration\Lib\User;
 use OCA\User_LDAP\Mapping\UserMapping;
 use OCA\User_LDAP\Tests\Integration\AbstractIntegrationTest;
 use OCA\User_LDAP\User_LDAP;
+use OCA\User_LDAP\UserPluginManager;
 
 require_once __DIR__ . '/../../Bootstrap.php';
 
@@ -44,7 +45,7 @@ class IntegrationTestUserDisplayName extends AbstractIntegrationTest {
                $this->mapping = new UserMapping(\OC::$server->getDatabaseConnection());
                $this->mapping->clear();
                $this->access->setUserMapper($this->mapping);
-               $userBackend  = new User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager(), \OC::$server->getUserSession(), \OC::$server->query('LDAPUserPluginManager'));
+               $userBackend  = new User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager(), \OC::$server->getUserSession(), \OC::$server->query(UserPluginManager::class));
                \OC_User::useBackend($userBackend);
        }