accesslib: Fix get_context_users_bycap() when no roles grant the cap
When no roles mention the capability, get_context_users_bycap() breaks badly. This trivial patch does a sanity check before jumping into the SQL shark-pool... MDL-13160
This commit is contained in:
@@ -1145,6 +1145,10 @@ function get_context_users_bycap ($context, $capability='moodle/course:view', $f
|
||||
rs_close($rs);
|
||||
$roles = implode(',', $roles);
|
||||
|
||||
if (empty($roles)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
//
|
||||
// User permissions subselect SQL
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user