Add new setup configs for ldap homedir and shell

This commit is contained in:
Miles Lott 2001-03-29 03:39:40 +00:00
parent 3ae25525a8
commit 3690501ca1
5 changed files with 72 additions and 18 deletions

View File

@ -26,11 +26,22 @@
$t = new Template($phpgw->common->get_tpl_dir('admin')); $t = new Template($phpgw->common->get_tpl_dir('admin'));
$t->set_unknowns('remove'); $t->set_unknowns('remove');
$t->set_file(array(
'form' => 'account_form.tpl', if ($phpgw_info["server"]["ldap_extra_attributes"] && ($phpgw_info['server']['account_repository'] == 'ldap')) {
'form_passwordinfo' => 'account_form_password.tpl', $t->set_file(array(
'form_buttons_' => 'account_form_buttons.tpl', 'form' => 'account_form_ldap.tpl',
)); 'form_passwordinfo' => 'account_form_password.tpl',
'form_buttons_' => 'account_form_buttons.tpl'
));
}
else
{
$t->set_file(array(
'form' => 'account_form.tpl',
'form_passwordinfo' => 'account_form_password.tpl',
'form_buttons_' => 'account_form_buttons.tpl',
));
}
if ($_userData) if ($_userData)
{ {
@ -77,6 +88,13 @@
$t->set_var('account_lid','<input name="account_lid" value="' . $userData['account_lid'] . '">'); $t->set_var('account_lid','<input name="account_lid" value="' . $userData['account_lid'] . '">');
if ($phpgw_info["server"]["ldap_extra_attributes"]) {
$t->set_var("lang_homedir",lang("home directory"));
$t->set_var("lang_shell",lang("shell"));
$t->set_var("homedirectory",'<input name="homedirectory" value="' . $userData['homedirectory']. '">');
$t->set_var("loginshell",'<input name="loginshell" value="' . $userData['loginshell']. '">');
}
$t->set_var('account_passwd',$account_passwd); $t->set_var('account_passwd',$account_passwd);
$t->set_var('account_passwd_2',$account_passwd_2); $t->set_var('account_passwd_2',$account_passwd_2);
$t->parse('password_fields','form_passwordinfo',True); $t->parse('password_fields','form_passwordinfo',True);
@ -263,7 +281,7 @@
if ($_userData['old_loginid'] != $_userData['account_lid']) if ($_userData['old_loginid'] != $_userData['account_lid'])
{ {
if (account_exsists($_userData['account_loginid'])) if (account_exists($_userData['account_loginid']))
{ {
$error[$totalerrors] = lang('That loginid has already been taken'); $error[$totalerrors] = lang('That loginid has already been taken');
$totalerrors++; $totalerrors++;
@ -314,7 +332,9 @@
'account_id' => $account_id, 'account_id' => $account_id,
'account_passwd_2' => $account_passwd_2, 'account_passwd_2' => $account_passwd_2,
'account_groups' => $account_groups, 'account_groups' => $account_groups,
'account_permissions' => $account_permissions 'account_permissions' => $account_permissions,
'homedirectory' => $homedirectory,
'loginshell' => $loginshell
); );
if (!$errors = userDataInvalid($userData)) if (!$errors = userDataInvalid($userData))

View File

@ -83,7 +83,7 @@
'phpgw_acl', 'phpgw_acl',
'phpgw_applications' 'phpgw_applications'
)); ));
$phpgw->accounts->create('u', $account_lid, $account_passwd, $account_firstname, $account_lastname, $account_status); $phpgw->accounts->create('u', $account_lid, $account_passwd, $account_firstname, $account_lastname, $account_status,$homedirectory,$loginshell);
$account_id = $phpgw->accounts->name2id($account_lid); $account_id = $phpgw->accounts->name2id($account_lid);
@ -173,11 +173,22 @@
} }
$phpgw->template->set_unknowns('remove'); $phpgw->template->set_unknowns('remove');
$phpgw->template->set_file(array(
'form' => 'account_form.tpl', if ($phpgw_info["server"]["ldap_extra_attributes"] && $phpgw_info['server']['account_repository'] == 'ldap') {
'form_passwordinfo' => 'account_form_password.tpl', $phpgw->template->set_file(array(
'form_buttons_' => 'account_form_buttons.tpl', 'form' => 'account_form_ldap.tpl',
)); 'form_passwordinfo' => 'account_form_password.tpl',
'form_buttons_' => 'account_form_buttons.tpl'
));
}
else
{
$phpgw->template->set_file(array(
'form' => 'account_form.tpl',
'form_passwordinfo' => 'account_form_password.tpl',
'form_buttons_' => 'account_form_buttons.tpl',
));
}
$phpgw->common->phpgw_header(); $phpgw->common->phpgw_header();
echo parse_navbar(); echo parse_navbar();
@ -211,7 +222,14 @@
$phpgw->template->set_var('lang_password',lang('Password')); $phpgw->template->set_var('lang_password',lang('Password'));
$phpgw->template->set_var('account_passwd',$account_passwd); $phpgw->template->set_var('account_passwd',$account_passwd);
if ($phpgw_info["server"]["ldap_extra_attributes"]) {
$phpgw->template->set_var("lang_homedir",lang("home directory"));
$phpgw->template->set_var("lang_shell",lang("shell"));
$phpgw->template->set_var("homedirectory",'<input name="homedirectory" value="' . $phpgw_info["server"]["ldap_account_home"].SEP.$account_lid . '">');
$phpgw->template->set_var("loginshell",'<input name="loginshell" value="' . $phpgw_info["server"]["ldap_account_shell"] . '">');
}
$phpgw->template->set_var('lang_reenter_password',lang('Re-Enter Password')); $phpgw->template->set_var('lang_reenter_password',lang('Re-Enter Password'));
$phpgw->template->set_var('account_passwd_2',$account_passwd_2); $phpgw->template->set_var('account_passwd_2',$account_passwd_2);
$phpgw->template->parse('password_fields','form_passwordinfo',True); $phpgw->template->parse('password_fields','form_passwordinfo',True);

