mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 18:06:51 +02:00
MDL-33916 Ensure that capabilities are checked for cached user enrolments
This commit is contained in:
parent
5c1b768aec
commit
1db89f5e6a
1 changed files with 3 additions and 0 deletions
|
@ -1961,6 +1961,9 @@ function is_enrolled(context $context, $user = null, $withcapability = '', $only
|
||||||
$coursecontext->reload_if_dirty();
|
$coursecontext->reload_if_dirty();
|
||||||
if (isset($USER->enrol['enrolled'][$coursecontext->instanceid])) {
|
if (isset($USER->enrol['enrolled'][$coursecontext->instanceid])) {
|
||||||
if ($USER->enrol['enrolled'][$coursecontext->instanceid] > time()) {
|
if ($USER->enrol['enrolled'][$coursecontext->instanceid] > time()) {
|
||||||
|
if ($withcapability and !has_capability($withcapability, $context, $userid)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue