MDL-22531 fix for broken sql in get_users_by_capability() in cases where role_assignmetns is not in the resulting query such as when only default role is interesting for us - thanks Ye Chen for the report and solution
This commit is contained in:
+2
-2
@@ -4497,13 +4497,13 @@ function get_users_by_capability($context, $capability, $fields='', $sort='',
|
||||
} else {
|
||||
$grouptest = 'gm.groupid = ' . $groups;
|
||||
}
|
||||
$grouptest = 'ra.userid IN (SELECT userid FROM ' .
|
||||
$grouptest = 'u.id IN (SELECT userid FROM ' .
|
||||
$CFG->prefix . 'groups_members gm WHERE ' . $grouptest . ')';
|
||||
|
||||
if ($useviewallgroups) {
|
||||
$viewallgroupsusers = get_users_by_capability($context,
|
||||
'moodle/site:accessallgroups', 'u.id, u.id', '', '', '', '', $exceptions);
|
||||
$wherecond['groups'] = '('. $grouptest . ' OR ra.userid IN (' .
|
||||
$wherecond['groups'] = '('. $grouptest . ' OR u.id IN (' .
|
||||
implode(',', array_keys($viewallgroupsusers)) . '))';
|
||||
} else {
|
||||
$wherecond['groups'] = '(' . $grouptest .')';
|
||||
|
||||
Reference in New Issue
Block a user