config_plugin with auth/shibboleth

* config.html now uses print_auth_lock_options()
 * config.html better handling of default vars, and removed some warnings
 * lib.php uses new config_plugin vars
This commit is contained in:
martinlanghoff
2005-06-01 06:23:44 +00:00
parent 2ba609cc8c
commit e3cd7f35b9
2 changed files with 10 additions and 345 deletions
+5 -343
View File
@@ -4,100 +4,10 @@ if (!isset($config->auth_instructions) or empty($config->shib_user_attribute)) {
$config->auth_instructions = get_string('auth_shib_instructions', 'auth', $CFG->wwwroot.'/auth/shibboleth/shib-protected.php');
}
if (!isset($config->auth_user_firstname_updatelocal)) {
$config->auth_user_firstname_updatelocal = 1;
}
if (!isset($config->auth_shib_only)) {
$config->auth_shib_only = 0;
}
if (!isset($config->auth_user_firstname_updatelocal)) {
$config->auth_user_firstname_updatelocal = 1;
}
if (!isset($config->auth_user_firstname_editlock)) {
$config->auth_user_firstname_editlock = 0;
}
if (!isset($config->auth_user_lastname_updatelocal)) {
$config->auth_user_lastname_updatelocal = 1;
}
if (!isset($config->auth_user_lastname_editlock)) {
$config->auth_user_lastname_editlock = 0;
}
if (!isset($config->auth_user_email_updatelocal)) {
$config->auth_user_email_updatelocal = 1;
}
if (!isset($config->auth_user_email_editlock)) {
$config->auth_user_email_editlock = 0;
}
if (!isset($config->auth_user_phone1_updatelocal)) {
$config->auth_user_phone1_updatelocal = 1;
}
if (!isset($config->auth_user_phone1_editlock)) {
$config->auth_user_phone1_editlock = 0;
}
if (!isset($config->auth_user_department_updatelocal)) {
$config->auth_user_department_updatelocal = 1;
}
if (!isset($config->auth_user_department_editlock)) {
$config->auth_user_department_editlock = 0;
}
if (!isset($config->auth_user_address_updatelocal)) {
$config->auth_user_address_updatelocal = 1;
}
if (!isset($config->auth_user_address_editlock)) {
$config->auth_user_address_editlock = 0;
}
if (!isset($config->auth_user_city_updatelocal)) {
$config->auth_user_city_updatelocal = 1;
}
if (!isset($config->auth_user_city_editlock)) {
$config->auth_user_city_editlock = 0;
}
if (!isset($config->auth_user_country_updatelocal)) {
$config->auth_user_country_updatelocal = 1;
}
if (!isset($config->auth_user_country_editlock)) {
$config->auth_user_country_editlock = 0;
}
if (!isset($config->auth_user_description_updatelocal)) {
$config->auth_user_description_updatelocal = 1;
}
if (!isset($config->auth_user_description_editlock)) {
$config->auth_user_description_editlock = 0;
}
if (!isset($config->auth_user_idnumber_updatelocal)) {
$config->auth_user_idnumber_updatelocal = 1;
}
if (!isset($config->auth_user_idnumber_editlock)) {
$config->auth_user_idnumber_editlock = 0;
}
if (!isset($config->auth_user_lang_updatelocal)) {
$config->auth_user_lang_updatelocal = 1;
}
if (!isset($config->auth_user_lang_editlock)) {
$config->auth_user_lang_editlock = 0;
}
optional_variable($config->auth_shib_only, 0);
optional_variable($config->shib_user_attribute, '');
optional_variable($config->shib_logout_url, '');
optional_variable($config->shib_convert_data, 0);
?>
<tr>
@@ -139,255 +49,7 @@ if (!isset($config->auth_user_lang_editlock)) {
</td>
</tr>
<tr valign="top" class="required">
<td align="right" valign="top"><?php print_string("firstname") ?>:</td>
<td>
<input name="auth_shib_user_firstname" type="text" size="30" value="<?php echo $config->auth_shib_user_firstname?>">
</td>
<td>
<?php print_string("auth_updatelocal", "auth") ?>
<select name="auth_user_firstname_updatelocal">
<option value="0" <?php echo ($config->auth_user_firstname_updatelocal ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_firstname_updatelocal ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select>
<?php print_string("auth_editlock", "auth") ?>
<select name="auth_user_firstname_editlock">
<option value="0" <?php echo ($config->auth_user_firstname_editlock ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_firstname_editlock ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
</td>
</tr>
<tr valign="top" class="required">
<td align="right" valign="top"><?php print_string("lastname") ?>:</td>
<td>
<input name="auth_shib_user_lastname" type="text" size="30" value="<?php echo $config->auth_shib_user_lastname?>">
</td>
<td>
<?php print_string("auth_updatelocal", "auth") ?>
<select name="auth_user_lastname_updatelocal">
<option value="0" <?php echo ($config->auth_user_lastname_updatelocal ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_lastname_updatelocal ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select>
<?php print_string("auth_editlock","auth") ?>
<select name="auth_user_lastname_editlock">
<option value="0" <?php echo ($config->auth_user_lastname_editlock ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_lastname_editlock ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
</td>
</tr>
<tr valign="top" class="required">
<td align="right" valign="top"><?php print_string("email") ?>:</td>
<td>
<input name="auth_shib_user_email" type="text" size="30" value="<?php echo $config->auth_shib_user_email?>">
</td>
<td>
<?php print_string("auth_updatelocal", "auth") ?>
<select name="auth_user_email_updatelocal">
<option value="0" <?php echo ($config->auth_user_email_updatelocal ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_email_updatelocal ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select>
<?php print_string("auth_editlock", "auth") ?>
<select name="auth_user_email_editlock">
<option value="0" <?php echo ($config->auth_user_email_editlock ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_email_editlock ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
</td>
</tr>
<tr valign="top">
<td align="right"><?php print_string("phone") ?> 1:</td>
<td>
<input name="auth_shib_user_phone1" type="text" size="30" value="<?php echo $config->auth_shib_user_phone1?>">
</td>
<td>
<?php print_string("auth_updatelocal", "auth") ?>
<select name="auth_user_phone1_updatelocal">
<option value="0" <?php echo ($config->auth_user_phone1_updatelocal ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_phone1_updatelocal ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select>
<?php print_string("auth_editlock", "auth") ?>
<select name="auth_user_phone1_editlock">
<option value="0" <?php echo ($config->auth_user_phone1_editlock ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_phone1_editlock ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
</td>
</tr>
<tr valign="top">
<td align="right"><?php print_string("department") ?>:</td>
<td>
<input name="auth_shib_user_department" type="text" size="30" value="<?php echo $config->auth_shib_user_department?>">
</td>
<td>
<?php print_string("auth_updatelocal", "auth") ?>
<select name="auth_user_department_updatelocal">
<option value="0" <?php echo ($config->auth_user_department_updatelocal ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_department_updatelocal ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select>
<?php print_string("auth_editlock", "auth") ?>
<select name="auth_user_department_editlock">
<option value="0" <?php echo ($config->auth_user_department_editlock ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_department_editlock ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
</td>
</tr>
<tr valign="top">
<td align="right"><?php print_string("address") ?>:</td>
<td>
<input name="auth_shib_user_address" type="text" size="30" value="<?php echo $config->auth_shib_user_address?>">
</td>
<td>
<?php print_string("auth_updatelocal", "auth") ?>
<select name="auth_user_address_updatelocal">
<option value="0" <?php echo ($config->auth_user_address_updatelocal ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_address_updatelocal ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select>
<?php print_string("auth_editlock", "auth") ?>
<select name="auth_user_address_editlock">
<option value="0" <?php echo ($config->auth_user_address_editlock ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_address_editlock ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
</td>
</tr>
<tr valign="top">
<td align="right"><?php print_string("city") ?>:</td>
<td>
<input name="auth_shib_user_city" type="text" size="30" value="<?php echo $config->auth_shib_user_city?>">
</td>
<td>
<?php print_string("auth_updatelocal", "auth") ?>
<select name="auth_user_city_updatelocal">
<option value="0" <?php echo ($config->auth_user_city_updatelocal ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_city_updatelocal ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select>
<?php print_string("auth_editlock", "auth") ?>
<select name="auth_user_city_editlock">
<option value="0" <?php echo ($config->auth_user_city_editlock ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_city_editlock ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
</td>
</tr>
<tr valign="top">
<td align="right"><?php print_string("country") ?>:</td>
<td>
<input name="auth_shib_user_country" type="text" size="30" value="<?php echo $config->auth_shib_user_country?>">
</td>
<td>
<?php print_string("auth_updatelocal", "auth") ?>
<select name="auth_user_country_updatelocal">
<option value="0" <?php echo ($config->auth_user_country_updatelocal ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_country_updatelocal ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select>
<?php print_string("auth_editlock", "auth") ?>
<select name="auth_user_country_editlock">
<option value="0" <?php echo ($config->auth_user_country_editlock ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_country_editlock ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
</td>
</tr>
<tr valign="top">
<td align="right"><?php print_string("description") ?>:</td>
<td>
<input name="auth_shib_user_description" type="text" size="30" value="<?php echo $config->auth_shib_user_description?>">
</td>
<td>
<?php print_string("auth_updatelocal", "auth") ?>
<select name="auth_user_description_updatelocal">
<option value="0" <?php echo ($config->auth_user_description_updatelocal ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_description_updatelocal ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select>
<?php print_string("auth_editlock", "auth") ?>
<select name="auth_user_description_editlock">
<option value="0" <?php echo ($config->auth_user_description_editlock ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_description_editlock ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
</td>
</tr>
<tr valign="top">
<td align="right"><?php print_string("idnumber") ?>:</td>
<td>
<input name="auth_shib_user_idnumber" type="text" size="30" value="<?php echo $config->auth_shib_user_idnumber?>">
</td>
<td>
<?php print_string("auth_updatelocal", "auth") ?>
<select name="auth_user_idnumber_updatelocal">
<option value="0" <?php echo ($config->auth_user_idnumber_updatelocal ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_idnumber_updatelocal ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select>
<?php print_string("auth_editlock", "auth") ?>
<select name="auth_user_idnumber_editlock">
<option value="0" <?php echo ($config->auth_user_idnumber_editlock ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_idnumber_editlock ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
</td>
</tr>
<tr valign="top">
<td align="right"><?php print_string("language") ?>:</td>
<td>
<input name="auth_shib_user_lang" type="text" size="30" value="<?php echo $config->auth_shib_user_lang?>">
</td>
<td>
<?php print_string("auth_updatelocal", "auth") ?>
<select name="auth_user_lang_updatelocal">
<option value="0" <?php echo ($config->auth_user_lang_updatelocal ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_lang_updatelocal ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select>
<?php print_string("auth_editlock", "auth") ?>
<select name="auth_user_lang_editlock">
<option value="0" <?php echo ($config->auth_user_lang_editlock ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_lang_editlock ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
</td>
</tr>
<?php print_auth_lock_options($auth, $user_fields, '<!-- empty help -->', true, false); ?>
<tr valign="top">
<td align="right"><?php print_string("instructions", "auth") ?>:</td>
+5 -2
View File
@@ -65,14 +65,17 @@ function auth_shib_attributes (){
global $CFG;
$config = (array)$CFG;
$pcfg = get_config('auth/shibboleth');
$pcfg = (array) $pcfg;
$fields = array("firstname", "lastname", "email", "phone1", "phone2",
"department", "address", "city", "country", "description",
"idnumber", "lang", "guid");
$moodleattributes = array();
foreach ($fields as $field) {
if ($config["auth_shib_user_$field"]) {
$moodleattributes[$field] = $config["auth_shib_user_$field"];
if ($pcfg["auth_shib_user_$field"]) {
$moodleattributes[$field] = $pcfg["auth_shib_user_$field"];
}
}
$moodleattributes['username']=$config["shib_user_attribute"];