data['tableName'] !== 'be_users' || $this->data['fieldName'] !== 'admin') {
throw new \RuntimeException(
'The adminIsSystemMaintainer field information can be used for admin field in be_users table only',
1537273550
);
}
$resultArray = $this->initializeResultArray();
if ($this->data['command'] === 'new') {
// Early return on 'new' records - nothing we can do here
return $resultArray;
}
$systemMaintainers = array_map(intval(...), $GLOBALS['TYPO3_CONF_VARS']['SYS']['systemMaintainers'] ?? []);
$isTargetUserInSystemMaintainerList = in_array((int)$this->data['vanillaUid'], $systemMaintainers, true);
if ($isTargetUserInSystemMaintainerList) {
$languageService = $this->getLanguageService();
$isTargetUserAdmin = (int)$this->data['databaseRow']['admin'] === 1;
if ($isTargetUserAdmin) {
// User is a system maintainer
$fieldInformationText = '' . htmlspecialchars($languageService->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:formEngine.beUser.admin.information.userIsSystemMaintainer'
)) . '';
} else {
// User is currently not an admin, but set as system maintainer (in-effective).
// If admin field is set to 1, the user is therefore system maintainer again.
$fieldInformationText = '' . htmlspecialchars($languageService->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:formEngine.beUser.admin.information.userWillBecomeSystemMaintainer'
)) . '';
}
$resultArray['html'] = $fieldInformationText;
}
return $resultArray;
}
protected function getLanguageService(): LanguageService
{
return $GLOBALS['LANG'];
}
protected function getBackendUser(): BackendUserAuthentication
{
return $GLOBALS['BE_USER'];
}
}