From 6320f23204ab591a9af764a69d385a3dbb8e4b63 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 21 Aug 2006 00:37:35 +0000 Subject: [PATCH] r1111: Added a permissions fectcher in can_perform() if it isn't set, fixing the notifications check bug --- includes/class_notification.php | 3 +-- includes/functions.php | 7 ++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/includes/class_notification.php b/includes/class_notification.php index 339029d..9bda105 100644 --- a/includes/class_notification.php +++ b/includes/class_notification.php @@ -644,13 +644,12 @@ Initial report: { if ($userid == $this->registry->userinfo['userid']) { - //continue; + continue; } // we wouldn't want people who favorite bugs getting hidden notices if (!check_bug_permissions($this->bug, $this->users["$userid"])) { - var_dump($this->bug, $this->users); $this->registry->debug("skipping user $userid ({$this->users[$userid]['email']}) because of permissions"); continue; } diff --git a/includes/functions.php b/includes/functions.php index c7588d5..7fa4ce7 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -106,13 +106,18 @@ function can_perform($bitmask, $productid = 0, $userinfo = null) trigger_error('Invalid bitmask "' . $bitmask . '" specified for can_perform() [includes/functions.php]', E_USER_WARNING); } + if (!$userinfo['permissions']) + { + $userinfo['permissions'] = (int)$bugsys->datastore['usergroup']["$userinfo[usergroupid]"]['permissions']; + } + if ($productid AND isset($bugsys->datastore['permission']["$userinfo[usergroupid]"]["$productid"])) { $inspecific = array('cansearch', 'canbeassignedto', 'canadminpanel', 'canadminbugs', 'canadminfields', 'canadminversions', 'canadminusers', 'canadmingroups', 'canadmintools'); if (!in_array($bitmask, $inspecific)) { - $bugsys->debug("verdict on can_perform($bitmask, $productid, $userinfo[userid]) = " . ($bugsys->datastore['permission']["$userinfo[usergroupid]"]["$productid"] & $bugsys->permissions["$bitmask"])); + $bugsys->debug("verdict* on can_perform($bitmask, $productid, $userinfo[userid]) = " . ($bugsys->datastore['permission']["$userinfo[usergroupid]"]["$productid"] & $bugsys->permissions["$bitmask"])); return ($bugsys->datastore['permission']["$userinfo[usergroupid]"]["$productid"] & $bugsys->permissions["$bitmask"]); } } -- 2.43.5