Merge branch 'MDL-79139-401' of https://github.com/paulholden/moodle into MOODLE_401_STABLE

This commit is contained in:
Ilya Tregubov 2023-08-28 15:40:51 +08:00
commit bc67d4491c
No known key found for this signature in database
GPG Key ID: 0F58186F748E55C1
2 changed files with 10 additions and 15 deletions

View File

@ -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'] = '<p>Are you sure that you want to delete role "{$a->name} ({$a->shortname})"?</p><p>Currently this role is assigned to {$a->count} users.</p>';

View File

@ -14,26 +14,16 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Verifies sanity of default user role.
*
* @package core
* @category check
* @copyright 2020 Brendan Heywood <brendan@catalyst-au.net>
* @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 <brendan@catalyst-au.net>
* @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))
);
}
/**