mirror of
https://github.com/nextcloud/server.git
synced 2026-04-20 22:00:39 -04:00
fix(theming): Adjust config listener to validate apporder config
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
parent
f74084cd3d
commit
fa2c834aab
1 changed files with 10 additions and 6 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue