From c77d0d5296810af40f2eeebc45b95ae7c419bb5c Mon Sep 17 00:00:00 2001 From: Mark Holtzhausen Date: Fri, 27 Nov 2009 10:38:02 +0200 Subject: [PATCH] Implemented Licencing check in updated comms. --- var/cache/.empty | 0 webservice/clienttools/ajaxhandler.php | 34 ++++++++++++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) delete mode 100644 var/cache/.empty diff --git a/var/cache/.empty b/var/cache/.empty deleted file mode 100644 index e69de29..0000000 --- a/var/cache/.empty +++ /dev/null diff --git a/webservice/clienttools/ajaxhandler.php b/webservice/clienttools/ajaxhandler.php index 3c3fb78..c848cc9 100644 --- a/webservice/clienttools/ajaxhandler.php +++ b/webservice/clienttools/ajaxhandler.php @@ -94,8 +94,8 @@ class ajaxHandler{ //TODO: Get rid of this service - $this->loadService('auth'); - $this->authenticator=new auth($this,$this->ret,$this->kt,$this->request,$this->auth); +// $this->loadService('auth'); +// $this->authenticator=new auth($this,$this->ret,$this->kt,$this->request,$this->auth); @@ -273,6 +273,9 @@ class ajaxHandler{ $kt=$this->kt; + /* + * User Check + */ $o_user=$kt->get_user_object_by_username($user); if(PEAR::isError($o_user)){ @@ -281,6 +284,33 @@ class ajaxHandler{ return false; } + /* + * BAOBAB Licence Check + */ + if ($user != 'admin') { + try{ + if(class_exists('BaobabKeyUtil')){ + if (!BaobabKeyUtil::checkIfLicensed(true)) { + $this->ret->setResponse(array('authenticated'=> false, 'message'=> 'license_expired')); + $this->ret->addError('Licence Expired'); + return false; + } + }else{ + $this->ret->addError('Licence Utility could not be loaded. Appears to be a Community version.'); + $this->ret->setResponse(array('authenticated'=> false, 'message'=> 'Licence Utility could not be loaded. Appears to be a Community version.')); + return false; + } + }catch(Exception $e){ + $this->ret->addError('could not execute BaobabKeyUtil::checkIfLicensed'); + $this->ret->setResponse(array('authenticated'=> false, 'message'=> 'BaobabKeyUtil::checkIfLicensed error')); + return; + } + } + + + /* + * Password Check + */ try{ $l_pass=$o_user->getPassword(); $l_passHash=md5($l_pass.$this->auth['token']); -- libgit2 0.21.4