diff --git a/backup/util/settings/base_setting.class.php b/backup/util/settings/base_setting.class.php index c5cb56754d4..4988d5278c7 100644 --- a/backup/util/settings/base_setting.class.php +++ b/backup/util/settings/base_setting.class.php @@ -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. diff --git a/backup/util/settings/setting_dependency.class.php b/backup/util/settings/setting_dependency.class.php index eebb6f14f3f..425a328c21c 100644 --- a/backup/util/settings/setting_dependency.class.php +++ b/backup/util/settings/setting_dependency.class.php @@ -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) {