Permet d'ajouter de nouveaux articles
This commit is contained in:
1 parent
8118cfe188
commit
d0343eb5a9
12 files changed
+146
-9
No files matched your search
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Silex\Controller;
|
||||
|
||||
use Silex\DI\DI;
|
||||
use Silex\Http\HttpResponse;
|
||||
use Silex\Router\Route;
|
||||
|
||||
class FrontController
|
||||
{
|
||||
private Route $route;
|
||||
|
||||
public function __construct(Route $route)
|
||||
{
|
||||
$this->route = $route;
|
||||
}
|
||||
|
||||
public function run(DI $di): HttpResponse
|
||||
{
|
||||
if ($this->route->getController() instanceof AdminController
|
||||
&& ($di->getSecurity()->getCurrentUser() === null || !$di->getSecurity()->getCurrentUser()->isAdmin())) {
|
||||
HttpResponse::redirect($di->getRouter()->url('login'));
|
||||
}
|
||||
return $this->route->call($di);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user