From 29a2749da5a2c3579dc456452b9e3b5f7b377216 Mon Sep 17 00:00:00 2001 From: dongsheng Date: Tue, 8 Apr 2008 05:40:15 +0000 Subject: [PATCH] MDL-12531, make the new member value available to all the affected plugins, thanks, Robert --- admin/auth_config.php | 3 ++- auth/cas/auth.php | 5 +---- auth/db/auth.php | 5 +---- auth/ldap/auth.php | 5 +---- auth/shibboleth/auth.php | 6 +----- lib/authlib.php | 5 +++++ 6 files changed, 11 insertions(+), 18 deletions(-) diff --git a/admin/auth_config.php b/admin/auth_config.php index e8190c3e2..93719906e 100644 --- a/admin/auth_config.php +++ b/admin/auth_config.php @@ -50,7 +50,8 @@ if ($frm = data_submitted() and confirm_sesskey()) { $frm = get_config("auth/$auth"); } -$user_fields = array("firstname", "lastname", "email", "phone1", "phone2", "institution", "department", "address", "city", "country", "description", "idnumber", "lang"); +$user_fields = $authplugin->userfields; +//$user_fields = array("firstname", "lastname", "email", "phone1", "phone2", "institution", "department", "address", "city", "country", "description", "idnumber", "lang"); /// Get the auth title (from core or own auth lang files) $authtitle = $authplugin->get_title(); diff --git a/auth/cas/auth.php b/auth/cas/auth.php index ff01fa9a3..5a7225495 100644 --- a/auth/cas/auth.php +++ b/auth/cas/auth.php @@ -487,11 +487,8 @@ if ( !is_object($PHPCAS_CLIENT) ) { * @return array */ function ldap_attributes () { - $fields = array("firstname", "lastname", "email", "phone1", "phone2", - "department", "address", "city", "country", "description", - "idnumber", "lang" ); $moodleattributes = array(); - foreach ($fields as $field) { + foreach ($this->userfields as $field) { if (!empty($this->config->{"field_map_$field"})) { $moodleattributes[$field] = $this->config->{"field_map_$field"}; if (preg_match('/,/',$moodleattributes[$field])) { diff --git a/auth/db/auth.php b/auth/db/auth.php index 239df97e1..38494dff9 100644 --- a/auth/db/auth.php +++ b/auth/db/auth.php @@ -132,11 +132,8 @@ class auth_plugin_db extends auth_plugin_base { * @return array */ function db_attributes() { - $fields = array("firstname", "lastname", "email", "phone1", "phone2", - "department", "address", "city", "country", "description", - "idnumber", "lang" ); $moodleattributes = array(); - foreach ($fields as $field) { + foreach ($this->userfields as $field) { if (!empty($this->config->{"field_map_$field"})) { $moodleattributes[$field] = $this->config->{"field_map_$field"}; } diff --git a/auth/ldap/auth.php b/auth/ldap/auth.php index 5ae7085b5..592a8c453 100644 --- a/auth/ldap/auth.php +++ b/auth/ldap/auth.php @@ -1647,11 +1647,8 @@ class auth_plugin_ldap extends auth_plugin_base { */ function ldap_attributes () { - $fields = array("firstname", "lastname", "email", "phone1", "phone2", - "department", "address", "city", "country", "description", - "idnumber", "lang" ); $moodleattributes = array(); - foreach ($fields as $field) { + foreach ($this->userfields as $field) { if (!empty($this->config->{"field_map_$field"})) { $moodleattributes[$field] = $this->config->{"field_map_$field"}; if (preg_match('/,/',$moodleattributes[$field])) { diff --git a/auth/shibboleth/auth.php b/auth/shibboleth/auth.php index b5f76eb41..65251edfc 100644 --- a/auth/shibboleth/auth.php +++ b/auth/shibboleth/auth.php @@ -123,12 +123,8 @@ class auth_plugin_shibboleth extends auth_plugin_base { function get_attributes() { $configarray = (array) $this->config; - $fields = array("firstname", "lastname", "email", "phone1", "phone2", - "department", "address", "city", "country", "description", - "idnumber", "lang", "guid"); - $moodleattributes = array(); - foreach ($fields as $field) { + foreach ($this->userfields as $field) { if (isset($configarray["field_map_$field"])) { $moodleattributes[$field] = $configarray["field_map_$field"]; } diff --git a/lib/authlib.php b/lib/authlib.php index 2cbdda31d..ba7edc0f8 100644 --- a/lib/authlib.php +++ b/lib/authlib.php @@ -54,6 +54,11 @@ class auth_plugin_base { * Authentication plugin type - the same as db field. */ var $authtype; + /* + * The fields we can lock and update from/to external authentication backends + * + */ + var $userfields = array("firstname", "lastname", "email", "phone1", "phone2", "institution", "department", "address", "city", "country", "description", "idnumber", "lang"); /** -- 2.11.4.GIT