@@ -46,86 +46,86 @@ |
||
| 46 | 46 | use Psr\Container\ContainerInterface; |
| 47 | 47 | |
| 48 | 48 | class Application extends App implements IBootstrap { |
| 49 | - public function __construct() { |
|
| 50 | - parent::__construct('user_ldap'); |
|
| 51 | - $container = $this->getContainer(); |
|
| 52 | - |
|
| 53 | - /** |
|
| 54 | - * Controller |
|
| 55 | - */ |
|
| 56 | - $container->registerService('RenewPasswordController', function (ContainerInterface $c) { |
|
| 57 | - /** @var IServerContainer $server */ |
|
| 58 | - $server = $c->get(IServerContainer::class); |
|
| 59 | - |
|
| 60 | - return new RenewPasswordController( |
|
| 61 | - $c->get('AppName'), |
|
| 62 | - $server->getRequest(), |
|
| 63 | - $c->get('UserManager'), |
|
| 64 | - $server->getConfig(), |
|
| 65 | - $c->get(IL10N::class), |
|
| 66 | - $c->get('Session'), |
|
| 67 | - $server->getURLGenerator() |
|
| 68 | - ); |
|
| 69 | - }); |
|
| 70 | - |
|
| 71 | - $container->registerService(ILDAPWrapper::class, function () { |
|
| 72 | - return new LDAP(); |
|
| 73 | - }); |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - public function register(IRegistrationContext $context): void { |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - public function boot(IBootContext $context): void { |
|
| 80 | - $server = $context->getServerContainer(); |
|
| 81 | - $config = $server->getConfig(); |
|
| 82 | - |
|
| 83 | - $helper = new Helper($config); |
|
| 84 | - $configPrefixes = $helper->getServerConfigurationPrefixes(true); |
|
| 85 | - if (count($configPrefixes) > 0) { |
|
| 86 | - $ldapWrapper = new LDAP(); |
|
| 87 | - |
|
| 88 | - $notificationManager = $server->getNotificationManager(); |
|
| 89 | - $notificationManager->registerNotifierService(Notifier::class); |
|
| 90 | - $userSession = $server->getUserSession(); |
|
| 91 | - |
|
| 92 | - $userPluginManager = $server->query(UserPluginManager::class); |
|
| 93 | - $groupPluginManager = $server->query(GroupPluginManager::class); |
|
| 94 | - |
|
| 95 | - $userBackend = new User_Proxy( |
|
| 96 | - $configPrefixes, $ldapWrapper, $config, $notificationManager, $userSession, $userPluginManager |
|
| 97 | - ); |
|
| 98 | - $groupBackend = new Group_Proxy($configPrefixes, $ldapWrapper, $groupPluginManager); |
|
| 99 | - // register user backend |
|
| 100 | - \OC_User::useBackend($userBackend); |
|
| 101 | - |
|
| 102 | - // Hook to allow plugins to work on registered backends |
|
| 103 | - $server->getEventDispatcher()->dispatch('OCA\\User_LDAP\\User\\User::postLDAPBackendAdded'); |
|
| 104 | - |
|
| 105 | - $server->getGroupManager()->addBackend($groupBackend); |
|
| 106 | - |
|
| 107 | - $this->registerBackendDependents($context->getAppContainer()); |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - \OCP\Util::connectHook( |
|
| 111 | - '\OCA\Files_Sharing\API\Server2Server', |
|
| 112 | - 'preLoginNameUsedAsUserName', |
|
| 113 | - '\OCA\User_LDAP\Helper', |
|
| 114 | - 'loginName2UserName' |
|
| 115 | - ); |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - public function registerBackendDependents(ContainerInterface $appContainer) { |
|
| 119 | - /** @var IServerContainer $serverContainer */ |
|
| 120 | - $serverContainer = $appContainer->get(IServerContainer::class); |
|
| 121 | - $serverContainer->getEventDispatcher()->addListener( |
|
| 122 | - 'OCA\\Files_External::loadAdditionalBackends', |
|
| 123 | - function () use ($appContainer) { |
|
| 124 | - $storagesBackendService = $appContainer->get(BackendService::class); |
|
| 125 | - $storagesBackendService->registerConfigHandler('home', function () use ($appContainer) { |
|
| 126 | - return $appContainer->get(ExtStorageConfigHandler::class); |
|
| 127 | - }); |
|
| 128 | - } |
|
| 129 | - ); |
|
| 130 | - } |
|
| 49 | + public function __construct() { |
|
| 50 | + parent::__construct('user_ldap'); |
|
| 51 | + $container = $this->getContainer(); |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | + * Controller |
|
| 55 | + */ |
|
| 56 | + $container->registerService('RenewPasswordController', function (ContainerInterface $c) { |
|
| 57 | + /** @var IServerContainer $server */ |
|
| 58 | + $server = $c->get(IServerContainer::class); |
|
| 59 | + |
|
| 60 | + return new RenewPasswordController( |
|
| 61 | + $c->get('AppName'), |
|
| 62 | + $server->getRequest(), |
|
| 63 | + $c->get('UserManager'), |
|
| 64 | + $server->getConfig(), |
|
| 65 | + $c->get(IL10N::class), |
|
| 66 | + $c->get('Session'), |
|
| 67 | + $server->getURLGenerator() |
|
| 68 | + ); |
|
| 69 | + }); |
|
| 70 | + |
|
| 71 | + $container->registerService(ILDAPWrapper::class, function () { |
|
| 72 | + return new LDAP(); |
|
| 73 | + }); |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + public function register(IRegistrationContext $context): void { |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + public function boot(IBootContext $context): void { |
|
| 80 | + $server = $context->getServerContainer(); |
|
| 81 | + $config = $server->getConfig(); |
|
| 82 | + |
|
| 83 | + $helper = new Helper($config); |
|
| 84 | + $configPrefixes = $helper->getServerConfigurationPrefixes(true); |
|
| 85 | + if (count($configPrefixes) > 0) { |
|
| 86 | + $ldapWrapper = new LDAP(); |
|
| 87 | + |
|
| 88 | + $notificationManager = $server->getNotificationManager(); |
|
| 89 | + $notificationManager->registerNotifierService(Notifier::class); |
|
| 90 | + $userSession = $server->getUserSession(); |
|
| 91 | + |
|
| 92 | + $userPluginManager = $server->query(UserPluginManager::class); |
|
| 93 | + $groupPluginManager = $server->query(GroupPluginManager::class); |
|
| 94 | + |
|
| 95 | + $userBackend = new User_Proxy( |
|
| 96 | + $configPrefixes, $ldapWrapper, $config, $notificationManager, $userSession, $userPluginManager |
|
| 97 | + ); |
|
| 98 | + $groupBackend = new Group_Proxy($configPrefixes, $ldapWrapper, $groupPluginManager); |
|
| 99 | + // register user backend |
|
| 100 | + \OC_User::useBackend($userBackend); |
|
| 101 | + |
|
| 102 | + // Hook to allow plugins to work on registered backends |
|
| 103 | + $server->getEventDispatcher()->dispatch('OCA\\User_LDAP\\User\\User::postLDAPBackendAdded'); |
|
| 104 | + |
|
| 105 | + $server->getGroupManager()->addBackend($groupBackend); |
|
| 106 | + |
|
| 107 | + $this->registerBackendDependents($context->getAppContainer()); |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + \OCP\Util::connectHook( |
|
| 111 | + '\OCA\Files_Sharing\API\Server2Server', |
|
| 112 | + 'preLoginNameUsedAsUserName', |
|
| 113 | + '\OCA\User_LDAP\Helper', |
|
| 114 | + 'loginName2UserName' |
|
| 115 | + ); |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + public function registerBackendDependents(ContainerInterface $appContainer) { |
|
| 119 | + /** @var IServerContainer $serverContainer */ |
|
| 120 | + $serverContainer = $appContainer->get(IServerContainer::class); |
|
| 121 | + $serverContainer->getEventDispatcher()->addListener( |
|
| 122 | + 'OCA\\Files_External::loadAdditionalBackends', |
|
| 123 | + function () use ($appContainer) { |
|
| 124 | + $storagesBackendService = $appContainer->get(BackendService::class); |
|
| 125 | + $storagesBackendService->registerConfigHandler('home', function () use ($appContainer) { |
|
| 126 | + return $appContainer->get(ExtStorageConfigHandler::class); |
|
| 127 | + }); |
|
| 128 | + } |
|
| 129 | + ); |
|
| 130 | + } |
|
| 131 | 131 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | /** |
| 54 | 54 | * Controller |
| 55 | 55 | */ |
| 56 | - $container->registerService('RenewPasswordController', function (ContainerInterface $c) { |
|
| 56 | + $container->registerService('RenewPasswordController', function(ContainerInterface $c) { |
|
| 57 | 57 | /** @var IServerContainer $server */ |
| 58 | 58 | $server = $c->get(IServerContainer::class); |
| 59 | 59 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | ); |
| 69 | 69 | }); |
| 70 | 70 | |
| 71 | - $container->registerService(ILDAPWrapper::class, function () { |
|
| 71 | + $container->registerService(ILDAPWrapper::class, function() { |
|
| 72 | 72 | return new LDAP(); |
| 73 | 73 | }); |
| 74 | 74 | } |
@@ -92,10 +92,10 @@ discard block |
||
| 92 | 92 | $userPluginManager = $server->query(UserPluginManager::class); |
| 93 | 93 | $groupPluginManager = $server->query(GroupPluginManager::class); |
| 94 | 94 | |
| 95 | - $userBackend = new User_Proxy( |
|
| 95 | + $userBackend = new User_Proxy( |
|
| 96 | 96 | $configPrefixes, $ldapWrapper, $config, $notificationManager, $userSession, $userPluginManager |
| 97 | 97 | ); |
| 98 | - $groupBackend = new Group_Proxy($configPrefixes, $ldapWrapper, $groupPluginManager); |
|
| 98 | + $groupBackend = new Group_Proxy($configPrefixes, $ldapWrapper, $groupPluginManager); |
|
| 99 | 99 | // register user backend |
| 100 | 100 | \OC_User::useBackend($userBackend); |
| 101 | 101 | |
@@ -120,9 +120,9 @@ discard block |
||
| 120 | 120 | $serverContainer = $appContainer->get(IServerContainer::class); |
| 121 | 121 | $serverContainer->getEventDispatcher()->addListener( |
| 122 | 122 | 'OCA\\Files_External::loadAdditionalBackends', |
| 123 | - function () use ($appContainer) { |
|
| 123 | + function() use ($appContainer) { |
|
| 124 | 124 | $storagesBackendService = $appContainer->get(BackendService::class); |
| 125 | - $storagesBackendService->registerConfigHandler('home', function () use ($appContainer) { |
|
| 125 | + $storagesBackendService->registerConfigHandler('home', function() use ($appContainer) { |
|
| 126 | 126 | return $appContainer->get(ExtStorageConfigHandler::class); |
| 127 | 127 | }); |
| 128 | 128 | } |