diff --git a/lang/en/role.php b/lang/en/role.php index 994768db8fc..dc22fe216bf 100644 --- a/lang/en/role.php +++ b/lang/en/role.php @@ -220,6 +220,7 @@ $string['customrolename_help'] = 'Names of standard roles are localised automati $string['defaultrole'] = 'Default role'; $string['defaultx'] = 'Default: {$a}'; $string['defineroles'] = 'Define roles'; +$string['definitionofrolex'] = 'Definition of role \'{$a}\''; $string['deletecourseoverrides'] = 'Delete all overrides in course'; $string['deletelocalroles'] = 'Delete all local role assignments'; $string['deleterolesure'] = '

Are you sure that you want to delete role "{$a->name} ({$a->shortname})"?

Currently this role is assigned to {$a->count} users.

'; diff --git a/lib/classes/check/access/defaultuserrole.php b/lib/classes/check/access/defaultuserrole.php index 965d24fbe94..bae9935255f 100644 --- a/lib/classes/check/access/defaultuserrole.php +++ b/lib/classes/check/access/defaultuserrole.php @@ -14,26 +14,16 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Verifies sanity of default user role. - * - * @package core - * @category check - * @copyright 2020 Brendan Heywood - * @copyright 2008 petr Skoda - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace core\check\access; -defined('MOODLE_INTERNAL') || die(); - use core\check\check; use core\check\result; /** * Verifies sanity of default user role. * + * @package core + * @category check * @copyright 2020 Brendan Heywood * @copyright 2008 petr Skoda * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later @@ -55,10 +45,14 @@ class defaultuserrole extends check { * @return action_link|null */ public function get_action_link(): ?\action_link { - global $CFG; + global $CFG, $DB; + + $defaultrole = $DB->get_record('role', ['id' => $CFG->defaultuserroleid]); + return new \action_link( - new \moodle_url('/admin/roles/define.php?action=view&roleid=' . $CFG->defaultuserroleid), - get_string('userpolicies', 'admin')); + new \moodle_url('/admin/roles/define.php', ['action' => 'view', 'roleid' => $defaultrole->id]), + get_string('definitionofrolex', 'core_role', role_get_name($defaultrole)) + ); } /**