]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14045
authorthepurpleblob <thepurpleblob>
Tue, 3 Jun 2008 13:59:41 +0000 (13:59 +0000)
committerthepurpleblob <thepurpleblob>
Tue, 3 Jun 2008 13:59:41 +0000 (13:59 +0000)
Now respects mod/assignment:view

mod/assignment/type/online/all.php

index 50dacce7c5a94af87c9db8da990c7d8deaa39885..5394de8428ae3f72a110e13ee509f009ca2da079 100644 (file)
 
     require_course_login($course);
 
+    // check for view capability at course level
+    $context = get_context_instance(CONTEXT_COURSE,$course->id);
+    require_capability('mod/assignment:view',$context);
+
     // various strings
     $str = new stdClass; 
     $str->assignments = get_string("modulenameplural", "assignment");
             continue;
         } 
 
+        // check we are allowed to view this
+        $context = get_context_instance(CONTEXT_MODULE, $assignment->coursemodule);
+        if (!has_capability('mod/assignment:view',$context)) {
+            continue;
+        }
+
         // create instance of assignment class to get 
         // submitted assignments
         $onlineinstance = new assignment_online( $assignment->coursemodule );