Skip to content

Commit

Permalink
auth/db: MDL-19469 - Swich from hardcoded auth type
Browse files Browse the repository at this point in the history
thanks to Jay Knight for the patch
  • Loading branch information
danpoltawski committed May 16, 2010
1 parent cfc794b commit 5211c7e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions auth/db/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,11 @@ function sync_users($do_updates=false) {
if (count($userlist)) {
$sql = "SELECT u.id, u.username, u.email, u.auth
FROM {user} u
WHERE u.auth='db' AND u.deleted=0 AND u.username NOT IN ($quoteduserlist)";
WHERE u.auth='{$this->authtype}' AND u.deleted=0 AND u.username NOT IN ($quoteduserlist)";
} else {
$sql = "SELECT u.id, u.username, u.email, u.auth
FROM {user} u
WHERE u.auth='db' AND u.deleted=0";
WHERE u.auth='{$this->authtype}' AND u.deleted=0";
}
$remove_users = $DB->get_records_sql($sql);

Expand Down Expand Up @@ -302,7 +302,7 @@ function sync_users($do_updates=false) {
if (!empty($updatekeys)) {
$sql = 'SELECT u.id, u.username
FROM {user} u
WHERE u.auth=\'db\' AND u.deleted=\'0\' AND u.username IN (' . $quoteduserlist . ')';
WHERE u.auth=\'' . $this->authtype . '\' AND u.deleted=\'0\' AND u.username IN (' . $quoteduserlist . ')';
if ($update_users = $DB->get_records_sql($sql)) {
print "User entries to update: ". count($update_users). "\n";

Expand All @@ -326,7 +326,7 @@ function sync_users($do_updates=false) {
// and generally inefficient
$sql = 'SELECT u.id, u.username
FROM {user} u
WHERE u.auth=\'db\' AND u.deleted=\'0\'';
WHERE u.auth=\'' . $this->authtype . '\' AND u.deleted=\'0\'';

$users = $DB->get_records_sql($sql);

Expand All @@ -353,7 +353,7 @@ function sync_users($do_updates=false) {
$user->username = $username;
$user->modified = time();
$user->confirmed = 1;
$user->auth = 'db';
$user->auth = $this->authtype;
$user->mnethostid = $CFG->mnet_localhost_id;
if (empty($user->lang)) {
$user->lang = $CFG->lang;
Expand Down Expand Up @@ -514,7 +514,7 @@ function user_update($olduser, $newuser) {
return false;
}

if (isset($olduser->auth) and $olduser->auth != 'db') {
if (isset($olduser->auth) and $olduser->auth != $this->authtype) {
return true; // just change auth and skip update
}

Expand Down

0 comments on commit 5211c7e

Please sign in to comment.