feat: Enhances usergrades report page configuration

Replaces hardcoded URL with moodle_url for flexibility and security.
Adds capability requirement 'report/usergrades:view' for improved access control.
This commit is contained in:
Kumi 2024-11-20 17:46:27 +01:00
parent 79aa7978bb
commit 8d339008c1
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -2,5 +2,10 @@
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
if ($hassiteconfig) { // Needs this condition or there is error on login page if ($hassiteconfig) { // Needs this condition or there is error on login page
$ADMIN->add('reports', new admin_externalpage('report_usergrades', get_string('pluginname', 'report_usergrades'), "$CFG->wwwroot/report/usergrades/index.php")); $ADMIN->add('reports', new admin_externalpage(
'report_usergrades',
get_string('pluginname', 'report_usergrades'),
new moodle_url('/report/usergrades/index.php'),
'report/usergrades:view'
));
} }