- Patch #7614 by jhriggs: fixed some role related problems.

4.5.x
Dries Buytaert 2004-05-19 14:55:19 +00:00
parent cd2f2bc0f9
commit d0090e69e6
4 changed files with 16 additions and 12 deletions

View File

@ -594,7 +594,6 @@ CREATE TABLE users (
picture varchar(255) NOT NULL DEFAULT '',
init varchar(64) default '',
data longtext,
rid int(10) unsigned NOT NULL default '0',
PRIMARY KEY (uid),
UNIQUE KEY name (name),
KEY changed (changed)
@ -667,7 +666,8 @@ INSERT INTO system VALUES ('modules/page.module','page','module','',1,0,0);
INSERT INTO system VALUES ('modules/story.module','story','module','',1,0,0);
INSERT INTO system VALUES ('modules/taxonomy.module','taxonomy','module','',1,0,0);
INSERT INTO system VALUES ('themes/xtemplate/xtemplate.theme','xtemplate','theme','Internet explorer, Netscape, Opera',1,0,0);
INSERT INTO users (uid, name, mail, rid) VALUES ('0', '', '', '1');
INSERT INTO users (uid, name, mail) VALUES ('0', '', '');
INSERT INTO users_roles (uid, rid) VALUES (0, 1);
INSERT INTO role (rid, name) VALUES (1, 'anonymous user');
INSERT INTO permission VALUES (1,'access content',0);

View File

@ -587,7 +587,6 @@ CREATE TABLE users (
picture varchar(255) NOT NULL DEFAULT '',
init varchar(64) default '',
data text default '',
rid integer NOT NULL default '0',
PRIMARY KEY (uid),
UNIQUE (name)
);
@ -665,7 +664,8 @@ INSERT INTO system VALUES ('themes/xtemplate/xtemplate.theme','xtemplate','theme
INSERT INTO variable(name,value) VALUES('update_start', 's:10:"2004-02-21";');
INSERT INTO variable(name,value) VALUES('theme_default','s:9:"xtemplate";');
INSERT INTO users(uid,name,mail,rid) VALUES(0,'','', '1');
INSERT INTO users(uid,name,mail) VALUES(0,'','');
INSERT INTO users_roles(uid,rid) VALUES(0, 1);
INSERT INTO role (rid, name) VALUES (1, 'anonymous user');
INSERT INTO permission VALUES (1,'access content',0);

View File

@ -86,11 +86,13 @@ function user_save($account, $array = array()) {
db_query("UPDATE {users} SET $query changed = %d WHERE uid = %d", array_merge($v, array(time(), $account->uid)));
// reload user roles
db_query("DELETE FROM {users_roles} WHERE uid = %d", $account->uid);
// reload user roles if provided
if (is_array($array['rid'])) {
db_query("DELETE FROM {users_roles} WHERE uid = %d", $account->uid);
foreach ($array['rid'] as $rid) {
db_query("INSERT INTO {users_roles} (uid, rid) VALUES (%d, %d)", $account->uid, $rid);
foreach ($array['rid'] as $rid) {
db_query("INSERT INTO {users_roles} (uid, rid) VALUES (%d, %d)", $account->uid, $rid);
}
}
$user = user_load(array('uid' => $account->uid));

View File

@ -86,11 +86,13 @@ function user_save($account, $array = array()) {
db_query("UPDATE {users} SET $query changed = %d WHERE uid = %d", array_merge($v, array(time(), $account->uid)));
// reload user roles
db_query("DELETE FROM {users_roles} WHERE uid = %d", $account->uid);
// reload user roles if provided
if (is_array($array['rid'])) {
db_query("DELETE FROM {users_roles} WHERE uid = %d", $account->uid);
foreach ($array['rid'] as $rid) {
db_query("INSERT INTO {users_roles} (uid, rid) VALUES (%d, %d)", $account->uid, $rid);
foreach ($array['rid'] as $rid) {
db_query("INSERT INTO {users_roles} (uid, rid) VALUES (%d, %d)", $account->uid, $rid);
}
}
$user = user_load(array('uid' => $account->uid));