Permalink
Browse files

Don't overwrite capabilities when loading default role

  • Loading branch information...
1 parent 8f8ed47 commit ca23ffdb748891de4d725bb3453327b6bff2275d moodler committed Sep 14, 2006
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/accesslib.php
View
@@ -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

0 comments on commit ca23ffd

Please sign in to comment.