mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
Added has_capability checks
This commit is contained in:
parent
41d7209c7f
commit
6ac96fcb3c
@ -21,8 +21,10 @@
|
||||
}
|
||||
|
||||
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);
|
||||
|
@ -33,8 +33,10 @@
|
||||
}
|
||||
|
||||
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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user