]> git.mjollnir.org Git - moodle.git/commitdiff
Added has_capability checks
authorvyshane <vyshane>
Fri, 25 Aug 2006 08:27:28 +0000 (08:27 +0000)
committervyshane <vyshane>
Fri, 25 Aug 2006 08:27:28 +0000 (08:27 +0000)
course/report/stats/graph.php
course/report/stats/index.php
course/report/stats/report.php

index 610710bad29b09ed8a4264cbbf9e934137b12fca..09c69d5d1eaf895779297f9c5f725da34877d1bc 100644 (file)
     }
 
     require_login();
-    if (!isteacher($course->id)) {
-        error("You need to be a teacher to use this page");
+    $context = get_context_instance(CONTEXT_COURSE, $course->id);
+    
+    if (!has_capability('moodle/site:viewreports', $context)) {
+        error('You need do not have the required permission to view reports for this course');
     }
 
     stats_check_uptodate($course->id);
index e45c200acd58919e992a2aa1abd4231d97a34f5b..6554fb7f17b6206337b3fb5a97351f9cf7acde7e 100644 (file)
     }
 
     require_login();
-    if (!isteacher($course->id)) {
-        error("You need to be a teacher to use this page");
+    $context = get_context_instance(CONTEXT_COURSE, $course->id);
+    
+    if (!has_capability('moodle/site:viewreports', $context)) {
+        error('You need do not have the required permission to view reports for this course');
     }
 
     add_to_log($course->id, "course", "report stats", "report/stats/index.php?course=$course->id", $course->id); 
index b413fb29037cfe18410d52ba04c5d38feaf8b518..f25bf74db05f8c64a0e25c38aa010fdbc332fd3b 100644 (file)
@@ -4,7 +4,9 @@
     $courseoptions = array();
 
     foreach ($courses as $c) {
-        if (isteacher($c->id)) {
+        $context = get_context_instance(CONTEXT_COURSE, $c->id);
+
+        if (has_capability('moodle/site:viewreports', $context)) {
             $courseoptions[$c->id] = $c->shortname;
         }
     }