Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

check format

  • Loading branch information...
commit 761ebb134b6d88864d2cb68dc5dca7e5554567e3 1 parent bb3a87f
@lsmith77 lsmith77 authored
Showing with 9 additions and 6 deletions.
  1. +9 −6 EventListener/AccessDeniedListener.php
View
15 EventListener/AccessDeniedListener.php
@@ -52,16 +52,19 @@ public function onKernelException(GetResponseForExceptionEvent $event)
return false;
}
+ // TODO do we need to do content type negotiation here?
+ if (empty($this->formats[$event->getRequest()->getRequestFormat()])) {
+ return false;
+ }
+
$handling = true;
$exception = $event->getException();
- if (!$exception instanceof AccessDeniedException) {
- return;
+ if ($exception instanceof AccessDeniedException) {
+ $exception = new AccessDeniedHttpException('You do not have the necessary permissions', $exception);
+ $event->setException($exception);
+ parent::onKernelException($event);
}
-
- $exception = new AccessDeniedHttpException('You dont have the necessary permissions', $exception);
- $event->setException($exception);
- return parent::onKernelException($event);
}
public static function getSubscribedEvents()
Please sign in to comment.
Something went wrong with that request. Please try again.