Skip to content

Commit

Permalink
MDL-16061 Revert incorrect fix for "Remove 'username' from the $moodl…
Browse files Browse the repository at this point in the history
…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
iarenaza committed Aug 25, 2008
1 parent 89eedbe commit c99f31c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion auth/cas/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@ function ldap_attributes () {
}
}
}
$moodleattributes['username'] = $this->config->user_attribute;
return $moodleattributes;
}
/**
Expand Down Expand Up @@ -1122,4 +1123,4 @@ function filter_addslashes($text) {
return $text;
}
}
?>
?>
1 change: 1 addition & 0 deletions auth/db/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ function db_attributes() {
$moodleattributes[$field] = $this->config->{"field_map_$field"};
}
}
$moodleattributes['username'] = $this->config->fielduser;
return $moodleattributes;
}

Expand Down
1 change: 1 addition & 0 deletions auth/ldap/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -1489,6 +1489,7 @@ function ldap_attributes () {
}
}
}
$moodleattributes['username'] = $this->config->user_attribute;
return $moodleattributes;
}

Expand Down
1 change: 1 addition & 0 deletions auth/shibboleth/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ function get_attributes() {
$moodleattributes[$field] = $configarray["field_map_$field"];
}
}
$moodleattributes['username'] = $configarray["user_attribute"];

return $moodleattributes;
}
Expand Down
4 changes: 4 additions & 0 deletions lib/moodlelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit c99f31c

Please sign in to comment.