MDL-45126 do not allow guests see name and summary of hidden course
authorMarina Glancy <marina@moodle.com>
Wed, 16 Apr 2014 06:35:20 +0000 (14:35 +0800)
committerDan Poltawski <dan@moodle.com>
Wed, 7 May 2014 08:22:20 +0000 (16:22 +0800)
enrol/index.php

index 3cc5335..68a12fd 100644 (file)
@@ -41,6 +41,10 @@ if ($course->id == SITEID) {
     redirect("$CFG->wwwroot/");
 }
 
+if (!$course->visible && !has_capability('moodle/course:viewhiddencourses', context_course::instance($course->id))) {
+    print_error('coursehidden');
+}
+
 $PAGE->set_course($course);
 $PAGE->set_pagelayout('course');
 $PAGE->set_url('/enrol/index.php', array('id'=>$course->id));