mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
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:
parent
c648a2259c
commit
c2d88da708
@ -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
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user