summaryrefslogtreecommitdiffstats
path: root/application/modules/user/controllers/RoleController.php
diff options
context:
space:
mode:
authorBjörn Geiger2011-04-12 16:37:05 +0200
committerBjörn Geiger2011-04-12 16:37:05 +0200
commit4cbe29cb27b1963cabdeaa83b780b6705cd0ece9 (patch)
tree43ecb8fbcb1b1685d734a2dd578bc9fc07cc847a /application/modules/user/controllers/RoleController.php
parentquickfix für fbgui (diff)
downloadpbs2-4cbe29cb27b1963cabdeaa83b780b6705cd0ece9.tar.gz
pbs2-4cbe29cb27b1963cabdeaa83b780b6705cd0ece9.tar.xz
pbs2-4cbe29cb27b1963cabdeaa83b780b6705cd0ece9.zip
Rechte können nun wieder bei Rollen hinzugefügt und gelöscht werden, alle Rechte gleichzeitig von einer Rolle löschen
Diffstat (limited to 'application/modules/user/controllers/RoleController.php')
-rw-r--r--application/modules/user/controllers/RoleController.php55
1 files changed, 38 insertions, 17 deletions
diff --git a/application/modules/user/controllers/RoleController.php b/application/modules/user/controllers/RoleController.php
index 91357f0..1b2e54f 100644
--- a/application/modules/user/controllers/RoleController.php
+++ b/application/modules/user/controllers/RoleController.php
@@ -322,7 +322,11 @@ class User_RoleController extends Zend_Controller_Action
}
}
} else {
- $rightlist = $rights;
+ $rightCategoryMapper = new Application_Model_RightCategoryMapper();
+ foreach($rights as $right) {
+ $rightCategory = $rightCategoryMapper->find($right->getRightcategoryID());
+ $rightlist[$rightCategory->getTitle()][$right->getID()] = $right->getTitle();
+ }
}
if(count($rightlist) > 0) {
if (!isset($_POST["link"])){
@@ -377,15 +381,10 @@ class User_RoleController extends Zend_Controller_Action
if(isset($rightRolesID)) {
$rightRolesID = explode('-',$rightRolesID);
$roleID = $rightRolesID[0];
- $rightID = $rightRolesID[1];
- if (isset($roleID) && isset($rightID)){
- $roleMapper = new Application_Model_RoleMapper();
- $role = $roleMapper->find($roleID);
- $roleGroupID = $role->getGroupID();
- if($this->userIDsNamespace['groupID'] == $roleGroupID) {
- $rightroles = new Application_Model_RightRoles();
- $rightroles->setRoleID($roleID);
- $rightroles->setRightID($rightID);
+ if($rightRolesID[1] == 'all') {
+ $rightRolesMapper = new Application_Model_RightRolesMapper();
+ $rightroleslist = $rightRolesMapper->findBy(array('roleID' => $roleID));
+ foreach($rightroleslist as $rightroles) {
try {
$this->rightRolesMapper->delete($rightroles);
} catch(Zend_Exception $e)
@@ -393,15 +392,37 @@ class User_RoleController extends Zend_Controller_Action
echo "Caught exception: " . get_class($e) . "<br/>";
echo "Message: " . $e->getMessage() . "<br/>";
return;
+ }
+ }
+ $this->_redirect('/user/role/show/roleID/' . $roleID);
+ return;
+ } else {
+ $rightID = $rightRolesID[1];
+ if (isset($roleID) && isset($rightID)){
+ $roleMapper = new Application_Model_RoleMapper();
+ $role = $roleMapper->find($roleID);
+ $roleGroupID = $role->getGroupID();
+ if($this->userIDsNamespace['groupID'] == $roleGroupID) {
+ $rightroles = new Application_Model_RightRoles();
+ $rightroles->setRoleID($roleID);
+ $rightroles->setRightID($rightID);
+ try {
+ $this->rightRolesMapper->delete($rightroles);
+ } catch(Zend_Exception $e)
+ {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_redirect('/user/role/show/roleID/' . $roleID);
+ return;
+ } else {
+ $pbsNotifier = new Pbs_Notifier();
+ echo $pbsNotifier->notify('unlink','forbidden');
+ $this->_helper-> viewRenderer-> setNoRender();
+ return;
}
- $this->_redirect('/user/role/show/roleID/' . $roleID);
- return;
- } else {
- $pbsNotifier = new Pbs_Notifier();
- echo $pbsNotifier->notify('unlink','forbidden');
- $this->_helper-> viewRenderer-> setNoRender();
- return;
}
}
} else {