Skip to content
Browse files

MDL-33916 Ensure that capabilities are checked for cached user enrolm…

…ents
  • Loading branch information...
1 parent 5649520 commit a386e6e01792144ba53ae2ab257c0f014fc7b0e2 @andrewnicols andrewnicols committed
Showing with 3 additions and 0 deletions.
  1. +3 −0 lib/accesslib.php
View
3 lib/accesslib.php
@@ -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;
}
}

0 comments on commit a386e6e

Please sign in to comment.
Something went wrong with that request. Please try again.