2020-02-10 00:52:25 +01:00
|
|
|
<?php
|
|
|
|
|
2021-12-08 16:53:43 +01:00
|
|
|
namespace Documents;
|
2020-04-03 15:56:04 +02:00
|
|
|
|
2021-12-08 16:53:43 +01:00
|
|
|
use Elements\TemplateDocument;
|
|
|
|
use Objects\User;
|
2020-04-03 15:56:04 +02:00
|
|
|
|
2021-12-08 16:53:43 +01:00
|
|
|
class Admin extends TemplateDocument {
|
|
|
|
public function __construct(User $user) {
|
|
|
|
$template = $user->isLoggedIn() ? "admin.twig" : "redirect.twig";
|
|
|
|
$params = $user->isLoggedIn() ? [] : ["url" => "/login"];
|
|
|
|
parent::__construct($user, $template, $params);
|
|
|
|
$this->enableCSP();
|
2020-02-10 00:52:25 +01:00
|
|
|
}
|
2020-04-03 15:56:04 +02:00
|
|
|
}
|