MDL-69448 backup: fix capability checks when unable to copy user data.
When a given user doesn't have the capability to "Include user data" during course copying, freeze the form element rather than not adding it at all. This caused problems as the element was required before preceding with the course copy.
This commit is contained in:
@@ -72,14 +72,16 @@ class asynchronous_copy_task extends adhoc_task {
|
||||
$keepuserdata = (bool)$copyinfo->userdata;
|
||||
$keptroles = $copyinfo->keptroles;
|
||||
|
||||
$backupplan->get_setting('users')->set_value('1');
|
||||
$bc->set_kept_roles($keptroles);
|
||||
|
||||
// If we are not keeping user data don't include users or data in the backup.
|
||||
// In this case we'll add the user enrolments at the end.
|
||||
// Also if we have no roles to keep don't backup users.
|
||||
if (empty($keptroles) || !$keepuserdata) {
|
||||
$backupplan->get_setting('users')->set_status(\backup_setting::NOT_LOCKED);
|
||||
$backupplan->get_setting('users')->set_value('0');
|
||||
} else {
|
||||
$backupplan->get_setting('users')->set_value('1');
|
||||
}
|
||||
|
||||
// Do some preflight checks on the backup.
|
||||
|
||||
Reference in New Issue
Block a user