]> git.mjollnir.org Git - moodle.git/commitdiff
accesslib: get_user_courses_bycap() fix bug introduced by refactor
authormartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:11:04 +0000 (07:11 +0000)
committermartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:11:04 +0000 (07:11 +0000)
The refactor that created make_context_subobj() triggered a bug.
Smack in the hand to the sloppy programmer using variables outside
of the context they were meant to be used in!

lib/accesslib.php

index 328ca4a68be7fa10b685582a28bc75d4f2c77654..2dadd0b2d5d15ec4dd3b05948fdbc46e63a8c215 100755 (executable)
@@ -857,7 +857,7 @@ function get_user_courses_bycap($userid, $cap, $sess, $doanything, $sort='c.sort
             // build the context obj
             $c = make_context_subobj($c);
 
-            if (has_cap_fromsess($cap, $ctx, $sess, $doanything)) {
+            if (has_cap_fromsess($cap, $c->context, $sess, $doanything)) {
                 $courses[] = $c;
                 if ($limit > 0 && $cc++ > $limit) {
                     break;