From 1ce2155d1da2a4a3c357f55afab8c3b2ccf091ff Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Mon, 16 Dec 2024 21:52:52 -0100 Subject: [PATCH] feat(lexicon): enforce default userconfig Signed-off-by: Maxence Lange --- lib/private/Config/UserConfig.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/private/Config/UserConfig.php b/lib/private/Config/UserConfig.php index 9e8f93f89a6e5..741070ba0979d 100644 --- a/lib/private/Config/UserConfig.php +++ b/lib/private/Config/UserConfig.php @@ -1850,14 +1850,15 @@ private function matchAndApplyLexiconDefinition( $this->logger->notice('User config key ' . $app . '/' . $key . ' is set as deprecated.'); } - if ($this->hasKey($userId, $app, $key, $lazy)) { + $enforcedValue = $this->config->getSystemValue('lexicon.default.userconfig.enforced', [])[$app][$key] ?? false; + if (!$enforcedValue && $this->hasKey($userId, $app, $key, $lazy)) { return true; // if key exists there should be no need to extract default } // default from Lexicon got priority but it can still be overwritten by admin $default = $this->getSystemDefault($app, $configValue) ?? $configValue->getDefault() ?? $default; - return true; + return !$enforcedValue; // returning false will make get() returning $default and set() not changing value in database } /**