summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2022-12-01 11:41:54 +0100
committerCôme Chilliet (Rebase PR Action) <come-nc@users.noreply.github.com>2022-12-19 09:10:41 +0000
commit3cce9aa547d44cdb9ead142bb792a67be789b0e9 (patch)
tree81766a1f737798b24d4918d86c41c3a11da251d5 /lib
parent7996a12aef25b7ac8bd9a61f7b09f6806cef5ec4 (diff)
downloadnextcloud-server-3cce9aa547d44cdb9ead142bb792a67be789b0e9.tar.gz
nextcloud-server-3cce9aa547d44cdb9ead142bb792a67be789b0e9.zip
Just use string for groups in enableAppForGroups
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/App/AppManager.php16
-rw-r--r--lib/public/App/IAppManager.php7
-rw-r--r--lib/public/App/ManagerEvent.php21
3 files changed, 16 insertions, 28 deletions
diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php
index 6d2fe51d0ed..3b352001dac 100644
--- a/lib/private/App/AppManager.php
+++ b/lib/private/App/AppManager.php
@@ -52,7 +52,6 @@ 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[]
@@ -184,7 +183,7 @@ class AppManager implements IAppManager {
/**
* @param string $appId
- * @return array
+ * @return string[]
*/
public function getAppRestriction(string $appId): array {
$values = $this->getInstalledAppsValues();
@@ -346,7 +345,7 @@ class AppManager implements IAppManager {
* Enable an app only for specific groups
*
* @param string $appId
- * @param \OCP\IGroup[] $groups
+ * @param string[] $groups
* @param bool $forceEnable
* @throws \InvalidArgumentException if app can't be enabled for groups
* @throws AppPathNotFoundException
@@ -364,15 +363,8 @@ class AppManager implements IAppManager {
$this->ignoreNextcloudRequirementForApp($appId);
}
- $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->installedAppsCache[$appId] = json_encode($groups);
+ $this->appConfig->setValue($appId, 'enabled', json_encode($groups));
$this->dispatcher->dispatch(ManagerEvent::EVENT_APP_ENABLE_FOR_GROUPS, new ManagerEvent(
ManagerEvent::EVENT_APP_ENABLE_FOR_GROUPS, $appId, $groups
));
diff --git a/lib/public/App/IAppManager.php b/lib/public/App/IAppManager.php
index f7c9d848099..764b3b0a5b5 100644
--- a/lib/public/App/IAppManager.php
+++ b/lib/public/App/IAppManager.php
@@ -42,7 +42,6 @@ use OCP\IUser;
* @since 8.0.0
*/
interface IAppManager {
-
/**
* Returns the app information from "appinfo/info.xml".
*
@@ -117,7 +116,7 @@ interface IAppManager {
* Enable an app only for specific groups
*
* @param string $appId
- * @param \OCP\IGroup[] $groups
+ * @param string[] $groups
* @param bool $forceEnable
* @throws \Exception
* @since 8.0.0
@@ -197,13 +196,13 @@ interface IAppManager {
/**
* @param \OCP\IGroup $group
- * @return String[]
+ * @return string[]
* @since 17.0.0
*/
public function getEnabledAppsForGroup(IGroup $group): array;
/**
- * @param String $appId
+ * @param string $appId
* @return string[]
* @since 17.0.0
*/
diff --git a/lib/public/App/ManagerEvent.php b/lib/public/App/ManagerEvent.php
index 0069e57db42..9f2ef58b21d 100644
--- a/lib/public/App/ManagerEvent.php
+++ b/lib/public/App/ManagerEvent.php
@@ -53,21 +53,21 @@ class ManagerEvent extends Event {
public const EVENT_APP_UPDATE = 'OCP\App\IAppManager::updateApp';
/** @var string */
- protected $event;
+ protected string $event;
/** @var string */
- protected $appID;
- /** @var \OCP\IGroup[]|null */
- protected $groups;
+ protected string $appID;
+ /** @var string[]|null */
+ protected ?array $groups;
/**
* DispatcherEvent constructor.
*
* @param string $event
- * @param $appID
- * @param \OCP\IGroup[]|null $groups
+ * @param string $appID
+ * @param string[]|null $groups
* @since 9.0.0
*/
- public function __construct($event, $appID, array $groups = null) {
+ public function __construct($event, $appID, ?array $groups = null) {
$this->event = $event;
$this->appID = $appID;
$this->groups = $groups;
@@ -91,13 +91,10 @@ class ManagerEvent extends Event {
/**
* returns the group Ids
- * @return string[]
+ * @return string[]|null
* @since 9.0.0
*/
public function getGroups() {
- return array_map(function ($group) {
- /** @var \OCP\IGroup $group */
- return $group->getGID();
- }, $this->groups);
+ return $this->groups;
}
}