Added a new "auth" field to the user table. This field contains the

authentication mechanism used to create that user record.

Also added code to upgrade existing systems to have entries in that
field, and for new users to also have that field defined.

This will allow us to later improve the login procedure to be able to
handle various types of authentication.
This commit is contained in:
moodler
2004-08-15 07:27:52 +00:00
parent 83c87a05d9
commit 4e11ad4faa
8 changed files with 35 additions and 2 deletions
+14
View File
@@ -549,6 +549,20 @@ function main_upgrade($oldversion=0) {
set_field('blocks', 'version', 2004081200, 'name', 'course_list');
}
if ($oldversion < 2004081500) { // Adding new "auth" field to user table to allow more flexibility
table_column('user', '', 'auth', 'varchar', '20', '', 'manual', 'not null', 'id');
execute_sql("UPDATE {$CFG->prefix}user SET auth = 'manual'"); // Set everyone to 'manual' to be sure
if ($admins = get_admins()) { // Set all the NON-admins to whatever the current auth module is
$adminlist = array();
foreach ($admins as $user) {
$adminlist[] = $user->id;
}
$adminlist = implode(',', $adminlist);
execute_sql("UPDATE {$CFG->prefix}user SET auth = '$CFG->auth' WHERE id NOT IN ($adminlist)");
}
}
return $result;