fill default user name from AD module

This commit is contained in:
Roland Gruber 2013-12-28 10:48:31 +00:00
parent 7538def6f7
commit 25d6611231
1 changed files with 14 additions and 4 deletions

View File

@ -1297,10 +1297,20 @@ class posixAccount extends baseModule implements passwordService {
$shelllist = $this->getShells(); // list of all valid shells $shelllist = $this->getShells(); // list of all valid shells
// set default values // set default values
if (!isset($this->attributes['uid'][0]) && ($this->getAccountContainer()->getAccountModule('inetOrgPerson') != null)) { if (empty($this->attributes['uid'][0])) {
// fill default value for user ID with first/last name if ($this->getAccountContainer()->getAccountModule('inetOrgPerson') != null) {
$attrs = $this->getAccountContainer()->getAccountModule('inetOrgPerson')->getAttributes(); // fill default value for user ID with first/last name
$this->attributes['uid'][0] = $this->getUserNameSuggestion($attrs); $attrs = $this->getAccountContainer()->getAccountModule('inetOrgPerson')->getAttributes();
$this->attributes['uid'][0] = $this->getUserNameSuggestion($attrs);
}
elseif ($this->getAccountContainer()->getAccountModule('windowsUser') != null) {
// fill default value for user ID with AD user name
$attrs = $this->getAccountContainer()->getAccountModule('windowsUser')->getAttributes();
if (!empty($attrs['userPrincipalName'][0])) {
$parts = explode('@', $attrs['userPrincipalName'][0]);
$this->attributes['uid'][0] = $parts[0];
}
}
} }
if ($this->manageCn() && (!isset($this->attributes['cn'][0]) || ($this->attributes['cn'][0] == ''))) { if ($this->manageCn() && (!isset($this->attributes['cn'][0]) || ($this->attributes['cn'][0] == ''))) {
// set a default value for common name // set a default value for common name