Fixed some warnings with role mappings.
This commit is contained in:
@@ -6012,9 +6012,12 @@
|
||||
// the following code creates new roles
|
||||
// but we could use more intelligent detection, and role mapping
|
||||
// get role mapping info from $restore
|
||||
$rolemappings = array();
|
||||
|
||||
$rolemappings = $restore->rolesmapping; // an array
|
||||
if ($info->roles) {
|
||||
if (!empty($restore->rolesmapping)) {
|
||||
$rolemappings = $restore->rolesmapping;
|
||||
}
|
||||
if (isset($info->roles) && $info->roles) {
|
||||
foreach ($info->roles as $oldroleid=>$roledata) {
|
||||
|
||||
/// first we check if the roles are in the mappings
|
||||
@@ -6069,7 +6072,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -6102,12 +6104,10 @@
|
||||
|
||||
if (!empty($course->roleoverrides)) {
|
||||
$courseoverrides = $course->roleoverrides;
|
||||
$rolemappings = $restore->rolesmapping;
|
||||
foreach ($courseoverrides as $oldroleid => $courseoverride) {
|
||||
|
||||
// if not importing into exiting course, or creating new role, we are ok
|
||||
// local course overrides to be respected (i.e. restored course overrides ignored)
|
||||
if ($restore->restoreto != 1 || empty($rolemappings[$oldroleid])) {
|
||||
if ($restore->restoreto != 1 || empty($restore->rolesmapping[$oldroleid])) {
|
||||
restore_write_roleoverrides($restore, $courseoverride->overrides, "course", CONTEXT_COURSE, $course->course_id, $oldroleid);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user