MDL-22579 fixed location of access control check - prevents display of backups sectio...
authorPetr Skoda <skodak@moodle.org>
Wed, 26 May 2010 16:03:10 +0000 (16:03 +0000)
committerPetr Skoda <skodak@moodle.org>
Wed, 26 May 2010 16:03:10 +0000 (16:03 +0000)
lib/file/file_browser.php

index e0f352e..399c848 100644 (file)
@@ -431,16 +431,16 @@ class file_browser {
     private function get_file_info_section_backup($course, $context, $filearea=null, $itemid=null, $filepath=null, $filename=null) {
         global $CFG, $DB;
 
+        if (!has_capability('moodle/backup:backupcourse', $context) and !has_capability('moodle/restore:restorecourse', $context)) {
+            return null;
+        }
+
         $fs = get_file_storage();
         if (empty($itemid)) {
             // list all sections
             return new file_info_coursesectionbackup($this, $context, $course);
         }
 
-        if (!has_capability('moodle/backup:backupcourse', $context) and !has_capability('moodle/restore:restorecourse', $context)) {
-            return null;
-        }
-
         if (!$section = $DB->get_record('course_sections', array('course'=>$course->id, 'id'=>$itemid))) {
             return null; // does not exist
         }