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".

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.
  • Loading branch information...
commit b29004e366e353aa4ace60ba41862561a042974f 1 parent 919c6cc
iarenaza authored
View
1  auth/cas/auth.php
@@ -496,6 +496,7 @@ function ldap_attributes () {
}
}
}
+ $moodleattributes['username'] = $this->config->user_attribute;
return $moodleattributes;
}
/**
View
1  auth/db/auth.php
@@ -138,6 +138,7 @@ function db_attributes() {
$moodleattributes[$field] = $this->config->{"field_map_$field"};
}
}
+ $moodleattributes['username'] = $this->config->fielduser;
return $moodleattributes;
}
View
1  auth/ldap/auth.php
@@ -1685,6 +1685,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
@@ -2902,6 +2902,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)) {
Please sign in to comment.
Something went wrong with that request. Please try again.