From b9cee34ee1d05cbdd1e089bba4112ac9f19af664 Mon Sep 17 00:00:00 2001 From: edward Date: Wed, 30 Mar 2016 18:20:59 +0800 Subject: [PATCH] RooTrait.php --- RooTrait.php | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/RooTrait.php b/RooTrait.php index 752a9c4d..5690ecef 100644 --- a/RooTrait.php +++ b/RooTrait.php @@ -30,19 +30,42 @@ trait Pman_Core_RooTrait { } + function checkDebug($req = false) + { + $req = $req === false ? $_REQUEST : $req; + if (isset($req['_debug']) + && + $this->authUser + && + ( + ( + method_exists($this->authUser,'canDebug') + && + $this->authUser->canDebug() + ) + || + ( + + method_exists($this->authUser,'groups') + && + is_a($this->authUser, 'Pman_Core_DataObjects_Person') + && + in_array('Administrators', $this->authUser->groups('name')) + ) + ) + + ){ + DB_DAtaObject::debuglevel((int)$req['_debug']); + } + + } + function checkDebugPost() { return (!empty($_GET['_post']) || !empty($_GET['_debug_post'])) && $this->authUser && method_exists($this->authUser,'groups') && in_array('Administrators', $this->authUser->groups('name')); - } - - function checkDebug($req = false) - { - /* - * Not allow to doing this - */ - return false; + } } -- 2.39.2