check for invalid configuration

This commit is contained in:
Roland Gruber 2018-06-20 08:27:10 +02:00
parent 4df34f631c
commit e51ee9c826
1 changed files with 21 additions and 0 deletions

View File

@ -1527,6 +1527,7 @@ class posixAccount extends baseModule implements passwordService {
*/
function display_html_attributes() {
$return = new htmlTable();
$this->checkForInvalidConfiguration($return);
$modules = $this->getAccountContainer()->get_type()->getModules();
$typeId = $this->getAccountContainer()->get_type()->getId();
if (!$this->isOptional($modules) || $this->skipObjectClass() || (isset($this->attributes['objectClass']) && in_array('posixAccount', $this->attributes['objectClass']))) {
@ -1702,6 +1703,26 @@ class posixAccount extends baseModule implements passwordService {
return $return;
}
/**
* Checks if the configuration is valid and prints an error if not.
*
* @param htmlTable $content content area
*/
private function checkForInvalidConfiguration(htmlTable $content) {
$typeId = $this->getAccountContainer()->get_type()->getId();
if ($this->get_scope() == 'user') {
$generatorOption = 'posixAccount_' . $typeId . '_uidGeneratorUsers';
}
else {
$generatorOption = 'posixAccount_' . $typeId . '_uidGeneratorHosts';
}
if (empty($this->moduleSettings[$generatorOption])) {
$message = new htmlStatusMessage('ERROR', _('Invalid configuration detected. Please edit your server profile (module settings) and fill all required fields.'));
$message->colspan = 5;
$content->addElement($message, true);
}
}
/**
* Displays the delete homedir option for the delete page.
*