MDL-52774 ajax: Require authentication when getting nav branch
authorKrista Koivisto <krista@kittysec.org>
Thu, 4 Feb 2016 05:51:06 +0000 (13:51 +0800)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 7 Mar 2016 23:39:45 +0000 (00:39 +0100)
When getting the navigation branch data through AJAX, require
login if forcelogin is set.

lib/ajax/getnavbranch.php

index e2e319a..d87f4ea 100644 (file)
@@ -32,6 +32,10 @@ require_once(dirname(__FILE__) . '/../../config.php');
 /** Include course lib for its functions */
 require_once($CFG->dirroot.'/course/lib.php');
 
+if (!empty($CFG->forcelogin)) {
+    require_login();
+}
+
 try {
     // Start buffer capture so that we can `remove` any errors
     ob_start();