summaryrefslogtreecommitdiffstats
path: root/application/controllers/PersonController.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/controllers/PersonController.php')
-rwxr-xr-xapplication/controllers/PersonController.php24
1 files changed, 4 insertions, 20 deletions
diff --git a/application/controllers/PersonController.php b/application/controllers/PersonController.php
index 09638cc..72ef196 100755
--- a/application/controllers/PersonController.php
+++ b/application/controllers/PersonController.php
@@ -16,6 +16,7 @@ class PersonController extends Zend_Controller_Action
protected $currentMembership = null;
protected $memberships = null;
protected $groups = null;
+ protected $pbs2Api;
protected $userIDsNamespace = null;
protected $config;
protected $pbs2host;
@@ -27,6 +28,7 @@ class PersonController extends Zend_Controller_Action
$bootstrap = $this->getInvokeArg('bootstrap');
$this->config = $bootstrap->getOptions();
$this->pbs2host = $this->config['pbs2']['host'];
+ $this->pbs2Api = new Poolctrl_Pbs2Api($this->config);
$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']);
@@ -81,17 +83,7 @@ class PersonController extends Zend_Controller_Action
if($useGroupnamespace) {
$group = $groups[$groupID];
} else {
- $grouprequest = "groupid=" . $groupID;
- $groupApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['getgroup'] . $membership->getApikey(), 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $grouprequest);
- $groupXMLString = $groupApiResult['http-body'];
- if(strlen($groupXMLString) > 0) {
- $groupXML = new SimpleXMLElement($groupXMLString);
- $group = new Application_Model_Group();
- $group->setID(sprintf("%s", $groupXML->group->id));
- $group->setTitle(sprintf("%s", $groupXML->group->title));
- $group->setDescription(sprintf("%s", $groupXML->group->description));
- $groupSession->$groupID = $group;
- }
+ $this->pbs2Api->getGroup($groupSession, $groupID);
}
$roleID = $membership->getRoleID();
if($useRolenamespace) {
@@ -100,15 +92,7 @@ class PersonController extends Zend_Controller_Action
$roleApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['getrole'] . $membership->getApikey(), 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', '');
$roleXMLString = $roleApiResult['http-body'];
if(strlen($roleXMLString) > 0) {
- $roleXML = new SimpleXMLElement($roleXMLString);
- $role = new Application_Model_Role();
- $role->setID(sprintf("%s", $roleXML->role->id));
- $role->setGroupID(sprintf("%s", $roleXML->role->groupid));
- $role->setTitle(sprintf("%s", $roleXML->role->title));
- $role->setDescription(sprintf("%s", $roleXML->role->description));
- $role->setInheritance(sprintf("%s", $roleXML->role->inheritance));
-
- $roleSession->$roleID = $role;
+ $this->pbs2Api->getRole($roleSession, $roleID);
}
}
$apikeys[$group->getID()] = $membership->getApikey();