Permalink
Browse files

MDL-25988 fixed overriding of roles variable

credit goes to Michael Landis
  • Loading branch information...
1 parent 5a7f931 commit 3093ce8021eee944fe948c922122fc894466ad4c @skodak skodak committed Jan 14, 2011
Showing with 3 additions and 3 deletions.
  1. +3 −3 enrol/database/lib.php
@@ -430,8 +430,8 @@ public function sync_enrolments() {
unset($user_mapping);
// enrol all users and sync roles
- foreach ($requested_roles as $userid=>$roles) {
- foreach ($roles as $roleid) {
+ foreach ($requested_roles as $userid=>$userroles) {
+ foreach ($userroles as $roleid) {
if (empty($current_roles[$userid])) {
$this->enrol_user($instance, $userid, $roleid);
$current_roles[$userid][$roleid] = $roleid;
@@ -441,7 +441,7 @@ public function sync_enrolments() {
// unassign removed roles
foreach($current_roles[$userid] as $cr) {
- if (empty($roles[$cr])) {
+ if (empty($userroles[$cr])) {
role_unassign($cr, $userid, $context->id, 'enrol_database', $instance->id);
unset($current_roles[$userid][$cr]);
}

0 comments on commit 3093ce8

Please sign in to comment.