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:
martinlanghoff 2008-01-25 00:53:01 +00:00
parent c648a2259c
commit c2d88da708

View File

@ -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
//