aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/App/AppManager.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/App/AppManager.php')
-rw-r--r--lib/private/App/AppManager.php16
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
));