|
From: Benjamin C. <bc...@us...> - 2001-08-25 04:48:59
|
Update of /cvsroot/phpbt/phpbt In directory usw-pr-cvs1:/tmp/cvs-serv2677 Modified Files: dbchanges.sql Added Files: perms.sql Log Message: These changes _will_ break login ability -- you might want to make a copy of your database first! --- NEW FILE: perms.sql --- create table auth_group (group_id int unsigned not null, group_name varchar(80) not null, created_by int unsigned not null, created_date bigint unsigned not null, last_modified_by int unsigned not null, last_modified_date bigint unsigned not null, primary key (group_id)); create table auth_perm (perm_id int unsigned not null, perm_name varchar(80) not null, created_by int unsigned not null, created_date bigint unsigned not null, last_modified_by int unsigned not null, last_modified_date bigint unsigned not null, primary key (perm_id)); create table user_group (user_id int unsigned not null, group_id int unsigned not null, primary key (user_id, group_id), key (group_id)); create table user_perm (user_id int unsigned not null, perm_id int unsigned not null, primary key (user_id, perm_id), key (perm_id)); create table group_perm (group_id int unsigned not null, perm_id int unsigned not null, primary key (group_id, perm_id), key (perm_id)); create table bug_group (bug_id int unsigned not null, group_id int unsigned not null, primary key (bug_id, group_id), key (group_id)); # Start off with two user levels... insert into auth_group (group_id, group_name) values (1, 'admin'); insert into auth_group (group_id, group_name) values (2, 'user'); # ... and only two permissions (how quaint) insert into auth_perm (perm_id, perm_name) values (1, 'admin'); insert into auth_perm (perm_id, perm_name) values (2, 'editbug'); # Admins can do all the admin stuff and users can edit bugs insert into group_perm (group_id, perm_id) values (1, 1); insert into group_perm (group_id, perm_id) values (2, 2); # And user_id 1 is the admin insert into user_group (user_id, group_id) values (1, 1); # You can use these queries to convert the post 0.2.x / pre 0.3.0 schema alter table user rename auth_user; alter table auth_user change user_level active tinyint unsigned not null; update auth_user set active = 1 where active > 0; Index: dbchanges.sql =================================================================== RCS file: /cvsroot/phpbt/phpbt/dbchanges.sql,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- dbchanges.sql 2001/08/20 22:33:28 1.7 +++ dbchanges.sql 2001/08/25 04:48:55 1.8 @@ -136,13 +136,13 @@ ); insert into status select * from Status; -CREATE TABLE `user` ( +CREATE TABLE `auth_user` ( `user_id` int(10) unsigned NOT NULL default '0', `first_name` char(40) NOT NULL default '', `last_name` char(40) NOT NULL default '', `email` char(60) NOT NULL default '', `password` char(40) NOT NULL default '', - `user_level` tinyint(3) unsigned NOT NULL default '1', + `active` tinyint(3) unsigned NOT NULL default '1', `bug_list_fields` char(255) NOT NULL default '', `created_by` int(10) unsigned NOT NULL default '0', `created_date` bigint(20) unsigned NOT NULL default '0', @@ -150,7 +150,7 @@ `last_modified_date` bigint(20) unsigned NOT NULL default '0', PRIMARY KEY (`user_id`) ); -insert into user select UserID, FirstName, LastName, Email, Password, UserLevel, '', 0, CreatedDate, 0, CreatedDate from User; +insert into auth_user select UserID, FirstName, LastName, Email, Password, if (UserLevel > 0, 1, 0), '', 0, CreatedDate, 0, CreatedDate from User; CREATE TABLE `version` ( `version_id` int(10) unsigned NOT NULL default '0', |