From 2948abf1e348d4c48ee8dced81d881d8df956535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mudr=C3=A1k?= Date: Mon, 4 Mar 2024 22:05:14 +0100 Subject: [PATCH] MDL-80160 admin: Fix site admins selector UI if the list is hardcoded If the list of site admins was defined in the config.php, the UI to select / modify admins never worked. But there was no indication of the reason which was unexpected and confusing. --- admin/roles/admins.php | 13 +++++++++++++ lang/en/role.php | 1 + 2 files changed, 14 insertions(+) diff --git a/admin/roles/admins.php b/admin/roles/admins.php index 8dfb5de196c..b4855e0a20b 100644 --- a/admin/roles/admins.php +++ b/admin/roles/admins.php @@ -38,6 +38,19 @@ if (!is_siteadmin()) { } $admisselector = new core_role_admins_existing_selector(); + +if (array_key_exists('siteadmins', $CFG->config_php_settings)) { + echo $OUTPUT->header(); + echo $OUTPUT->heading(get_string('manageadmins', 'core_role'), 3); + echo $OUTPUT->notification(get_string('siteadministratorsconfigphp', 'core_role'), \core\output\notification::NOTIFY_INFO); + echo $OUTPUT->box_start(); + echo $OUTPUT->paragraph(get_string('existingadmins', 'core_role')); + $admisselector->display(); + echo $OUTPUT->box_end(); + echo $OUTPUT->footer(); + die(); +} + $potentialadmisselector = new core_role_admins_potential_selector(); if ($addusersaction) { diff --git a/lang/en/role.php b/lang/en/role.php index a50202c1750..342d02db9cd 100644 --- a/lang/en/role.php +++ b/lang/en/role.php @@ -428,6 +428,7 @@ $string['showallroles'] = 'Show all roles'; $string['showthisuserspermissions'] = 'Show this user\'s permissions'; $string['site:accessallgroups'] = 'Access all groups'; $string['siteadministrators'] = 'Site administrators'; +$string['siteadministratorsconfigphp'] = 'The list of site administrators can\'t be changed because it is defined in config.php.'; $string['site:approvecourse'] = 'Approve course creation'; $string['site:backup'] = 'Backup courses'; $string['site:config'] = 'Change site configuration';