re-style error pages (#1210)

This commit is contained in:
Kevin Papst
2019-10-31 14:20:53 +01:00
committed by GitHub
parent 8eec97deb5
commit cd88901868
7 changed files with 143 additions and 73 deletions

View File

@@ -14,10 +14,11 @@ use KevinPapst\AdminLTEBundle\Event\SidebarMenuEvent;
use KevinPapst\AdminLTEBundle\Model\MenuItemModel;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
/**
* Class MenuBuilder configures the main navigation.
* @internal
*/
class MenuBuilderSubscriber implements EventSubscriberInterface
{
@@ -26,19 +27,14 @@ class MenuBuilderSubscriber implements EventSubscriberInterface
*/
private $eventDispatcher;
/**
* @var AuthorizationCheckerInterface
* @var TokenStorageInterface
*/
private $security;
private $tokenStorage;
/**
* MenuBuilderSubscriber constructor.
* @param EventDispatcherInterface $dispatcher
* @param AuthorizationCheckerInterface $security
*/
public function __construct(EventDispatcherInterface $dispatcher, AuthorizationCheckerInterface $security)
public function __construct(EventDispatcherInterface $dispatcher, TokenStorageInterface $storage)
{
$this->eventDispatcher = $dispatcher;
$this->security = $security;
$this->tokenStorage = $storage;
}
/**
@@ -72,7 +68,7 @@ class MenuBuilderSubscriber implements EventSubscriberInterface
);
// error pages don't have a user and will fail when is_granted() is called
if (null !== $event->getRequest()->getUser()) {
if (null !== $this->tokenStorage->getToken()) {
$this->eventDispatcher->dispatch($menuEvent);
}