From c1c47b2010a2e3453139501dfa4accf48bb6a92c Mon Sep 17 00:00:00 2001 From: Björn Geiger Date: Mon, 8 Aug 2011 17:28:22 +0200 Subject: ACL hinzugefügt --- application/controllers/AuthController.php | 10 ++++++++-- application/controllers/ErrorController.php | 8 +++++++- application/controllers/EventController.php | 4 ++++ application/controllers/GearmanController.php | 6 +++++- application/controllers/IndexController.php | 6 ++++++ application/controllers/PersonController.php | 4 ++++ 6 files changed, 34 insertions(+), 4 deletions(-) (limited to 'application') diff --git a/application/controllers/AuthController.php b/application/controllers/AuthController.php index cd3c34d..0ba5027 100644 --- a/application/controllers/AuthController.php +++ b/application/controllers/AuthController.php @@ -12,14 +12,20 @@ class AuthController extends Zend_Controller_Action { - protected $config; - protected $pbs2host; + protected $config = null; + protected $pbs2host = null; + protected $userIDsNamespace = null; + protected $acl = null; public function init() { $bootstrap = $this->getInvokeArg('bootstrap'); $this->config = $bootstrap->getOptions(); $this->pbs2host = $this->config['pbs2']['host']; + $this->userIDsNamespace = Zend_Session::namespaceGet('userIDs'); + if(isset($this->userIDsNamespace['apikey'])) { + $this->acl = new Poolctrl_Acl($this->pbs2host, $this->config['pbs2']['checkright'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); + } } public function indexAction() diff --git a/application/controllers/ErrorController.php b/application/controllers/ErrorController.php index 3866450..49ecdcf 100644 --- a/application/controllers/ErrorController.php +++ b/application/controllers/ErrorController.php @@ -4,13 +4,19 @@ class ErrorController extends Zend_Controller_Action { protected $config; protected $pbs2host; + protected $userIDsNamespace; + protected $acl; public function errorAction() { $bootstrap = $this->getInvokeArg('bootstrap'); $this->config = $bootstrap->getOptions(); $this->pbs2host = $this->config['pbs2']['host']; - + $this->userIDsNamespace = Zend_Session::namespaceGet('userIDs'); + if(isset($this->userIDsNamespace['apikey'])) { + $this->acl = new Poolctrl_Acl($this->pbs2host, $this->config['pbs2']['checkright'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); + } + $errors = $this->_getParam('error_handler'); if (!$errors || !$errors instanceof ArrayObject) { diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php index b30f671..1fd1d9c 100644 --- a/application/controllers/EventController.php +++ b/application/controllers/EventController.php @@ -17,6 +17,7 @@ class EventController extends Zend_Controller_Action protected $config; protected $pbs2host; protected $userIDsNamespace; + protected $acl; public function init() { @@ -25,6 +26,9 @@ class EventController extends Zend_Controller_Action $this->config = $bootstrap->getOptions(); $this->pbs2host = $this->config['pbs2']['host']; $this->userIDsNamespace = Zend_Session::namespaceGet('userIDs'); + if(isset($this->userIDsNamespace['apikey'])) { + $this->acl = new Poolctrl_Acl($this->pbs2host, $this->config['pbs2']['checkright'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); + } if($this->userIDsNamespace['membershipID'] !='') { $this->eventMapper = new Application_Model_EventMapper(); $this->eventcategoryMapper = new Application_Model_EventcategoryMapper(); diff --git a/application/controllers/GearmanController.php b/application/controllers/GearmanController.php index dcad3dc..608e88c 100644 --- a/application/controllers/GearmanController.php +++ b/application/controllers/GearmanController.php @@ -5,15 +5,19 @@ class GearmanController extends Zend_Controller_Action protected $gearmanClient; protected $config; protected $pbs2host; + protected $userIDsNamespace; + protected $acl; public function init() { - if (Zend_Auth::getInstance()->hasIdentity()) { $bootstrap = $this->getInvokeArg('bootstrap'); $this->config = $bootstrap->getOptions(); $this->pbs2host = $this->config['pbs2']['host']; $this->userIDsNamespace = Zend_Session::namespaceGet('userIDs'); + if(isset($this->userIDsNamespace['apikey'])) { + $this->acl = new Poolctrl_Acl($this->pbs2host, $this->config['pbs2']['checkright'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); + } $this->gearmanClient = new GearmanClient(); $this->gearmanClient->addServer('127.0.0.1'); } else { diff --git a/application/controllers/IndexController.php b/application/controllers/IndexController.php index 0099301..65757c1 100644 --- a/application/controllers/IndexController.php +++ b/application/controllers/IndexController.php @@ -4,12 +4,18 @@ class IndexController extends Zend_Controller_Action { protected $config; protected $pbs2host; + protected $userNamespace; + protected $acl; public function init() { $bootstrap = $this->getInvokeArg('bootstrap'); $this->config = $bootstrap->getOptions(); $this->pbs2host = $this->config['pbs2']['host']; + $this->userIDsNamespace = Zend_Session::namespaceGet('userIDs'); + if(isset($this->userIDsNamespace['apikey'])) { + $this->acl = new Poolctrl_Acl($this->pbs2host, $this->config['pbs2']['checkright'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); + } } public function indexAction() diff --git a/application/controllers/PersonController.php b/application/controllers/PersonController.php index 40ef456..b38f454 100644 --- a/application/controllers/PersonController.php +++ b/application/controllers/PersonController.php @@ -19,6 +19,7 @@ class PersonController extends Zend_Controller_Action protected $userIDsNamespace = null; protected $config; protected $pbs2host; + protected $acl; public function init() { @@ -27,6 +28,9 @@ class PersonController extends Zend_Controller_Action $this->config = $bootstrap->getOptions(); $this->pbs2host = $this->config['pbs2']['host']; $this->userIDsNamespace = Zend_Session::namespaceGet('userIDs'); + if(isset($this->userIDsNamespace['apikey'])) { + $this->acl = new Poolctrl_Acl($this->pbs2host, $this->config['pbs2']['checkright'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); + } foreach(Zend_Session::namespaceGet('persons') as $person) { if($person->getID() == $this->userIDsNamespace['personID']) { $this->person = $person; -- cgit v1.2.3-55-g7522