diff options
author | michael pereira | 2011-03-29 11:01:35 +0200 |
---|---|---|
committer | michael pereira | 2011-03-29 11:01:35 +0200 |
commit | ecb5c8d8c31ad70bb24e0ea1cfb6110bcd0a96bb (patch) | |
tree | 4b40a4178c2dc3bd3fe21730a29dd07bb8742790 /application/modules/user/controllers/RoleController.php | |
parent | Preboot User Controller fertig, ACL fehlt noch (diff) | |
parent | selectmembership von auth zu person verschoben fbgui module (diff) | |
download | pbs2-ecb5c8d8c31ad70bb24e0ea1cfb6110bcd0a96bb.tar.gz pbs2-ecb5c8d8c31ad70bb24e0ea1cfb6110bcd0a96bb.tar.xz pbs2-ecb5c8d8c31ad70bb24e0ea1cfb6110bcd0a96bb.zip |
zfconf
Diffstat (limited to 'application/modules/user/controllers/RoleController.php')
-rw-r--r-- | application/modules/user/controllers/RoleController.php | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/application/modules/user/controllers/RoleController.php b/application/modules/user/controllers/RoleController.php index da65507..0b0cb7d 100644 --- a/application/modules/user/controllers/RoleController.php +++ b/application/modules/user/controllers/RoleController.php @@ -2,15 +2,15 @@ class User_RoleController extends Zend_Controller_Action { - private $userIDsNamespace; + protected $userIDsNamespace; public function init() { if (Zend_Auth::getInstance()->hasIdentity()) { $this->userIDsNamespace = Zend_Session::namespaceGet('userIDs'); - if($this->userIDsNamespace['groupID'] ==''){ + if($this->userIDsNamespace['roleID'] ==''){ $pbsNotifier = new Pbs_Notifier(); - echo $pbsNotifier->notify('No groupID set','forbidden'); + echo $pbsNotifier->notify('No roleID set','forbidden'); } $this->roleMapper = new Application_Model_RoleMapper(); $this->rightMapper = new Application_Model_RightMapper(); @@ -67,6 +67,11 @@ class User_RoleController extends Zend_Controller_Action { $roleID = $this->_request->getParam('roleID'); if(!isset($roleID)) { + if(count($this->userIDsNamespace) > 0) { + $roleID = $this->userIDsNamespace['roleID']; + } + } + if(!isset($roleID)) { $addForm = new user_Form_RoleAdd(); $this->view->addForm = $addForm; return; @@ -76,10 +81,12 @@ class User_RoleController extends Zend_Controller_Action $_POST['title'] = $role->getTitle(); $_POST['description'] = $role->getDescription(); $_POST['groupID'] = $role->getGroupID(); + $_POST['inheritance'] = $role->getInheritance(); $editForm = new user_Form_RoleEdit(array('roleID' => $roleID)); } else { $editForm = new user_Form_RoleEdit(array('roleID' => $roleID), $_POST); if ($editForm->isValid($_POST)) { + $role = new Application_Model_Role($_POST); $role->setID($this->_request->getParam('roleID')); try { @@ -90,7 +97,7 @@ class User_RoleController extends Zend_Controller_Action echo "Message: " . $e->getMessage() . "<br/>"; return; } - $this->_helper->redirector('', 'role'); + $this->_redirect($_SERVER['HTTP_REFERER']); return; } } @@ -100,6 +107,11 @@ class User_RoleController extends Zend_Controller_Action public function showAction() { $roleID = $this->_request->getParam('roleID'); + if(!isset($roleID)) { + if(count($this->userIDsNamespace) > 0) { + $roleID = $this->userIDsNamespace['roleID']; + } + } if($roleID) { $rightroles = $this->rightRolesMapper->findBy('roleID', $roleID); if(count($rightroles) > 0) { @@ -113,6 +125,7 @@ class User_RoleController extends Zend_Controller_Action } $this->view->role = $this->roleMapper->find($roleID); $this->view->roleID = $roleID; + $this->view->userIDsNamespace = $this->userIDsNamespace; } else { $this->_helper->redirector('', 'role'); return; @@ -123,6 +136,11 @@ class User_RoleController extends Zend_Controller_Action { $this->_helper->viewRenderer->setNoRender(); $roleID = $this->_request->getParam('roleID'); + if(!isset($roleID)) { + if(count($this->userIDsNamespace) > 0) { + $roleID = $this->userIDsNamespace['roleID']; + } + } if (isset($roleID)){ $role = $this->roleMapper->find($roleID); try { @@ -144,6 +162,11 @@ class User_RoleController extends Zend_Controller_Action public function linkrightAction() { $roleID = $this->_request->getParam('roleID'); + if(!isset($roleID)) { + if(count($this->userIDsNamespace) > 0) { + $roleID = $this->userIDsNamespace['roleID']; + } + } if(isset($roleID)) { $rightroles = $this->rightRolesMapper->findBy('roleID', $roleID); $rights = $this->rightMapper->fetchAll(); |