]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-12531, make the new member value available to all the affected plugins, thanks...
authordongsheng <dongsheng>
Tue, 8 Apr 2008 05:53:12 +0000 (05:53 +0000)
committerdongsheng <dongsheng>
Tue, 8 Apr 2008 05:53:12 +0000 (05:53 +0000)
admin/auth_config.php
auth/cas/auth.php
auth/db/auth.php
auth/ldap/auth.php
auth/shibboleth/auth.php
lib/authlib.php

index d0bc55d7635690504869db6527067c5e40b6a2cb..3165e5fcc52f5e4e75e97ffb802899069e4155ce 100644 (file)
@@ -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();
index f3d05e46e4ce2fc0a7f549d9601a8c0c899a2cf0..d849227770c8a255baf229336e6758064062c263 100644 (file)
@@ -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])) {
index 32f2df1e3c73f143761686a6d9efb515f02ea05b..334437fe7c3edc2417243a771352a2733938306d 100644 (file)
@@ -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"};
             }
index 868d950316efe8df1ef79815dc48ab412c901921..cd9aab84c1f57d78cfc648bf0fc1bc262fe5a732 100644 (file)
@@ -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])) {
index 05c69a2b312b8650ffc545b46bc38fe9f3d17c36..22d850b4cacc5414612bad7984971d57c98a3a55 100644 (file)
@@ -76,7 +76,7 @@ class auth_plugin_shibboleth extends auth_plugin_base {
 
         // Check whether we have got all the essential attributes
         if ( empty($_SERVER[$this->config->user_attribute]) ) {
-            error(get_string( 'shib_not_all_attributes_error', 'auth' , "'".$this->config->user_attribute."' ('".$_SERVER[$this->config->user_attribute]."'), '".$this->config->field_map_firstname."' ('".$_SERVER[$this->config->field_map_firstname]."'), '".$this->config->field_map_lastname."' ('".$_SERVER[$this->config->field_map_lastname]."') and '".$this->config->field_map_email."' ('".$_SERVER[$this->config->field_map_email]."')"));
+            print_error( 'shib_not_all_attributes_error', 'auth' , '', "'".$this->config->user_attribute."' ('".$_SERVER[$this->config->user_attribute]."'), '".$this->config->field_map_firstname."' ('".$_SERVER[$this->config->field_map_firstname]."'), '".$this->config->field_map_lastname."' ('".$_SERVER[$this->config->field_map_lastname]."') and '".$this->config->field_map_email."' ('".$_SERVER[$this->config->field_map_email]."')");
         }
 
         $attrmap = $this->get_attributes();
@@ -122,13 +122,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"];
             }
index a60a661378d3089b4d9ff40c70530b76e8cb057a..8996a979cfa8c540c6d215b28a3ec86962742e78 100644 (file)
@@ -57,6 +57,13 @@ 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");
 
     /**