@@ -53,83 +53,83 @@ |
||
| 53 | 53 | use Symfony\Component\EventDispatcher\EventDispatcherInterface; |
| 54 | 54 | |
| 55 | 55 | class Application extends App implements IBootstrap { |
| 56 | - public function __construct() { |
|
| 57 | - parent::__construct('user_ldap'); |
|
| 58 | - $container = $this->getContainer(); |
|
| 56 | + public function __construct() { |
|
| 57 | + parent::__construct('user_ldap'); |
|
| 58 | + $container = $this->getContainer(); |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * Controller |
|
| 62 | - */ |
|
| 63 | - $container->registerService('RenewPasswordController', function (IAppContainer $appContainer) { |
|
| 64 | - /** @var IServerContainer $server */ |
|
| 65 | - $server = $appContainer->get(IServerContainer::class); |
|
| 60 | + /** |
|
| 61 | + * Controller |
|
| 62 | + */ |
|
| 63 | + $container->registerService('RenewPasswordController', function (IAppContainer $appContainer) { |
|
| 64 | + /** @var IServerContainer $server */ |
|
| 65 | + $server = $appContainer->get(IServerContainer::class); |
|
| 66 | 66 | |
| 67 | - return new RenewPasswordController( |
|
| 68 | - $appContainer->get('AppName'), |
|
| 69 | - $server->getRequest(), |
|
| 70 | - $appContainer->get('UserManager'), |
|
| 71 | - $server->getConfig(), |
|
| 72 | - $appContainer->get(IL10N::class), |
|
| 73 | - $appContainer->get('Session'), |
|
| 74 | - $server->getURLGenerator() |
|
| 75 | - ); |
|
| 76 | - }); |
|
| 67 | + return new RenewPasswordController( |
|
| 68 | + $appContainer->get('AppName'), |
|
| 69 | + $server->getRequest(), |
|
| 70 | + $appContainer->get('UserManager'), |
|
| 71 | + $server->getConfig(), |
|
| 72 | + $appContainer->get(IL10N::class), |
|
| 73 | + $appContainer->get('Session'), |
|
| 74 | + $server->getURLGenerator() |
|
| 75 | + ); |
|
| 76 | + }); |
|
| 77 | 77 | |
| 78 | - $container->registerService(ILDAPWrapper::class, function () { |
|
| 79 | - return new LDAP(); |
|
| 80 | - }); |
|
| 81 | - } |
|
| 78 | + $container->registerService(ILDAPWrapper::class, function () { |
|
| 79 | + return new LDAP(); |
|
| 80 | + }); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - public function register(IRegistrationContext $context): void { |
|
| 84 | - $context->registerNotifierService(Notifier::class); |
|
| 85 | - } |
|
| 83 | + public function register(IRegistrationContext $context): void { |
|
| 84 | + $context->registerNotifierService(Notifier::class); |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - public function boot(IBootContext $context): void { |
|
| 88 | - $context->injectFn(function ( |
|
| 89 | - INotificationManager $notificationManager, |
|
| 90 | - IAppContainer $appContainer, |
|
| 91 | - EventDispatcherInterface $legacyDispatcher, |
|
| 92 | - IEventDispatcher $dispatcher, |
|
| 93 | - IGroupManager $groupManager, |
|
| 94 | - User_Proxy $userBackend, |
|
| 95 | - Group_Proxy $groupBackend, |
|
| 96 | - Helper $helper |
|
| 97 | - ) { |
|
| 98 | - $configPrefixes = $helper->getServerConfigurationPrefixes(true); |
|
| 99 | - if (count($configPrefixes) > 0) { |
|
| 100 | - $userPluginManager = $appContainer->get(UserPluginManager::class); |
|
| 101 | - $groupPluginManager = $appContainer->get(GroupPluginManager::class); |
|
| 87 | + public function boot(IBootContext $context): void { |
|
| 88 | + $context->injectFn(function ( |
|
| 89 | + INotificationManager $notificationManager, |
|
| 90 | + IAppContainer $appContainer, |
|
| 91 | + EventDispatcherInterface $legacyDispatcher, |
|
| 92 | + IEventDispatcher $dispatcher, |
|
| 93 | + IGroupManager $groupManager, |
|
| 94 | + User_Proxy $userBackend, |
|
| 95 | + Group_Proxy $groupBackend, |
|
| 96 | + Helper $helper |
|
| 97 | + ) { |
|
| 98 | + $configPrefixes = $helper->getServerConfigurationPrefixes(true); |
|
| 99 | + if (count($configPrefixes) > 0) { |
|
| 100 | + $userPluginManager = $appContainer->get(UserPluginManager::class); |
|
| 101 | + $groupPluginManager = $appContainer->get(GroupPluginManager::class); |
|
| 102 | 102 | |
| 103 | - \OC_User::useBackend($userBackend); |
|
| 104 | - $groupManager->addBackend($groupBackend); |
|
| 103 | + \OC_User::useBackend($userBackend); |
|
| 104 | + $groupManager->addBackend($groupBackend); |
|
| 105 | 105 | |
| 106 | - $userBackendRegisteredEvent = new UserBackendRegistered($userBackend, $userPluginManager); |
|
| 107 | - $legacyDispatcher->dispatch('OCA\\User_LDAP\\User\\User::postLDAPBackendAdded', $userBackendRegisteredEvent); |
|
| 108 | - $dispatcher->dispatchTyped($userBackendRegisteredEvent); |
|
| 109 | - $groupBackendRegisteredEvent = new GroupBackendRegistered($groupBackend, $groupPluginManager); |
|
| 110 | - $dispatcher->dispatchTyped($groupBackendRegisteredEvent); |
|
| 111 | - } |
|
| 112 | - }); |
|
| 106 | + $userBackendRegisteredEvent = new UserBackendRegistered($userBackend, $userPluginManager); |
|
| 107 | + $legacyDispatcher->dispatch('OCA\\User_LDAP\\User\\User::postLDAPBackendAdded', $userBackendRegisteredEvent); |
|
| 108 | + $dispatcher->dispatchTyped($userBackendRegisteredEvent); |
|
| 109 | + $groupBackendRegisteredEvent = new GroupBackendRegistered($groupBackend, $groupPluginManager); |
|
| 110 | + $dispatcher->dispatchTyped($groupBackendRegisteredEvent); |
|
| 111 | + } |
|
| 112 | + }); |
|
| 113 | 113 | |
| 114 | - $context->injectFn(Closure::fromCallable([$this, 'registerBackendDependents'])); |
|
| 114 | + $context->injectFn(Closure::fromCallable([$this, 'registerBackendDependents'])); |
|
| 115 | 115 | |
| 116 | - \OCP\Util::connectHook( |
|
| 117 | - '\OCA\Files_Sharing\API\Server2Server', |
|
| 118 | - 'preLoginNameUsedAsUserName', |
|
| 119 | - '\OCA\User_LDAP\Helper', |
|
| 120 | - 'loginName2UserName' |
|
| 121 | - ); |
|
| 122 | - } |
|
| 116 | + \OCP\Util::connectHook( |
|
| 117 | + '\OCA\Files_Sharing\API\Server2Server', |
|
| 118 | + 'preLoginNameUsedAsUserName', |
|
| 119 | + '\OCA\User_LDAP\Helper', |
|
| 120 | + 'loginName2UserName' |
|
| 121 | + ); |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | - private function registerBackendDependents(IAppContainer $appContainer, EventDispatcherInterface $dispatcher) { |
|
| 125 | - $dispatcher->addListener( |
|
| 126 | - 'OCA\\Files_External::loadAdditionalBackends', |
|
| 127 | - function () use ($appContainer) { |
|
| 128 | - $storagesBackendService = $appContainer->get(BackendService::class); |
|
| 129 | - $storagesBackendService->registerConfigHandler('home', function () use ($appContainer) { |
|
| 130 | - return $appContainer->get(ExtStorageConfigHandler::class); |
|
| 131 | - }); |
|
| 132 | - } |
|
| 133 | - ); |
|
| 134 | - } |
|
| 124 | + private function registerBackendDependents(IAppContainer $appContainer, EventDispatcherInterface $dispatcher) { |
|
| 125 | + $dispatcher->addListener( |
|
| 126 | + 'OCA\\Files_External::loadAdditionalBackends', |
|
| 127 | + function () use ($appContainer) { |
|
| 128 | + $storagesBackendService = $appContainer->get(BackendService::class); |
|
| 129 | + $storagesBackendService->registerConfigHandler('home', function () use ($appContainer) { |
|
| 130 | + return $appContainer->get(ExtStorageConfigHandler::class); |
|
| 131 | + }); |
|
| 132 | + } |
|
| 133 | + ); |
|
| 134 | + } |
|
| 135 | 135 | } |