1
0

ManagerEvent.php 2.3 KB

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