Merge pull request #41635 from nextcloud/fix/settings-apporder

fix(theming): Adjust config listener to validate `apporder` config also for closure navigation
This commit is contained in:
Ferdinand Thiessen 2023-11-21 14:34:39 +01:00 committed by GitHub
commit 151ff38fc9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -79,12 +79,16 @@ class BeforePreferenceListener implements IEventListener {
}
$value = json_decode($event->getConfigValue(), true, flags:JSON_THROW_ON_ERROR);
if (is_array(($value))) {
foreach ($value as $id => $info) {
if (!is_array($info) || empty($info) || !isset($info['app']) || !$this->appManager->isEnabledForUser($info['app']) || !is_numeric($info['order'] ?? '')) {
// Invalid config value, refuse the change
return;
}
if (!is_array(($value))) {
// Must be an array
return;
}
foreach ($value as $id => $info) {
// required format: [ navigation_id: string => [ order: int, app?: string ] ]
if (!is_string($id) || !is_array($info) || empty($info) || !isset($info['order']) || !is_numeric($info['order']) || (isset($info['app']) && !$this->appManager->isEnabledForUser($info['app']))) {
// Invalid config value, refuse the change
return;
}
}
$event->setValid(true);