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.
This commit is contained in:
David Mudrák
2024-03-05 23:45:11 +01:00
parent 970fe4d26d
commit 3ec1c77fc8
2 changed files with 14 additions and 0 deletions
+13
View File
@@ -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) {
+1
View File
@@ -433,6 +433,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';