diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-12-06 12:09:52 +0100 |
---|---|---|
committer | Côme Chilliet (Rebase PR Action) <come-nc@users.noreply.github.com> | 2022-12-19 09:10:41 +0000 |
commit | a1301de7fa5cb2d4ac2a894689cb22cb5c8f494e (patch) | |
tree | 74a10efc50ae41b512b61f9d127b3456cacd17ba /lib/private/App/AppManager.php | |
parent | 3cce9aa547d44cdb9ead142bb792a67be789b0e9 (diff) | |
download | nextcloud-server-a1301de7fa5cb2d4ac2a894689cb22cb5c8f494e.tar.gz nextcloud-server-a1301de7fa5cb2d4ac2a894689cb22cb5c8f494e.zip |
Revert "Just use string for groups in enableAppForGroups"
This reverts commit e17244e92fb316d2f2e3fd1ae343bd47b54395b8.
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/private/App/AppManager.php')
-rw-r--r-- | lib/private/App/AppManager.php | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php index 3b352001dac..6d2fe51d0ed 100644 --- a/lib/private/App/AppManager.php +++ b/lib/private/App/AppManager.php @@ -52,6 +52,7 @@ use Psr\Log\LoggerInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; class AppManager implements IAppManager { + /** * Apps with these types can not be enabled for certain groups only * @var string[] @@ -183,7 +184,7 @@ class AppManager implements IAppManager { /** * @param string $appId - * @return string[] + * @return array */ public function getAppRestriction(string $appId): array { $values = $this->getInstalledAppsValues(); @@ -345,7 +346,7 @@ class AppManager implements IAppManager { * Enable an app only for specific groups * * @param string $appId - * @param string[] $groups + * @param \OCP\IGroup[] $groups * @param bool $forceEnable * @throws \InvalidArgumentException if app can't be enabled for groups * @throws AppPathNotFoundException @@ -363,8 +364,15 @@ class AppManager implements IAppManager { $this->ignoreNextcloudRequirementForApp($appId); } - $this->installedAppsCache[$appId] = json_encode($groups); - $this->appConfig->setValue($appId, 'enabled', json_encode($groups)); + $groupIds = array_map(function ($group) { + /** @var \OCP\IGroup $group */ + return ($group instanceof IGroup) + ? $group->getGID() + : $group; + }, $groups); + + $this->installedAppsCache[$appId] = json_encode($groupIds); + $this->appConfig->setValue($appId, 'enabled', json_encode($groupIds)); $this->dispatcher->dispatch(ManagerEvent::EVENT_APP_ENABLE_FOR_GROUPS, new ManagerEvent( ManagerEvent::EVENT_APP_ENABLE_FOR_GROUPS, $appId, $groups )); |