]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-16061 Revert incorrect fix for "Remove 'username' from the $moodleattributes...
authoriarenaza <iarenaza>
Mon, 25 Aug 2008 22:44:45 +0000 (22:44 +0000)
committeriarenaza <iarenaza>
Mon, 25 Aug 2008 22:44:45 +0000 (22:44 +0000)
Merged from MOODLE_18_STABLE.

The fix is wrong, as it breaks auth_db_sync_users.php and
auth_ldap_sync_users.php at least. No new users are added to Moodle, as the
username is missing from the new user info record.

The fix needs to go into update_user_record() in lib/moodlelib.php to make it
skip the 'username' key, as we really need get_userinfo() to return the
username as part of the user info array.

auth/cas/auth.php
auth/db/auth.php
auth/ldap/auth.php
auth/shibboleth/auth.php
lib/moodlelib.php

index 8e137eb1a4b50a64a521ff05d5a95b03c96bb460..fb42870df0bbfab0480d7eae6867e5e40491a6d6 100644 (file)
@@ -500,6 +500,7 @@ if ( !is_object($PHPCAS_CLIENT) ) {
                 }
             }
         }
+        $moodleattributes['username'] = $this->config->user_attribute;
         return $moodleattributes;
     }
     /**
index ba3cf7529f7f2f75390e682633a232b738e1ec29..c0f57aff6fa1dc4393289b31676c7aba7d39db9c 100644 (file)
@@ -137,6 +137,7 @@ class auth_plugin_db extends auth_plugin_base {
                 $moodleattributes[$field] = $this->config->{"field_map_$field"};
             }
         }
+        $moodleattributes['username'] = $this->config->fielduser;
         return $moodleattributes;
     }
 
index e3902a72d5c09c410472d52ec7ed17c89e66f393..d7eeea7e49a031b7f9109f870e66f43b8c816d74 100644 (file)
@@ -1637,6 +1637,7 @@ class auth_plugin_ldap extends auth_plugin_base {
                 }
             }
         }
+        $moodleattributes['username'] = $this->config->user_attribute;
         return $moodleattributes;
     }
 
index 84309c28a9c7d6ce0ab89a2f918726bd7fca3151..8ed938150fe083579cc828efb9cef70b215f91f4 100644 (file)
@@ -128,6 +128,7 @@ class auth_plugin_shibboleth extends auth_plugin_base {
                 $moodleattributes[$field] = $configarray["field_map_$field"];
             }
         }
+        $moodleattributes['username'] = $configarray["user_attribute"];
 
         return $moodleattributes;
     }
index 14ba40c7736b6cc65e4d9b9db3185af5f21c60bf..b8ac39df34af615f09bd2383e37b52249e42eb5b 100644 (file)
@@ -2831,6 +2831,10 @@ function update_user_record($username, $authplugin) {
     if ($newinfo = $userauth->get_userinfo($username)) {
         $newinfo = truncate_userinfo($newinfo);
         foreach ($newinfo as $key => $value){
+            if ($key === 'username') {
+                // 'username' is not a mapped updateable/lockable field, so skip it.
+                continue;
+            }
             $confval = $userauth->config->{'field_updatelocal_' . $key};
             $lockval = $userauth->config->{'field_lock_' . $key};
             if (empty($confval) || empty($lockval)) {