MDL-33916 Ensure that capabilities are checked for cached user enrolments

This commit is contained in:
Andrew Robert Nicols 2012-06-20 17:02:00 +01:00 committed by Dan Poltawski
parent 5c1b768aec
commit 1db89f5e6a

View file

@ -1961,6 +1961,9 @@ function is_enrolled(context $context, $user = null, $withcapability = '', $only
$coursecontext->reload_if_dirty();
if (isset($USER->enrol['enrolled'][$coursecontext->instanceid])) {
if ($USER->enrol['enrolled'][$coursecontext->instanceid] > time()) {
if ($withcapability and !has_capability($withcapability, $context, $userid)) {
return false;
}
return true;
}
}