Don't overwrite capabilities when loading default role

This commit is contained in:
moodler 2006-09-14 09:41:09 +00:00
parent 8f8ed475f7
commit ca23ffdb74

View File

@ -121,7 +121,9 @@ function load_defaultuser_role() {
if ($capabilities = get_records_select('role_capabilities',
"roleid = $CFG->defaultuserroleid AND contextid = $sitecontext->id")) {
foreach ($capabilities as $capability) {
$USER->capabilities[$sitecontext->id][$capability->capability] = $capability->permission;
if (!isset($USER->capabilities[$sitecontext->id][$capability->capability])) { // Don't overwrite
$USER->capabilities[$sitecontext->id][$capability->capability] = $capability->permission;
}
}
// SPECIAL EXCEPTION: If the default user role is actually a guest role, then