From e395b00366551dd5a7d4901698c2297d632aa264 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 18 Mar 2007 19:18:32 +0000 Subject: [PATCH] r1503: Update build_assignedto() so people in secondary groups that have assignee powers are added to the cache --- includes/functions_datastore.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/includes/functions_datastore.php b/includes/functions_datastore.php index c2cf24e..3ff0cd5 100755 --- a/includes/functions_datastore.php +++ b/includes/functions_datastore.php @@ -144,11 +144,23 @@ function build_assignedto() { global $bugsys; + // determine the groups that are assignable + $ids = $exprs = array(); + foreach ($bugsys->datastore['usergroup'] AS $id => $group) + { + if ($group['permissions'] & $bugsys->permissions['canbeassignedto']) + { + $ids[] = $id; + $exprs[] = "FIND_IN_SET($id, groupids)"; + } + } + + $ids = implode(',', $ids); + $exprs = implode(' OR ', $exprs); $users = $bugsys->db->query(" - SELECT user.email, user.displayname, user.userid, user.showemail + SELECT email, displayname, userid, showemail FROM " . TABLE_PREFIX . "user AS user - LEFT JOIN " . TABLE_PREFIX . "usergroup AS usergroup ON (user.usergroupid = usergroup.usergroupid) - WHERE (usergroup.permissions & " . $bugsys->permissions['canbeassignedto'] . ")" + WHERE usergroupid IN ($ids) OR $exprs" ); while ($user = $bugsys->db->fetch_array($users)) { -- 2.43.5