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.
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;
CREATE TABLE `prefix_user` (
`id` int(10) unsigned NOT NULL auto_increment,
+ `auth` varchar(20) NOT NULL default 'manual',
`confirmed` tinyint(1) NOT NULL default '0',
`deleted` tinyint(1) NOT NULL default '0',
`username` varchar(100) NOT NULL default '',
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;
CREATE TABLE prefix_user (
id SERIAL PRIMARY KEY,
+ auth varchar(20) NOT NULL default 'manual',
confirmed integer NOT NULL default '0',
deleted integer NOT NULL default '0',
username varchar(100) NOT NULL default '',
}
}
+ $newuser->auth = $CFG->auth;
$newuser->username = $username;
$newuser->password = md5($password);
$newuser->lang = $CFG->lang;
// Check if the guest user exists. If not, create one.
if (! record_exists("user", "username", "guest")) {
+ $guest->auth = "manual";
$guest->username = "guest";
$guest->password = md5("guest");
$guest->firstname = addslashes(get_string("guestuser"));
$user->lang = current_language();
$user->firstaccess = time();
$user->secret = random_string(15);
+ $user->auth = $CFG->auth;
if (!empty($CFG->auth_user_create) and function_exists('auth_user_create') ){
if (! auth_user_exists($user->username)) {
if (! auth_user_create($user,$plainpass)) {
// database to determine whether upgrades should
// be performed (see lib/db/*.php)
-$version = 2004081200; // The current version is a date (YYYYMMDDXX)
+$version = 2004081500; // The current version is a date (YYYYMMDDXX)
-$release = "1.4 development"; // User-friendly version number
+$release = "1.4 alpha"; // User-friendly version number
?>