mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-28488 backup - '[backup|restore]:configure cap does not control import mode anymore
This commit is contained in:
parent
9530e1ed68
commit
2a4ba40f31
2 changed files with 22 additions and 14 deletions
|
@ -217,17 +217,21 @@ abstract class backup_check {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the user has the ability to configure the backup. If not then we need
|
// Check the user has the ability to configure the backup. If not then we need
|
||||||
// to lock all settings by permission so that no changes can be made.
|
// to lock all settings by permission so that no changes can be made. This does
|
||||||
|
// not apply to the import facility, where the activities must be always enabled
|
||||||
|
// to be able to pick them
|
||||||
|
if ($mode != backup::MODE_IMPORT) {
|
||||||
$hasconfigcap = has_capability('moodle/backup:configure', $coursectx, $userid);
|
$hasconfigcap = has_capability('moodle/backup:configure', $coursectx, $userid);
|
||||||
if (!$hasconfigcap) {
|
if (!$hasconfigcap) {
|
||||||
$settings = $backup_controller->get_plan()->get_settings();
|
$settings = $backup_controller->get_plan()->get_settings();
|
||||||
foreach ($settings as $setting) {
|
foreach ($settings as $setting) {
|
||||||
if ($setting->get_name()=='filename') {
|
if ($setting->get_name() == 'filename') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$setting->set_status(base_setting::LOCKED_BY_PERMISSION);
|
$setting->set_status(base_setting::LOCKED_BY_PERMISSION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,7 +156,10 @@ abstract class restore_check {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the user has the ability to configure the restore. If not then we need
|
// Check the user has the ability to configure the restore. If not then we need
|
||||||
// to lock all settings by permission so that no changes can be made.
|
// to lock all settings by permission so that no changes can be made. This does
|
||||||
|
// not apply to the import facility, where all the activities (picked on backup)
|
||||||
|
// are restored automatically without restore UI
|
||||||
|
if ($mode != backup::MODE_IMPORT) {
|
||||||
$hasconfigcap = has_capability('moodle/restore:configure', $coursectx, $userid);
|
$hasconfigcap = has_capability('moodle/restore:configure', $coursectx, $userid);
|
||||||
if (!$hasconfigcap) {
|
if (!$hasconfigcap) {
|
||||||
$settings = $restore_controller->get_plan()->get_settings();
|
$settings = $restore_controller->get_plan()->get_settings();
|
||||||
|
@ -164,6 +167,7 @@ abstract class restore_check {
|
||||||
$setting->set_status(base_setting::LOCKED_BY_PERMISSION);
|
$setting->set_status(base_setting::LOCKED_BY_PERMISSION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure the user has the rolldates capability. If not we want to lock this
|
// Ensure the user has the rolldates capability. If not we want to lock this
|
||||||
// settings so that they cannot change it.
|
// settings so that they cannot change it.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue