2016-02-08 20:51:12 -05:00
|
|
|
<?php
|
2024-05-23 03:26:56 -04:00
|
|
|
|
2016-02-08 20:51:12 -05:00
|
|
|
/**
|
2024-05-23 03:26:56 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2016-02-08 20:51:12 -05:00
|
|
|
*/
|
2026-05-28 08:54:31 -04:00
|
|
|
|
2016-02-08 20:51:12 -05:00
|
|
|
namespace OCP\App;
|
|
|
|
|
|
2019-10-16 06:36:03 -04:00
|
|
|
use OCP\EventDispatcher\Event;
|
2016-02-08 20:51:12 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Class ManagerEvent
|
|
|
|
|
*
|
|
|
|
|
* @since 9.0.0
|
2026-06-05 04:47:14 -04:00
|
|
|
* @deprecated 22.0.0 Use AppEnabledEvent, AppDisableEvent and AppUpdateEvent instead
|
2016-02-08 20:51:12 -05:00
|
|
|
*/
|
|
|
|
|
class ManagerEvent extends Event {
|
2021-02-09 07:53:41 -05:00
|
|
|
/**
|
2024-02-14 14:48:27 -05:00
|
|
|
* @since 9.0.0
|
2021-02-09 07:53:41 -05:00
|
|
|
* @deprecated 22.0.0
|
|
|
|
|
*/
|
2020-04-10 10:54:27 -04:00
|
|
|
public const EVENT_APP_ENABLE = 'OCP\App\IAppManager::enableApp';
|
2021-02-09 07:53:41 -05:00
|
|
|
|
|
|
|
|
/**
|
2024-02-14 14:48:27 -05:00
|
|
|
* @since 9.0.0
|
2021-02-09 07:53:41 -05:00
|
|
|
* @deprecated 22.0.0
|
|
|
|
|
*/
|
2020-04-10 10:54:27 -04:00
|
|
|
public const EVENT_APP_ENABLE_FOR_GROUPS = 'OCP\App\IAppManager::enableAppForGroups';
|
2021-02-09 07:53:41 -05:00
|
|
|
|
|
|
|
|
/**
|
2024-02-14 14:48:27 -05:00
|
|
|
* @since 9.0.0
|
2021-02-09 07:53:41 -05:00
|
|
|
* @deprecated 22.0.0
|
|
|
|
|
*/
|
2020-04-10 10:54:27 -04:00
|
|
|
public const EVENT_APP_DISABLE = 'OCP\App\IAppManager::disableApp';
|
2016-02-08 20:51:12 -05:00
|
|
|
|
2016-08-15 18:52:41 -04:00
|
|
|
/**
|
|
|
|
|
* @since 9.1.0
|
2021-02-09 07:53:41 -05:00
|
|
|
* @deprecated 22.0.0
|
2016-08-15 18:52:41 -04:00
|
|
|
*/
|
2020-04-10 10:54:27 -04:00
|
|
|
public const EVENT_APP_UPDATE = 'OCP\App\IAppManager::updateApp';
|
2016-08-15 18:52:41 -04:00
|
|
|
|
2016-02-08 20:51:12 -05:00
|
|
|
/**
|
|
|
|
|
* DispatcherEvent constructor.
|
|
|
|
|
*
|
|
|
|
|
* @param string $event
|
|
|
|
|
* @param $appID
|
2026-06-05 04:47:14 -04:00
|
|
|
* @param list<\OCP\IGroup|string>|null $groups
|
2016-02-08 20:51:12 -05:00
|
|
|
* @since 9.0.0
|
|
|
|
|
*/
|
2026-06-05 04:47:14 -04:00
|
|
|
public function __construct(
|
|
|
|
|
private readonly string $event,
|
|
|
|
|
private readonly string $appID,
|
|
|
|
|
private readonly ?array $groups = null,
|
|
|
|
|
) {
|
2016-02-08 20:51:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @since 9.0.0
|
|
|
|
|
*/
|
2026-06-05 04:47:14 -04:00
|
|
|
public function getEvent(): string {
|
2016-02-08 20:51:12 -05:00
|
|
|
return $this->event;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
* @since 9.0.0
|
|
|
|
|
*/
|
2026-06-05 04:47:14 -04:00
|
|
|
public function getAppID(): string {
|
2016-02-08 20:51:12 -05:00
|
|
|
return $this->appID;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* returns the group Ids
|
2026-06-05 04:47:14 -04:00
|
|
|
* @return list<string>
|
2016-02-08 20:51:12 -05:00
|
|
|
* @since 9.0.0
|
|
|
|
|
*/
|
2026-06-05 04:47:14 -04:00
|
|
|
public function getGroups(): array {
|
|
|
|
|
return array_map(function (\OCP\IGroup|string $group): string {
|
|
|
|
|
return ($group instanceof \OCP\IGroup)
|
|
|
|
|
? $group->getGID()
|
|
|
|
|
: $group;
|
2016-02-08 20:51:12 -05:00
|
|
|
}, $this->groups);
|
|
|
|
|
}
|
|
|
|
|
}
|