move logic from contstructor to boot method

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2021-03-26 15:27:30 +01:00
parent 369e9f50f3
commit 622ba4f0c8
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
1 changed files with 12 additions and 15 deletions

View File

@ -76,6 +76,7 @@ use OCP\IUser;
use OCP\User\Events\UserDeletedEvent;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
use function foo\func;
require_once __DIR__ . '/../../3rdparty/autoload.php';
@ -91,20 +92,6 @@ class Application extends App implements IBackendProvider, IAuthMechanismProvide
*/
public function __construct(array $urlParams = []) {
parent::__construct('files_external', $urlParams);
$container = $this->getContainer();
/** @var BackendService $backendService */
$backendService = $container->query(BackendService::class);
$backendService->registerBackendProvider($this);
$backendService->registerAuthMechanismProvider($this);
$backendService->registerConfigHandler('user', function () use ($container) {
return $container->query(UserPlaceholderHandler::class);
});
// force-load auth mechanisms since some will register hooks
// TODO: obsolete these and use the TokenProvider to get the user's password from the session
$this->getAuthMechanisms();
}
public function register(IRegistrationContext $context): void {
@ -126,7 +113,17 @@ class Application extends App implements IBackendProvider, IAuthMechanismProvide
'name' => $l->t('External storages'),
];
});
$context->injectFn([$this, 'registerListeners']);
$context->injectFn(function(BackendService $backendService, UserPlaceholderHandler $userConfigHandler) {
$backendService->registerBackendProvider($this);
$backendService->registerAuthMechanismProvider($this);
$backendService->registerConfigHandler('user', function () use ($userConfigHandler) {
return $userConfigHandler;
});
});
// force-load auth mechanisms since some will register hooks
// TODO: obsolete these and use the TokenProvider to get the user's password from the session
$this->getAuthMechanisms();
}
/**