Permalink
Browse files

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

…ents
  • Loading branch information...
1 parent fbbb4cc commit 83d3858b1637e5a10a63210986a1b1ad8de8b6b5 @andrewnicols andrewnicols committed Jun 20, 2012
Showing with 3 additions and 0 deletions.
  1. +3 −0 lib/accesslib.php
View
@@ -1935,6 +1935,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 83d3858

Please sign in to comment.