45 throw new \RuntimeException(
'Creating a CLI-based user object on non-CLI level is not allowed', 1483971165);
48 throw new \RuntimeException(
'Login Error: TYPO3 is in maintenance mode at the moment. Only administrators are allowed access.', 1483971855);
50 $this->dontSetCookie =
true;
51 parent::__construct();
62 $this->logger->debug(
'## Beginning of auth logging.');
64 $this->svConfig =
$GLOBALS[
'TYPO3_CONF_VARS'][
'SVCONF'][
'auth'] ?? [];
85 if (!$this->user[
'uid']) {
90 throw new \RuntimeException(
'No backend user named "_cli_" could be authenticated, maybe this user is "hidden"?', 1484050401);
94 if (!$this->user[
'uid']) {
95 throw new \RuntimeException(
'No backend user named "_cli_" could be created.', 1476107195);
101 $this->uc[
'recursiveDelete'] =
true;
122 return in_array((
int)
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'adminOnly'], [0, 2],
true);
133 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(
'be_users');
134 $queryBuilder->getRestrictions()
136 ->add(GeneralUtility::makeInstance(DeletedRestriction::class));
137 $count = $queryBuilder
140 ->where($queryBuilder->expr()->eq(
'username', $queryBuilder->createNamedParameter(
'_cli_')))
159 $databaseConnection = GeneralUtility::makeInstance(ConnectionPool::class)
160 ->getConnectionForTable(
'be_users');
161 $databaseConnection->insert(
'be_users', $userFields);
171 $cryptoService = GeneralUtility::makeInstance(Random::class);
172 $password = $cryptoService->generateRandomBytes(20);
173 $hashInstance = GeneralUtility::makeInstance(PasswordHashFactory::class)->getDefaultHashInstance(
'BE');
174 return $hashInstance->getHashedPassword($password);