mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
fixed logic of moodle_install_roles() - it now calls update_capabilities() after creation of default roles, but before first role_assign(). The problem was that role_assign calls code from forum lib which already uses capabilities, this might cause even bigger problems later.
This commit is contained in:
parent
6fc73d59b8
commit
250934b8e0
@ -147,9 +147,6 @@
|
||||
if ($status) {
|
||||
// Install the roles system.
|
||||
moodle_install_roles();
|
||||
if (!update_capabilities()) {
|
||||
error('Had trouble installing the core capabilities for the Roles System');
|
||||
}
|
||||
set_config('statsrolesupgraded',time());
|
||||
|
||||
// Write default settings unconditionally (i.e. even if a setting is already set, overwrite it)
|
||||
@ -247,11 +244,9 @@
|
||||
if (empty($CFG->rolesactive)) {
|
||||
// Upgrade to the roles system.
|
||||
moodle_install_roles();
|
||||
}
|
||||
if (!update_capabilities()) {
|
||||
error('Had trouble upgrading the core capabilities for the Roles System');
|
||||
} else {
|
||||
set_config('rolesactive', 1);
|
||||
} else if (!update_capabilities()) {
|
||||
error('Had trouble upgrading the core capabilities for the Roles System');
|
||||
}
|
||||
require_once($CFG->libdir.'/statslib.php');
|
||||
if (!stats_upgrade_for_roles_wrapper()) {
|
||||
|
@ -932,6 +932,10 @@ function moodle_install_roles() {
|
||||
$studentrole = create_role(get_string('defaultcoursestudent'), 'student', get_string('defaultcoursestudentdescription'), 'moodle/legacy:student');
|
||||
$guestrole = create_role(get_string('guest'), 'guest', get_string('guestdescription'), 'moodle/legacy:guest');
|
||||
|
||||
// now is the correct moment to install capabilitites - after creation of legacy roles, but before assigning of roles
|
||||
if (!update_capabilities()) {
|
||||
error('Had trouble upgrading the core capabilities for the Roles System');
|
||||
}
|
||||
|
||||
// Look inside user_admin, user_creator, user_teachers, user_students and
|
||||
// assign above new roles. If a user has both teacher and student role,
|
||||
|
Loading…
x
Reference in New Issue
Block a user