View File

@ -33,6 +33,22 @@
</tr> </tr>
<?php $selected = array(); ?> <?php $selected = array(); ?>
<tr bgcolor="e6e6e6">
<td>If using LDAP, do you want to store homedirectory and loginshell attributes for new accounts?:</td>
<td><input type="checkbox" name="newsettings[ldap_extra_attributes]" value="True"<?php echo ($current_config["ldap_extra_attributes"]?" checked":""); ?>></td>
</tr>
<tr bgcolor="e6e6e6">
<td>&nbsp;&nbsp;&nbsp;LDAP Default homedirectory prefix (e.g. /home for /home/username):</td>
<td><input name="newsettings[ldap_account_home]" value="<?php echo $current_config["ldap_account_home"]; ?>"></td>
</tr>
<tr bgcolor="e6e6e6">
<td>&nbsp;&nbsp;&nbsp;LDAP Default shell (e.g. /bin/bash):</td>
<td><input name="newsettings[ldap_account_shell]" value="<?php echo $current_config["ldap_account_shell"]; ?>"></td>
</tr>
<?php $selected = array(); ?>
<tr bgcolor="e6e6e6"> <tr bgcolor="e6e6e6">
<td>Auto create account records for authenticated users:</td> <td>Auto create account records for authenticated users:</td>
<td><input type="checkbox" name="newsettings[auto_create_acct]" value="True"<?php echo ($current_config["auto_create_acct"]?" checked":""); ?>></td> <td><input type="checkbox" name="newsettings[auto_create_acct]" value="True"<?php echo ($current_config["auto_create_acct"]?" checked":""); ?>></td>

View File

@ -25,9 +25,9 @@
<tr bgcolor="{tr_color2}"> <tr bgcolor="{tr_color2}">
<td>{lang_homedir}</td> <td>{lang_homedir}</td>
<td>{account_home}&nbsp;</td> <td>{homedirectory}&nbsp;</td>
<td>{lang_shell}</td> <td>{lang_shell}</td>
<td>{account_shell}&nbsp;</td> <td>{loginshell}&nbsp;</td>
</tr> </tr>
{password_fields} {password_fields}

View File

@ -25,9 +25,9 @@
<tr bgcolor="{tr_color2}"> <tr bgcolor="{tr_color2}">
<td>{lang_homedir}</td> <td>{lang_homedir}</td>
<td>{account_home}&nbsp;</td> <td>{homedirectory}&nbsp;</td>
<td>{lang_shell}</td> <td>{lang_shell}</td>
<td>{account_shell}&nbsp;</td> <td>{loginshell}&nbsp;</td>
</tr> </tr>
{password_fields} {password_fields}