BeforeTemplateRenderedEvent.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\Files_Sharing\Event;
  8. use OCP\EventDispatcher\Event;
  9. use OCP\Share\IShare;
  10. /**
  11. * Emitted before the rendering step of the public share page happens. The event
  12. * holds a flag that specifies if it is the authentication page of a public share.
  13. *
  14. * @since 20.0.0
  15. */
  16. class BeforeTemplateRenderedEvent extends Event {
  17. /**
  18. * @since 20.0.0
  19. */
  20. public const SCOPE_PUBLIC_SHARE_AUTH = 'publicShareAuth';
  21. /** @var IShare */
  22. private $share;
  23. /** @var string|null */
  24. private $scope;
  25. /**
  26. * @since 20.0.0
  27. */
  28. public function __construct(IShare $share, ?string $scope = null) {
  29. parent::__construct();
  30. $this->share = $share;
  31. $this->scope = $scope;
  32. }
  33. /**
  34. * @since 20.0.0
  35. */
  36. public function getShare(): IShare {
  37. return $this->share;
  38. }
  39. /**
  40. * @since 20.0.0
  41. */
  42. public function getScope(): ?string {
  43. return $this->scope;
  44. }
  45. }