mirror of
https://github.com/nextcloud/server.git
synced 2026-02-20 00:12:30 -05:00
Just use string for groups in enableAppForGroups
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
7996a12aef
commit
3cce9aa547
3 changed files with 16 additions and 28 deletions
|
|
@ -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
|
||||
));
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue