2020-07-13 23:29:14 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
2020-08-24 15:54:25 +03:00
|
|
|
|
2020-07-13 23:29:14 +03:00
|
|
|
/**
|
|
|
|
* @copyright Copyright (c) 2020, Roeland Jago Douma <roeland@famdouma.nl>
|
|
|
|
*
|
|
|
|
* @author Morris Jobke <hey@morrisjobke.de>
|
2020-08-24 15:54:25 +03:00
|
|
|
* @author Roeland Jago Douma <roeland@famdouma.nl>
|
2020-07-13 23:29:14 +03:00
|
|
|
*
|
|
|
|
* @license GNU AGPL version 3 or any later version
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
2020-08-24 15:54:25 +03:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2020-07-13 23:29:14 +03:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace OCP\AppFramework\Http\Events;
|
|
|
|
|
2020-09-23 09:43:36 +03:00
|
|
|
use OCP\AppFramework\Http\TemplateResponse;
|
2020-07-13 23:29:14 +03:00
|
|
|
use OCP\EventDispatcher\Event;
|
|
|
|
|
|
|
|
/**
|
2020-07-15 21:15:51 +03:00
|
|
|
* Emitted before the rendering step of each TemplateResponse. The event holds a
|
|
|
|
* flag that specifies if an user is logged in.
|
2020-07-13 23:29:14 +03:00
|
|
|
*
|
|
|
|
* @since 20.0.0
|
|
|
|
*/
|
|
|
|
class BeforeTemplateRenderedEvent extends Event {
|
|
|
|
/** @var bool */
|
|
|
|
private $loggedIn;
|
2020-09-23 09:43:36 +03:00
|
|
|
/** @var TemplateResponse */
|
|
|
|
private $response;
|
2020-07-13 23:29:14 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 20.0.0
|
|
|
|
*/
|
2020-09-23 09:43:36 +03:00
|
|
|
public function __construct(bool $loggedIn, TemplateResponse $response) {
|
2020-07-13 23:29:14 +03:00
|
|
|
parent::__construct();
|
|
|
|
|
|
|
|
$this->loggedIn = $loggedIn;
|
2020-09-23 09:43:36 +03:00
|
|
|
$this->response = $response;
|
2020-07-13 23:29:14 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 20.0.0
|
|
|
|
*/
|
|
|
|
public function isLoggedIn(): bool {
|
|
|
|
return $this->loggedIn;
|
|
|
|
}
|
2020-09-23 09:43:36 +03:00
|
|
|
|
|
|
|
/**
|
2020-10-19 11:00:15 +03:00
|
|
|
* @since 20.0.1
|
2020-09-23 09:43:36 +03:00
|
|
|
*/
|
|
|
|
public function getResponse(): TemplateResponse {
|
|
|
|
return $this->response;
|
|
|
|
}
|
2020-07-13 23:29:14 +03:00
|
|
|
}
|