You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ManagerEvent.php 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
  6. * @author Lukas Reschke <lukas@statuscode.ch>
  7. *
  8. * @license AGPL-3.0
  9. *
  10. * This code is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License, version 3,
  12. * as published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License, version 3,
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>
  21. *
  22. */
  23. namespace OCP\App;
  24. use Symfony\Component\EventDispatcher\Event;
  25. /**
  26. * Class ManagerEvent
  27. *
  28. * @package OCP\APP
  29. * @since 9.0.0
  30. */
  31. class ManagerEvent extends Event {
  32. const EVENT_APP_ENABLE = 'OCP\App\IAppManager::enableApp';
  33. const EVENT_APP_ENABLE_FOR_GROUPS = 'OCP\App\IAppManager::enableAppForGroups';
  34. const EVENT_APP_DISABLE = 'OCP\App\IAppManager::disableApp';
  35. /**
  36. * @since 9.1.0
  37. */
  38. const EVENT_APP_UPDATE = 'OCP\App\IAppManager::updateApp';
  39. /** @var string */
  40. protected $event;
  41. /** @var string */
  42. protected $appID;
  43. /** @var \OCP\IGroup[]|null */
  44. protected $groups;
  45. /**
  46. * DispatcherEvent constructor.
  47. *
  48. * @param string $event
  49. * @param $appID
  50. * @param \OCP\IGroup[]|null $groups
  51. * @since 9.0.0
  52. */
  53. public function __construct($event, $appID, array $groups = null) {
  54. $this->event = $event;
  55. $this->appID = $appID;
  56. $this->groups = $groups;
  57. }
  58. /**
  59. * @return string
  60. * @since 9.0.0
  61. */
  62. public function getEvent() {
  63. return $this->event;
  64. }
  65. /**
  66. * @return string
  67. * @since 9.0.0
  68. */
  69. public function getAppID() {
  70. return $this->appID;
  71. }
  72. /**
  73. * returns the group Ids
  74. * @return string[]
  75. * @since 9.0.0
  76. */
  77. public function getGroups() {
  78. return array_map(function ($group) {
  79. /** @var \OCP\IGroup $group */
  80. return $group->getGID();
  81. }, $this->groups);
  82. }
  83. }