Return HTTP 403 in case a SecurityException was thrown
This commit is contained in:
parent
375345f837
commit
d42017018f
|
@ -1,12 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
|
||||||
|
|
||||||
// namespace Icinga\Application\Controllers;
|
|
||||||
|
|
||||||
use Icinga\Application\Logger;
|
|
||||||
use Icinga\Web\Controller\ActionController;
|
|
||||||
use Icinga\Application\Icinga;
|
use Icinga\Application\Icinga;
|
||||||
|
use Icinga\Application\Logger;
|
||||||
|
use Icinga\Security\SecurityException;
|
||||||
|
use Icinga\Web\Controller\ActionController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Application wide controller for displaying exceptions
|
* Application wide controller for displaying exceptions
|
||||||
|
@ -44,6 +41,13 @@ class ErrorController extends ActionController
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_OTHER:
|
||||||
|
if ($exception instanceof SecurityException) {
|
||||||
|
$this->getResponse()->setHttpResponseCode(403);
|
||||||
|
$this->view->message = $exception->getMessage();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// Move to default
|
||||||
default:
|
default:
|
||||||
$title = preg_replace('/\r?\n.*$/s', '', $exception->getMessage());
|
$title = preg_replace('/\r?\n.*$/s', '', $exception->getMessage());
|
||||||
$this->getResponse()->setHttpResponseCode(500);
|
$this->getResponse()->setHttpResponseCode(500);
|
||||||
|
|
Loading…
Reference in New Issue