зеркало из https://github.com/nextcloud/server.git
Revert "Just use string for groups in enableAppForGroups"
This reverts commit e17244e92fb316d2f2e3fd1ae343bd47b54395b8. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
Родитель
3cce9aa547
Коммит
a1301de7fa
|
@ -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
|
||||
));
|
||||
|
|
|
@ -42,6 +42,7 @@ use OCP\IUser;
|
|||
* @since 8.0.0
|
||||
*/
|
||||
interface IAppManager {
|
||||
|
||||
/**
|
||||
* Returns the app information from "appinfo/info.xml".
|
||||
*
|
||||
|
@ -116,7 +117,7 @@ interface IAppManager {
|
|||
* Enable an app only for specific groups
|
||||
*
|
||||
* @param string $appId
|
||||
* @param string[] $groups
|
||||
* @param \OCP\IGroup[] $groups
|
||||
* @param bool $forceEnable
|
||||
* @throws \Exception
|
||||
* @since 8.0.0
|
||||
|
@ -196,13 +197,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 string $event;
|
||||
protected $event;
|
||||
/** @var string */
|
||||
protected string $appID;
|
||||
/** @var string[]|null */
|
||||
protected ?array $groups;
|
||||
protected $appID;
|
||||
/** @var \OCP\IGroup[]|null */
|
||||
protected $groups;
|
||||
|
||||
/**
|
||||
* DispatcherEvent constructor.
|
||||
*
|
||||
* @param string $event
|
||||
* @param string $appID
|
||||
* @param string[]|null $groups
|
||||
* @param $appID
|
||||
* @param \OCP\IGroup[]|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,10 +91,13 @@ class ManagerEvent extends Event {
|
|||
|
||||
/**
|
||||
* returns the group Ids
|
||||
* @return string[]|null
|
||||
* @return string[]
|
||||
* @since 9.0.0
|
||||
*/
|
||||
public function getGroups() {
|
||||
return $this->groups;
|
||||
return array_map(function ($group) {
|
||||
/** @var \OCP\IGroup $group */
|
||||
return $group->getGID();
|
||||
}, $this->groups);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче