From 9a735ae779302a62560c9beaccec701daa72bf1b Mon Sep 17 00:00:00 2001 From: "Adam R. Welle" Date: Thu, 6 Nov 2025 15:10:28 -0500 Subject: [PATCH] replaces is_siteadmin() with check for 'moodle/site:config' capability --- classes/util.php | 2 +- index.php | 5 +++-- version.php | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/classes/util.php b/classes/util.php index 36fc34c..661056a 100644 --- a/classes/util.php +++ b/classes/util.php @@ -115,7 +115,7 @@ public static function setdebug() { // Show the debug info box only if at leas one debug setting is active or the adhoc debug mode is used. if (!empty($showdebuginfo) || static::is_adhoc_debug()) { $infocontent->debugsettings = $debugsettings; - if (is_siteadmin()) { // For site admins the link to the setting should be shown. + if (has_capability('moodle/site:config', \context_system::instance(), $realuser)) { $manageurl = new \moodle_url('/admin/tool/userdebug/index.php'); $infocontent->manageurl = $manageurl->out(); } diff --git a/index.php b/index.php index 547d89f..9f189c2 100644 --- a/index.php +++ b/index.php @@ -29,8 +29,9 @@ require_once($CFG->dirroot . '/' . $CFG->admin . '/roles/lib.php'); admin_externalpage_setup('tool_userdebug', '', null); -if (!is_siteadmin()) { - die; + +if (!has_capability('moodle/site:config', context_system::instance())) { + return; } $mycfg = get_config('tool_userdebug'); diff --git a/version.php b/version.php index 1bc3844..bdd8bc3 100644 --- a/version.php +++ b/version.php @@ -24,7 +24,7 @@ */ defined('MOODLE_INTERNAL') || die; -$plugin->version = 2025070100; +$plugin->version = 2025110601; $plugin->release = 'v5.0.1 (2025070100)'; $plugin->requires = 2025040800; $plugin->maturity = MATURITY_STABLE;