mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-58594 backup: setting locked by permission can not be overriden
This commit is contained in:
parent
06e3b6d8ba
commit
0302548806
@ -70,6 +70,7 @@ abstract class base_setting {
|
||||
protected $visibility; // visibility of the setting (setting_base::VISIBLE/setting_base::HIDDEN)
|
||||
protected $status; // setting_base::NOT_LOCKED/setting_base::LOCKED_BY_PERMISSION...
|
||||
|
||||
/** @var setting_dependency[] */
|
||||
protected $dependencies = array(); // array of dependent (observer) objects (usually setting_base ones)
|
||||
protected $dependenton = array();
|
||||
|
||||
@ -201,6 +202,12 @@ abstract class base_setting {
|
||||
public function set_status($status) {
|
||||
$status = $this->validate_status($status);
|
||||
|
||||
if (($this->status == base_setting::LOCKED_BY_PERMISSION || $this->status == base_setting::LOCKED_BY_CONFIG)
|
||||
&& $status == base_setting::LOCKED_BY_HIERARCHY) {
|
||||
// Lock by permission or config can not be overriden by lock by hierarchy.
|
||||
return;
|
||||
}
|
||||
|
||||
// If the setting is being unlocked first check whether an other settings
|
||||
// this setting is dependent on are locked. If they are then we still don't
|
||||
// want to lock this setting.
|
||||
|
@ -202,6 +202,11 @@ class setting_dependency_disabledif_equals extends setting_dependency {
|
||||
* @return bool
|
||||
*/
|
||||
protected function process_value_change($oldvalue) {
|
||||
if ($this->dependentsetting->get_status() == base_setting::LOCKED_BY_PERMISSION ||
|
||||
$this->dependentsetting->get_status() == base_setting::LOCKED_BY_CONFIG) {
|
||||
// When setting is locked by permission or config do not apply dependencies.
|
||||
return false;
|
||||
}
|
||||
$prevalue = $this->dependentsetting->get_value();
|
||||
// If the setting is the desired value enact the dependency
|
||||
if ($this->setting->get_value() == $this->value) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user