openrat-cms

OpenRat Content Management System
git clone http://git.code.weiherhei.de/openrat-cms.git
Log | Files | Refs | README

commit 78369febd50618f9e83d4c9389b53c3990835b19
parent 1c25ad2ec929c2b9142c714a830e465d29d36f57
Author: Jan Dankert <develop@jandankert.de>
Date:   Sat, 31 Oct 2020 01:19:06 +0100

Better logging in the dispatcher.

Diffstat:
Mmodules/cms/Dispatcher.class.php | 7+++++--
Mmodules/cms/action/RequestParams.class.php | 5+++++
2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/modules/cms/Dispatcher.class.php b/modules/cms/Dispatcher.class.php @@ -150,11 +150,14 @@ class Dispatcher break; case Action::SECURITY_USER: if (!is_object($do->currentUser)) - throw new SecurityException('No user logged in, but this action requires a valid user'); + throw new SecurityException( TextMessage::create('No user logged in, but this action ${0} requires a valid user',[$this->request->__toString()])); break; case Action::SECURITY_ADMIN: if (!is_object($do->currentUser) || !$do->currentUser->isAdmin) - throw new SecurityException('This action requires administration privileges, but user ' . @$do->currentUser->name . ' is not an admin'); + throw new SecurityException(TextMessage::create('This action ${0} requires administration privileges, but user ${1} is not an admin',[ + $this->request->__toString(), + @$do->currentUser->name + ])); break; default: } diff --git a/modules/cms/action/RequestParams.class.php b/modules/cms/action/RequestParams.class.php @@ -197,4 +197,9 @@ class RequestParams { return $this->getRequestVar(self::PARAM_TOKEN,self::FILTER_ALPHANUM); } + + + public function __toString() { + return 'Request '.$this->action.'/'.$this->method.'/'.$this->id; + } } \ No newline at end of file