Add SystemPermissionException

This exception should be fired when the OS restricts the web user
from executing certain actions. Also the template for errors has
been modified so it displays the action and the target that
was prevented.

refs #4092
This commit is contained in:
Jannis Moßhammer 2013-06-20 13:47:51 +02:00
parent c58e32c365
commit c155a8330c
3 changed files with 32 additions and 4 deletions

View File

@ -34,7 +34,6 @@ class ErrorController extends ActionController
$this->view->message = 'Application error'; $this->view->message = 'Application error';
break; break;
} }
// conditionally display exceptions // conditionally display exceptions
if ($this->getInvokeArg('displayExceptions') == true) { if ($this->getInvokeArg('displayExceptions') == true) {
$this->view->exception = $errors->exception; $this->view->exception = $errors->exception;

View File

@ -9,8 +9,15 @@
<div style="text-align:left;"> <div style="text-align:left;">
<h3>Exception information:</h3> <h3>Exception information:</h3>
<p > <p>
<b>Message:</b> <?php echo $this->exception->getMessage() ?> <b>Message:</b> <?php echo $this->exception->getMessage() ?>
<?php if (isset($this->exception->action)): ?>
<br/><b>Action</b>: <?= $this->exception->action; ?>
<?php endif ?>
<?php if (isset($this->exception->action)): ?>
<br/><b>Target</b>: <?= $this->exception->target; ?>
<?php endif ?>
</p> </p>
<h3>Stack trace:</h3> <h3>Stack trace:</h3>

View File

@ -0,0 +1,22 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Exception;
/**
* Class ProgrammingError
* @package Icinga\Exception
*/
class SystemPermissionException extends \Exception
{
public $action;
public $target;
public function __construct($message, $action, $target = "")
{
parent::__construct($message);
$this->action = $action;
$this->target = $target;
}
}