MDL-73598 reportbuilder: feature switch for custom reports.

This commit is contained in:
Paul Holden 2022-01-18 18:04:37 +00:00
parent a01f1fa71c
commit 335012580b
6 changed files with 105 additions and 8 deletions

View file

@ -30,7 +30,13 @@ use core_reportbuilder\permission;
defined('MOODLE_INTERNAL') || die;
/** @var admin_root $ADMIN */
$ADMIN->add('reports', new admin_category('reportbuilder', new lang_string('reportbuilder', 'core_reportbuilder')));
$ADMIN->add(
'reports', new admin_category(
'reportbuilder',
new lang_string('reportbuilder', 'core_reportbuilder'),
empty($CFG->enablecustomreports)
)
);
$ADMIN->add(
'reportbuilder', new accesscallback(
@ -39,6 +45,7 @@ $ADMIN->add(
(new moodle_url('/reportbuilder/index.php'))->out(),
static function(accesscallback $accesscallback): bool {
return permission::can_view_reports_list();
}
},
empty($CFG->enablecustomreports)
)
);

View file

@ -64,6 +64,12 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
1)
);
$optionalsubsystems->add(new admin_setting_configcheckbox('enablecustomreports',
new lang_string('enablecustomreports', 'core_reportbuilder'),
new lang_string('enablecustomreports_desc', 'core_reportbuilder'),
1
));
$fullunicodesupport = true;
if ($DB->get_dbfamily() == 'mysql') {
$collation = $DB->get_dbcollation();