always set sAMAccountName

This commit is contained in:
Roland Gruber 2014-07-26 12:44:32 +00:00
parent 97e99a709b
commit 55acc04483
1 changed files with 9 additions and 1 deletions

View File

@ -765,7 +765,7 @@ class windowsUser extends baseModule implements passwordService {
} }
$containerLeft->addElement(new htmlTableExtendedSelect('homeDrive', $drives, $selected, _('Home drive'), 'homeDrive'), true); $containerLeft->addElement(new htmlTableExtendedSelect('homeDrive', $drives, $selected, _('Home drive'), 'homeDrive'), true);
// home directory // home directory
$this->addSimpleInputTextField($containerLeft, 'homeDirectory', _('Home directory'), true); $this->addSimpleInputTextField($containerLeft, 'homeDirectory', _('Home directory'));
// NIS attributes // NIS attributes
if (!$this->isBooleanConfigOptionSet('windowsUser_hidemsSFU30Name', true) || !$this->isBooleanConfigOptionSet('windowsUser_hidemsSFU30NisDomain', true)) { if (!$this->isBooleanConfigOptionSet('windowsUser_hidemsSFU30Name', true) || !$this->isBooleanConfigOptionSet('windowsUser_hidemsSFU30NisDomain', true)) {
@ -854,6 +854,10 @@ class windowsUser extends baseModule implements passwordService {
$return[] = $this->messages['sAMAccountName'][0]; $return[] = $this->messages['sAMAccountName'][0];
} }
} }
elseif ($this->getAccountContainer()->isNewAccount && !empty($_POST['userPrincipalName'])) {
// set sAMAccountName to user name if attribute input field is not visible (W2012 requires this attribute)
$this->attributes['sAMAccountName'][0] = $_POST['userPrincipalName'];
}
// description // description
$this->attributes['description'][0] = $_POST['description']; $this->attributes['description'][0] = $_POST['description'];
// display name // display name
@ -1253,6 +1257,10 @@ class windowsUser extends baseModule implements passwordService {
$partialAccounts[$i]['sAMAccountName'] = $samUser[0]; $partialAccounts[$i]['sAMAccountName'] = $samUser[0];
} }
} }
else {
// set sAMAccountName to user name if not managed (W2012 requires it)
$partialAccounts[$i]['sAMAccountName'] = $replacements['$user'];
}
// password // password
if (($rawAccounts[$i][$ids['windowsUser_password']] != "") && (get_preg($rawAccounts[$i][$ids['windowsUser_password']], 'password'))) { if (($rawAccounts[$i][$ids['windowsUser_password']] != "") && (get_preg($rawAccounts[$i][$ids['windowsUser_password']], 'password'))) {
$partialAccounts[$i]['unicodePwd'] = self::pwdAttributeValue($rawAccounts[$i][$ids['windowsUser_password']]); $partialAccounts[$i]['unicodePwd'] = self::pwdAttributeValue($rawAccounts[$i][$ids['windowsUser_password']]);