]> Raphaël G. Git Repositories - airbundle/blobdiff - Handler/AccessDeniedHandler.php
Merge body in base template
[airbundle] / Handler / AccessDeniedHandler.php
index b742db003f74bc75014d724ab0192c8e51fedbde..961b5260e7d1e856868b03bf9abc285a10a24edd 100644 (file)
@@ -1,8 +1,18 @@
-<?php
+<?php declare(strict_types=1);
+
+/*
+ * This file is part of the Rapsys AirBundle package.
+ *
+ * (c) Raphaël Gertz <symfony@rapsys.eu>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
 
 namespace Rapsys\AirBundle\Handler;
 
 use Symfony\Component\HttpFoundation\Request;
 
 namespace Rapsys\AirBundle\Handler;
 
 use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\Response;
 use Symfony\Component\Security\Core\Exception\AccessDeniedException;
 use Symfony\Component\Security\Http\Authorization\AccessDeniedHandlerInterface;
 
 use Symfony\Component\Security\Core\Exception\AccessDeniedException;
 use Symfony\Component\Security\Http\Authorization\AccessDeniedHandlerInterface;
 
@@ -16,7 +26,7 @@ class AccessDeniedHandler extends AbstractController implements AccessDeniedHand
        /**
         * {@inheritdoc}
         */
        /**
         * {@inheritdoc}
         */
-       public function handle(Request $request, AccessDeniedException $exception) {
+       public function handle(Request $request, AccessDeniedException $exception): Response {
                //Set title
                $this->context['title'] = $this->translator->trans('Access denied');
 
                //Set title
                $this->context['title'] = $this->translator->trans('Access denied');
 
@@ -25,7 +35,7 @@ class AccessDeniedHandler extends AbstractController implements AccessDeniedHand
                $this->context['message'] = $exception->getMessage();
 
                //With admin
                $this->context['message'] = $exception->getMessage();
 
                //With admin
-               if ($this->isGranted('ROLE_ADMIN')) {
+               if ($this->checker->isGranted('ROLE_ADMIN')) {
                        //Add trace for admin
                        $this->context['trace'] = $exception->getTraceAsString();
                }
                        //Add trace for admin
                        $this->context['trace'] = $exception->getTraceAsString();
                }