1<?php
2
3declare(strict_types=1);
4
5/**
6 * @copyright Copyright (c) 2020 Julius Härtl <jus@bitgrid.net>
7 *
8 * @author Julius Härtl <jus@bitgrid.net>
9 * @author Morris Jobke <hey@morrisjobke.de>
10 *
11 * @license GNU AGPL version 3 or any later version
12 *
13 * This program is free software: you can redistribute it and/or modify
14 * it under the terms of the GNU Affero General Public License as
15 * published by the Free Software Foundation, either version 3 of the
16 * License, or (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Affero General Public License for more details.
22 *
23 * You should have received a copy of the GNU Affero General Public License
24 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 *
26 */
27namespace OCA\Files_Sharing\Event;
28
29use OCP\EventDispatcher\Event;
30use OCP\Share\IShare;
31
32/**
33 * Emitted before the rendering step of the public share page happens. The event
34 * holds a flag that specifies if it is the authentication page of a public share.
35 *
36 * @since 20.0.0
37 */
38class BeforeTemplateRenderedEvent extends Event {
39	/**
40	 * @since 20.0.0
41	 */
42	public const SCOPE_PUBLIC_SHARE_AUTH = 'publicShareAuth';
43
44	/** @var IShare */
45	private $share;
46	/** @var string|null */
47	private $scope;
48
49	/**
50	 * @since 20.0.0
51	 */
52	public function __construct(IShare $share, ?string $scope = null) {
53		parent::__construct();
54
55		$this->share = $share;
56		$this->scope = $scope;
57	}
58
59	/**
60	 * @since 20.0.0
61	 */
62	public function getShare(): IShare {
63		return $this->share;
64	}
65
66	/**
67	 * @since 20.0.0
68	 */
69	public function getScope(): ?string {
70		return $this->scope;
71	}
72}
73