earlier check for duplicate user names

This commit is contained in:
Roland Gruber 2014-02-06 17:34:56 +00:00
parent 53d611e9e2
commit bcff255441
1 changed files with 8 additions and 5 deletions

View File

@ -1318,6 +1318,14 @@ class posixAccount extends baseModule implements passwordService {
// fill default value for user ID with first/last name // fill default value for user ID with first/last name
$attrs = $this->getAccountContainer()->getAccountModule('inetOrgPerson')->getAttributes(); $attrs = $this->getAccountContainer()->getAccountModule('inetOrgPerson')->getAttributes();
$this->attributes['uid'][0] = $this->getUserNameSuggestion($attrs); $this->attributes['uid'][0] = $this->getUserNameSuggestion($attrs);
if (!empty($this->attributes['uid'][0]) && $this->userNameExists($this->attributes['uid'][0])) {
while ($this->userNameExists($this->attributes['uid'][0])) {
$this->attributes['uid'][0] = $this->getNextUserName($this->attributes['uid'][0]);
}
$msg = new htmlStatusMessage($this->messages['uid'][5][0], $this->messages['uid'][5][1], $this->messages['uid'][5][2]);
$msg->colspan = 10;
$return->addElement($msg, true);
}
} }
elseif ($this->getAccountContainer()->getAccountModule('windowsUser') != null) { elseif ($this->getAccountContainer()->getAccountModule('windowsUser') != null) {
// fill default value for user ID with AD user name // fill default value for user ID with AD user name
@ -2855,11 +2863,6 @@ class posixAccount extends baseModule implements passwordService {
} }
$format = str_replace(array_keys($this->umlautReplacements), array_values($this->umlautReplacements), strtolower($format)); $format = str_replace(array_keys($this->umlautReplacements), array_values($this->umlautReplacements), strtolower($format));
$format = str_replace(array(' ', '_', '-'), array('', '', ''), $format); $format = str_replace(array(' ', '_', '-'), array('', '', ''), $format);
if (!empty($format) && $this->userNameExists($format)) {
while ($this->userNameExists($format)) {
$format = $this->getNextUserName($format);
}
}
return $format; return $format;
} }