added possibility to sync Samba password with Unix password in self service

This commit is contained in:
Roland Gruber 2006-10-05 17:51:17 +00:00
parent e8b4408633
commit 34c9a5e678
1 changed files with 36 additions and 0 deletions

View File

@ -174,6 +174,10 @@ class sambaSamAccount extends baseModule {
'sambaDomainName',
'sambaPrimaryGroupSID'
);
$return['selfServiceFieldSettings'] = array(
'syncNTPassword' => _('Sync Samba NT password with Unix password'),
'syncLMPassword' => _('Sync Samba LM password with Unix password')
);
// help Entries
$return['help'] = array (
"displayName" => array(
@ -1627,6 +1631,38 @@ class sambaSamAccount extends baseModule {
return $errors;
}
/**
* Checks if all input values are correct and returns the LDAP commands which should be executed.
*
* @param string $fields input fields
* @param array $attributes LDAP attributes
* @return array messages and LDAP commands (array('messages' => array(), 'add' => array(), 'del' => array(), 'mod' => array()))
*/
function checkSelfServiceOptions($fields, $attributes) {
$return = array('messages' => array(), 'add' => array(), 'del' => array(), 'mod' => array());
if (isset($_POST['posixAccount_password']) && ($_POST['posixAccount_password'] != '')) {
if ($_POST['posixAccount_password'] != $_POST['posixAccount_password2']) {
return;
}
else {
if (!get_preg($_POST['posixAccount_password'], 'password')) {
return;
}
else {
// sync password
if (in_array('syncNTPassword', $fields)) {
$return['mod']['sambaNTPassword'][0] = ntPassword($_POST['posixAccount_password']);
}
if (in_array('syncLMPassword', $fields)) {
$return['mod']['sambaLMPassword'][0] = lmPassword($_POST['posixAccount_password']);
}
}
}
}
return $return;
}
}
?>