Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-16061 Revert incorrect fix for "Remove 'username' from the $moodl…

…eattributes array"

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.
  • Loading branch information...
commit c99f31c86b4bca9fccf709cc11327bf3286d78ea 1 parent 89eedbe
iarenaza authored
View
3  auth/cas/auth.php
@@ -495,6 +495,7 @@ function ldap_attributes () {
}
}
}
+ $moodleattributes['username'] = $this->config->user_attribute;
return $moodleattributes;
}
/**
@@ -1122,4 +1123,4 @@ function filter_addslashes($text) {
return $text;
}
}
-?>
+?>
View
1  auth/db/auth.php
@@ -135,6 +135,7 @@ function db_attributes() {
$moodleattributes[$field] = $this->config->{"field_map_$field"};
}
}
+ $moodleattributes['username'] = $this->config->fielduser;
return $moodleattributes;
}
View
1  auth/ldap/auth.php
@@ -1489,6 +1489,7 @@ function ldap_attributes () {
}
}
}
+ $moodleattributes['username'] = $this->config->user_attribute;
return $moodleattributes;
}
View
1  auth/shibboleth/auth.php
@@ -129,6 +129,7 @@ function get_attributes() {
$moodleattributes[$field] = $configarray["field_map_$field"];
}
}
+ $moodleattributes['username'] = $configarray["user_attribute"];
return $moodleattributes;
}
View
4 lib/moodlelib.php
@@ -2605,6 +2605,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)) {

0 comments on commit c99f31c

Please sign in to comment.
Something went wrong with that request. Please try again.