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

This commit is contained in:
Andrew Robert Nicols
2012-06-20 17:07:30 +01:00
parent 5649520d9b
commit a386e6e017
+3
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;
}
}