Skip to content

Commit ea2afb2

Browse files
committed
Move event listener registration to register()
Signed-off-by: Côme Chilliet <[email protected]>
1 parent ddb4bb7 commit ea2afb2

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

apps/user_ldap/lib/AppInfo/Application.php

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ public function __construct() {
8989

9090
public function register(IRegistrationContext $context): void {
9191
$context->registerNotifierService(Notifier::class);
92+
$context->registerEventListener(PostLoginEvent::class, FirstLoginListener::class);
9293
}
9394

9495
public function boot(IBootContext $context): void {
@@ -119,17 +120,22 @@ public function boot(IBootContext $context): void {
119120
});
120121

121122
$context->injectFn(Closure::fromCallable([$this, 'registerBackendDependents']));
122-
$context->injectFn(Closure::fromCallable([$this, 'registerFirstLoginListener']));
123123

124124
\OCP\Util::connectHook(
125125
'\OCA\Files_Sharing\API\Server2Server',
126126
'preLoginNameUsedAsUserName',
127127
'\OCA\User_LDAP\Helper',
128128
'loginName2UserName'
129129
);
130+
\OCP\Util::connectHook(
131+
'\OC\User',
132+
'assignedUserId',
133+
FirstLoginListener::class,
134+
'onAssignedId'
135+
);
130136
}
131137

132-
private function registerBackendDependents(IAppContainer $appContainer, EventDispatcherInterface $dispatcher) {
138+
private function registerBackendDependents(IAppContainer $appContainer, EventDispatcherInterface $dispatcher): void {
133139
$dispatcher->addListener(
134140
'OCA\\Files_External::loadAdditionalBackends',
135141
function () use ($appContainer) {
@@ -140,14 +146,4 @@ function () use ($appContainer) {
140146
}
141147
);
142148
}
143-
144-
private function registerFirstLoginListener(IEventDispatcher $dispatcher) {
145-
$dispatcher->addServiceListener(PostLoginEvent::class, FirstLoginListener::class);
146-
\OCP\Util::connectHook(
147-
'\OC\User',
148-
'assignedUserId',
149-
FirstLoginListener::class,
150-
'onAssignedId'
151-
);
152-
}
153149
}

0 commit comments

Comments
 (0)