Skip to content

Commit

Permalink
MDL-27040 get_users_by_capability generates u.id IN () when no uesrs …
Browse files Browse the repository at this point in the history
…have accessallgroups
  • Loading branch information
timhunt committed Jul 4, 2011
1 parent 020f0ff commit ae91207
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/accesslib.php
Expand Up @@ -5007,7 +5007,11 @@ function get_users_by_capability($context, $capability, $fields = '', $sort = ''


if ($useviewallgroups) { if ($useviewallgroups) {
$viewallgroupsusers = get_users_by_capability($context, 'moodle/site:accessallgroups', 'u.id, u.id', '', '', '', '', $exceptions); $viewallgroupsusers = get_users_by_capability($context, 'moodle/site:accessallgroups', 'u.id, u.id', '', '', '', '', $exceptions);
$wherecond[] = "($grouptest OR u.id IN (" . implode(',', array_keys($viewallgroupsusers)) . '))'; if (!empty($viewallgroupsusers)) {
$wherecond[] = "($grouptest OR u.id IN (" . implode(',', array_keys($viewallgroupsusers)) . '))';
} else {
$wherecond[] = "($grouptest)";
}
} else { } else {
$wherecond[] = "($grouptest)"; $wherecond[] = "($grouptest)";
} }
Expand Down

0 comments on commit ae91207

Please sign in to comment.