From 0f8648dcb1a3cc27f7fcc6a060b4cc285dc53e68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jannis=20Mo=C3=9Fhammer?= Date: Thu, 20 Jun 2013 13:47:51 +0200 Subject: [PATCH] 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 --- application/controllers/ErrorController.php | 3 +-- application/views/scripts/error/error.phtml | 11 ++++++++-- .../Exception/SystemPermissionException.php | 22 +++++++++++++++++++ 3 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 library/Icinga/Exception/SystemPermissionException.php diff --git a/application/controllers/ErrorController.php b/application/controllers/ErrorController.php index efcc20e9b..c523bb77f 100755 --- a/application/controllers/ErrorController.php +++ b/application/controllers/ErrorController.php @@ -34,7 +34,6 @@ class ErrorController extends ActionController $this->view->message = 'Application error'; break; } - // conditionally display exceptions if ($this->getInvokeArg('displayExceptions') == true) { $this->view->exception = $errors->exception; @@ -44,4 +43,4 @@ class ErrorController extends ActionController } } -// @codingStandardsIgnoreEnd \ No newline at end of file +// @codingStandardsIgnoreEnd diff --git a/application/views/scripts/error/error.phtml b/application/views/scripts/error/error.phtml index 9ae6ecd1f..b5cfcddcb 100755 --- a/application/views/scripts/error/error.phtml +++ b/application/views/scripts/error/error.phtml @@ -9,8 +9,15 @@

Exception information:

-

- Message: exception->getMessage() ?> +

+ Message: exception->getMessage() ?> + exception->action)): ?> +
Action: exception->action; ?> + + exception->action)): ?> +
Target: exception->target; ?> + +

Stack trace:

diff --git a/library/Icinga/Exception/SystemPermissionException.php b/library/Icinga/Exception/SystemPermissionException.php new file mode 100644 index 000000000..02849ec34 --- /dev/null +++ b/library/Icinga/Exception/SystemPermissionException.php @@ -0,0 +1,22 @@ +action = $action; + $this->target = $target; + } +}