moodle/auth/ldap/config.html

396 lines
13 KiB
HTML

<?php
// Initialize vars
if (!isset($config->ldap_host_url))
{ $config->ldap_host_url = ''; }
if (!isset($config->ldap_contexts))
{ $config->ldap_contexts = ''; }
if (!isset($config->ldap_user_type))
{ $config->ldap_user_type = ''; }
if (!isset($config->ldap_user_attribute))
{ $config->ldap_user_attribute = ''; }
if (!isset($config->ldap_search_sub))
{ $config->ldap_search_sub = ''; }
if (!isset($config->ldap_opt_deref))
{ $config->ldap_opt_deref = ''; }
if (!isset($config->ldap_preventpassindb))
{ $config->ldap_preventpassindb = 0; }
if (!isset($config->ldap_bind_dn))
{$config->ldap_bind_dn = ''; }
if (!isset($config->ldap_bind_pw))
{$config->ldap_bind_pw = ''; }
if (!isset($config->ldap_version))
{$config->ldap_version = '2'; }
if (!isset($config->ldap_objectclass))
{$config->ldap_objectclass = ''; }
if (!isset($config->ldap_memberattribute))
{$config->ldap_memberattribute = ''; }
if (!isset($config->ldap_creators))
{$config->ldap_creators = ''; }
if (!isset($config->ldap_create_context))
{$config->ldap_create_context = ''; }
if (!isset($config->ldap_expiration))
{$config->ldap_expiration = ''; }
if (!isset($config->ldap_expiration_warning))
{$config->ldap_expiration_warning = '10'; }
if (!isset($config->ldap_expireattr))
{$config->ldap_expireattr = ''; }
if (!isset($config->ldap_gracelogins))
{$config->ldap_gracelogins = ''; }
if (!isset($config->ldap_graceattr))
{$config->ldap_graceattr = ''; }
if (!isset($config->auth_user_create))
{$config->auth_user_create = ''; }
if (!isset($config->auth_ldap_forcechangepassword))
{$config->auth_ldap_forcechangepassword = false; }
if (!isset($config->auth_ldap_stdchangepassword))
{$config->auth_ldap_stdchangepassword = false; }
$yesno = array( get_string('no'), get_string('yes') );
if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
print '<tr><td><p align="center"><font color="red"><strong>Warning:
The PHP LDAP module does not seem to be present.
Please ensure it is installed and enabled.</strong></font></p></td></tr>';
}
?>
<tr>
<td colspan="2">
<h4><?php print_string("auth_ldap_server_settings", "auth") ?> </h4>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">ldap_host_url:</td>
<td>
<input name="ldap_host_url" type="text" size="30" value="<?php echo $config->ldap_host_url?>" />
<?php if (isset($err["ldap_host_url"])) formerr($err["ldap_host_url"]); ?>
</td>
<td>
<?php print_string("auth_ldap_host_url","auth") ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">ldap_version:</td>
<td>
<?php
$versions[2] = "2";
$versions[3] = "3";
choose_from_menu($versions, "ldap_version", $config->ldap_version, "");
if (isset($err["ldap_version"])) formerr($err["ldap_version"]);
?>
</td>
<td>
<?php print_string("auth_ldap_version","auth") ?>
</td>
</tr>
<tr>
<td colspan="2">
<h4><?php print_string("auth_ldap_bind_settings", "auth") ?> </h4>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">ldap_preventpassindb:</td>
<td>
<?php
$choices = array();
$choices["0"] = get_string("no");
$choices["1"] = get_string("yes");
choose_from_menu ($choices, "ldap_preventpassindb", $config->ldap_preventpassindb, "");
?>
</td><td>
<?php print_string("auth_ldap_preventpassindb","auth") ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">ldap_bind_dn:</td>
<td>
<input name="ldap_bind_dn" type="text" size="30" value="<?php echo $config->ldap_bind_dn?>" />
<?php if (isset($err["ldap_bind_dn"])) formerr($err["ldap_bind_dn"]); ?>
</td><td>
<?php print_string("auth_ldap_bind_dn","auth") ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">ldap_bind_pw:</td>
<td>
<input name="ldap_bind_pw" type="password" size="30" value="<?php echo $config->ldap_bind_pw?>" />
<?php if (isset($err["ldap_bind_pw"])) formerr($err["ldap_bind_pw"]); ?>
</td><td>
<?php print_string("auth_ldap_bind_pw","auth") ?>
</td>
</tr>
<tr>
<td colspan="2">
<h4><?php print_string("auth_ldap_user_settings", "auth") ?> </h4>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">ldap_user_type:</td>
<td>
<?php choose_from_menu(auth_ldap_suppported_usertypes(), "ldap_user_type", $config->ldap_user_type, ""); ?>
<?php if (isset($err["ldap_user_type"])) formerr($err["ldap_user_type"]); ?>
</td>
<td>
<?php print_string("auth_ldap_user_type","auth") ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">ldap_contexts:</td>
<td>
<input name="ldap_contexts" type="text" size="30" value="<?php echo $config->ldap_contexts?>" />
<?php if (isset($err["ldap_contexts"])) formerr($err["ldap_contexts"]); ?>
</td>
<td>
<?php print_string("auth_ldap_contexts","auth") ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">ldap_search_sub:</td>
<td>
<?php
$choices = array();
$choices["0"] = get_string("no");
$choices["1"] = get_string("yes");
choose_from_menu ($choices, "ldap_search_sub", $config->ldap_search_sub, "");
?>
<?php if (isset($err["ldap_search_sub"])) formerr($err["ldap_search_sub"]); ?>
</td>
<td>
<?php print_string("auth_ldap_search_sub","auth") ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">ldap_opt_deref:</td>
<td>
<?php
$opt_deref[LDAP_DEREF_NEVER] = get_string("no");
$opt_deref[LDAP_DEREF_ALWAYS] = get_string("yes");
choose_from_menu($opt_deref, "ldap_opt_deref", $config->ldap_opt_deref, LDAP_DEREF_NEVER);
if (isset($err["ldap_opt_deref"])) formerr($err["ldap_opt_deref"]);
?>
</td>
<td>
<?php print_string("auth_ldap_opt_deref","auth") ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">ldap_user_attribute:</td>
<td>
<input name="ldap_user_attribute" type="text" size="30" value="<?php echo $config->ldap_user_attribute?>" />
<?php if (isset($err["ldap_user_attribute"])) formerr($err["ldap_user_attribute"]); ?>
</td>
<td>
<?php print_string("auth_ldap_user_attribute","auth") ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">ldap_memberattribute:</td>
<td>
<input name="ldap_memberattribute" type="text" size="30" value="<?php echo $config->ldap_memberattribute?>" />
<?php if (isset($err["ldap_memberattribute"])) formerr($err["ldap_memberattribute"]); ?>
</td><td>
<?php print_string("auth_ldap_memberattribute","auth") ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">ldap_objectclass:</td>
<td>
<input name="ldap_objectclass" type="text" size="30" value="<?php echo $config->ldap_objectclass?>" />
<?php if (isset($err["ldap_objectclass"])) formerr($err["ldap_objectclass"]); ?>
</td>
<td>
<?php print_string("auth_ldap_objectclass","auth") ?>
</td>
</tr>
<tr>
<td colspan="2">
<h4><?php print_string("forcechangepassword", "auth") ?> </h4>
</td>
</tr>
<tr valign="top" class="required">
<td align="right" valign="top"><?php print_string('forcechangepassword', 'auth') ?>:</td>
<td>
<select name="auth_ldap_forcechangepassword">
<option value="0" <?php echo ($config->auth_ldap_forcechangepassword ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_ldap_forcechangepassword ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br />
</td>
<td align="left" valign="top">
<p><?php print_string('forcechangepasswordfirst_help', 'auth') ?></p>
</td>
</tr>
<tr valign="top" class="required">
<td align="right" valign="top"><?php print_string('stdchangepassword', 'auth') ?>:</td>
<td>
<select name="auth_ldap_stdchangepassword">
<option value="0" <?php echo ($config->auth_ldap_stdchangepassword ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_ldap_stdchangepassword ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br />
</td>
<td align="left" valign="top">
<p><?php print_string('stdchangepassword_expl', 'auth') ?></p>
<p><?php print_string('stdchangepassword_explldap', 'auth') ?></p>
</td>
</tr>
<tr>
<td colspan="2">
<h4><?php print_string("auth_ldap_passwdexpire_settings", "auth") ?> </h4>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">ldap_expiration:</td>
<td>
<?php
$expiration['0'] = "No";
$expiration['1'] = "LDAP";
choose_from_menu($expiration, "ldap_expiration", $config->ldap_expiration, "");
if (isset($err["ldap_expiration"])) formerr($err["ldap_expiration"]);
?>
</td>
<td>
<?php print_string("auth_ldap_expiration_desc","auth") ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">ldap_expiration_warning:</td>
<td>
<input name="ldap_expiration_warning" type="text" size="2" value="<?php echo $config->ldap_expiration_warning?>" />
<?php if (isset($err["ldap_expiration_warning"])) formerr($err["ldap_expiration_warning"]);
?>
</td>
<td>
<?php print_string("auth_ldap_expiration_warning_desc","auth") ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">ldap_exprireattr:</td>
<td>
<input name="ldap_expireattr" type="text" size="30" value="<?php echo $config->ldap_expireattr?>" />
<?php if (isset($err["ldap_expireattr"])) formerr($err["ldap_expireattr"]);
?>
</td>
<td>
<?php print_string("auth_ldap_expireattr_desc","auth") ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">ldap_gracelogins:</td>
<td>
<?php
$grace['0'] = get_string("no");
$grace['1'] = get_string("yes");
choose_from_menu($grace, "ldap_gracelogins", $config->ldap_gracelogins, "");
if (isset($err["ldap_expiration"])) formerr($err["ldap_expiration"]);
?>
</td>
<td>
<?php print_string("auth_ldap_gracelogins_desc","auth") ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">ldap_graceattr:</td>
<td>
<input name="ldap_graceattr" type="text" size="30" value="<?php echo $config->ldap_graceattr?>" />
<?php if (isset($err["ldap_graceattr"])) formerr($err["ldap_graceattr"]);
?>
</td>
<td>
<?php print_string("auth_ldap_graceattr_desc","auth") ?>
</td>
</tr>
<tr>
<td colspan="2">
<h4><?php print_string("auth_user_create", "auth") ?> </h4>
</td>
</tr>
</tr>
<tr valign="top" class="required">
<td align="right">ldap_create_context:</td>
<td>
<input name="ldap_create_context" type="text" size="30" value="<?php echo $config->ldap_create_context?>" />
<?php if (isset($err["ldap_create_context"])) formerr($err["ldap_create_context"]); ?>
</td><td>
<?php print_string("auth_ldap_create_context","auth") ?>
</td>
</tr>
<tr>
<td colspan="2">
<h4><?php print_string("coursecreators") ?> </h4>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">ldap_creators:</td>
<td>
<input name="ldap_creators" type="text" size="30" value="<?php echo $config->ldap_creators?>" />
<?php if (isset($err["ldap_creators"])) formerr($err["ldap_creators"]); ?>
</td><td>
<?php print_string("auth_ldap_creators","auth") ?>
</td>
</tr>
<?php
$help = get_string("auth_ldapextrafields","auth");
$help .= get_string("auth_updatelocal_expl","auth");
$help .= get_string("auth_fieldlock_expl","auth");
$help .= get_string("auth_updateremote_expl","auth");
$help .= '<hr />';
$help .= get_string("auth_updateremote_ldap","auth");
print_auth_lock_options($auth, $user_fields, $help, true, true);
?>
<tr valign="top" class="required">
<td align="right"><?php print_string("instructions", "auth") ?>:</td>
<td>
<textarea name="auth_instructions" cols="30" rows="10" wrap="virtual"><?php p($config->auth_instructions) ?></textarea>
</td>
<td>
<?php print_string("authinstructions","auth") ?>
<?php helpbutton("text", get_string("helptext")) ?>
</td>
</tr>