X-Git-Url: https://git.rapsys.eu/airbundle/blobdiff_plain/0272f077a8d34292c7da31d86f10473a8f51aad6..c1fd8ae3e058c68975edd4d98107d72c9bb2dc53:/Security/AccessDeniedHandler.php diff --git a/Security/AccessDeniedHandler.php b/Security/AccessDeniedHandler.php deleted file mode 100644 index d637ee5..0000000 --- a/Security/AccessDeniedHandler.php +++ /dev/null @@ -1,80 +0,0 @@ -config = $container->getParameter($alias); - - //Set the translator - $this->translator = $translator; - - //Set the environment - $this->environment = $environment; - - //Set the context - $this->context = [ - 'copy_long' => $translator->trans($this->config['copy']['long']), - 'copy_short' => $translator->trans($this->config['copy']['short']), - 'site_ico' => $this->config['site']['ico'], - 'site_logo' => $this->config['site']['logo'], - 'site_png' => $this->config['site']['png'], - 'site_svg' => $this->config['site']['svg'], - 'site_title' => $translator->trans($this->config['site']['title']), - 'site_url' => $router->generate($this->config['site']['url']) - ]; - } - - /** - * {@inheritdoc} - */ - public function handle(Request $request, AccessDeniedException $exception) { - //Set section - $section = $this->translator->trans('Access denied'); - - //Set title - $title = $section.' - '.$this->translator->trans($this->config['site']['title']); - - //Set message - //XXX: we assume that it's already translated - $message = $exception->getMessage(); - - //Render template - return new Response( - $this->environment->render( - '@RapsysAir/security/denied.html.twig', - [ - 'title' => $title, - 'section' => $section, - 'message' => $message - ]+$this->context - ), - 403 - ); - } -}