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
|
|
|
*/
|
|
|
|
|
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
|
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
/** @var string */
|
|
|
|
|
protected $event;
|
|
|
|
|
/** @var string */
|
|
|
|
|
protected $appID;
|
2017-07-19 13:44:10 -04:00
|
|
|
/** @var \OCP\IGroup[]|null */
|
2016-02-08 20:51:12 -05:00
|
|
|
protected $groups;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* DispatcherEvent constructor.
|
|
|
|
|
*
|
|
|
|
|
* @param string $event
|
|
|
|
|
* @param $appID
|
2017-07-19 13:44:10 -04:00
|
|
|
* @param \OCP\IGroup[]|null $groups
|
2016-02-08 20:51:12 -05:00
|
|
|
* @since 9.0.0
|
|
|
|
|
*/
|
2024-03-28 11:13:19 -04:00
|
|
|
public function __construct($event, $appID, ?array $groups = null) {
|
2016-02-08 20:51:12 -05:00
|
|
|
$this->event = $event;
|
|
|
|
|
$this->appID = $appID;
|
|
|
|
|
$this->groups = $groups;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
* @since 9.0.0
|
|
|
|
|
*/
|
|
|
|
|
public function getEvent() {
|
|
|
|
|
return $this->event;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
* @since 9.0.0
|
|
|
|
|
*/
|
|
|
|
|
public function getAppID() {
|
|
|
|
|
return $this->appID;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* returns the group Ids
|
|
|
|
|
* @return string[]
|
|
|
|
|
* @since 9.0.0
|
|
|
|
|
*/
|
|
|
|
|
public function getGroups() {
|
|
|
|
|
return array_map(function ($group) {
|
|
|
|
|
/** @var \OCP\IGroup $group */
|
|
|
|
|
return $group->getGID();
|
|
|
|
|
}, $this->groups);
|
|
|
|
|
}
|
|
|
|
|
}
|