|
From: Benjamin C. <bc...@us...> - 2002-03-02 18:47:20
|
Update of /cvsroot/phpbt/phpbt/inc
In directory usw-pr-cvs1:/tmp/cvs-serv19269/inc
Modified Files:
auth.php
Log Message:
Fixed a bug with the group and permission assignments at login
Index: auth.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/inc/auth.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- auth.php 2 Mar 2002 18:02:23 -0000 1.7
+++ auth.php 2 Mar 2002 18:47:16 -0000 1.8
@@ -76,16 +76,18 @@
$this->auth['db_fields'] = @unserialize($u['bug_list_fields']);
// Grab group assignments and permissions based on groups
- $q->query("select gp.group_id, group_name, perm_name"
- ." from ".TBL_AUTH_PERM." ap, ".TBL_GROUP_PERM." gp, ".TBL_AUTH_GROUP." ag, ".TBL_USER_GROUP." ug"
- ." where ap.perm_id = gp.perm_id and gp.group_id = ag.group_id"
- ." and ag.group_id = ug.group_id and ug.user_id = {$u['user_id']}");
- while (list($groupid, $group, $perm) = $q->grab()) {
+ $this->auth['group_ids'] = $q->grab_field_set("select group_id from ".
+ TBL_USER_GROUP." where user_id = {$u['user_id']}");
+ foreach ($this->auth['group_ids'] as $group) {
+ $this->auth['group'][$group] = true;
+ }
+ $q->query("select perm_name from ".TBL_AUTH_PERM." ap, ".
+ TBL_GROUP_PERM." gp where group_id in (".
+ delimit_list(',', $this->auth['group_ids']).") and gp.perm_id = ap.perm_id");
+ while ($perm = $q->grab_field()) {
$this->auth['perm'][$perm] = true;
- $this->auth['uid'] = $u['user_id'];
- $this->auth['group'][$group] = true;
- $this->auth['group_ids'][] = $groupid;
}
+ $this->auth['uid'] = $u['user_id'];
return $u['user_id'];
}
|