Skip to content

Commit

Permalink
Fixed issue #5441: getuserlist() "List users from same group as me + …
Browse files Browse the repository at this point in the history
…all my childs" scalability issue - patch by gkuchta

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_ci@11006 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
c-schmitz committed Sep 18, 2011
1 parent 292515c commit d3e3f2c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions application/helpers/common_helper.php
Expand Up @@ -1502,16 +1502,17 @@ function getuserlist($outputformat='fullinfoarray')
// List users from same group as me + all my childs
// a subselect is used here because MSSQL does not like to group by text
// also Postgres does like this one better
$uquery = " SELECT * FROM ".$CI->db->dbprefix."users where uid in
(SELECT u.uid FROM ".$CI->db->dbprefix."users AS u,
".$CI->db->dbprefix."user_in_groups AS ga ,".$CI->db->dbprefix."user_in_groups AS gb
WHERE u.uid=$myuid
OR (ga.ugid=gb.ugid AND ( (gb.uid=$myuid AND u.uid=ga.uid) OR (u.parent_id=$myuid) ) )
GROUP BY u.uid)";
$uquery = " SELECT * from ".$CI->db->dbprefix."users where uid in (
SELECT uid from ".$CI->db->dbprefix."user_in_groups where ugid in (
SELECT ugid from ".$CI->db->dbprefix."user_in_groups where uid=$myuid
)
)
UNION
SELECT * from ".$CI->db->dbprefix."users where users.parent_id=$myuid";
}
else
{
return Array(); // Or die maybe
return array(); // Or die maybe
}

}
Expand Down

0 comments on commit d3e3f2c

Please sign in to comment.