From 540880e6c4487d84878ba59493c71bb94550d2a4 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Mon, 24 Feb 2025 19:34:25 -0300 Subject: [PATCH] fix: keep the app enabled to admin group Signed-off-by: Vitor Mattos --- lib/BackgroundJob/EnableAppsForGroup.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/BackgroundJob/EnableAppsForGroup.php b/lib/BackgroundJob/EnableAppsForGroup.php index 801d5c7..7265d01 100644 --- a/lib/BackgroundJob/EnableAppsForGroup.php +++ b/lib/BackgroundJob/EnableAppsForGroup.php @@ -31,10 +31,15 @@ protected function run($argument): void { } foreach ($this->appIds as $appId) { $appId = $this->appManager->cleanAppId($appId); - $enabled = $this->appConfig->getValueArray($appId, 'enabled', []); - if (!in_array($this->groupId, $enabled)) { - $enabled[] = $this->groupId; - $this->appManager->enableAppForGroups($appId, $enabled); + $toSave = $enabled = $this->appConfig->getValueArray($appId, 'enabled', []); + if (!in_array($this->groupId, $toSave)) { + $toSave[] = $this->groupId; + } + if (!in_array('admin', $toSave)) { + $toSave[] = 'admin'; + } + if ($enabled !== $toSave) { + $this->appManager->enableAppForGroups($appId, $toSave); } } }