MDL-14261 fixed access control issues for backup and unittest plugins; merged from...
authorskodak <skodak>
Sat, 5 Jul 2008 13:08:07 +0000 (13:08 +0000)
committerskodak <skodak>
Sat, 5 Jul 2008 13:08:07 +0000 (13:08 +0000)
admin/settings/top.php

index f2a8520b58b8570be759f4fb49772a4af3815b1a..4651338ad44af761547f25d24dfa6e6cd206efec 100644 (file)
@@ -42,7 +42,12 @@ foreach (get_list_of_plugins($CFG->admin.'/report') as $plugin) {
         if ($reportname[1] == '[') {
             $reportname = get_string($plugin, 'admin');
         }
-        $ADMIN->add('reports', new admin_externalpage('report'.$plugin, $reportname, "$CFG->wwwroot/$CFG->admin/report/$plugin/index.php",'moodle/site:viewreports'));
+        // ugly hack for special access control in reports
+        switch($plugin) {
+            case 'backups': $cap = 'moodle/site:backup'; break;
+            default: $cap = 'moodle/site:viewreports';
+        }
+        $ADMIN->add('reports', new admin_externalpage('report'.$plugin, $reportname, "$CFG->wwwroot/$CFG->admin/report/$plugin/index.php",$cap));
     }
 }