From 4cbe29cb27b1963cabdeaa83b780b6705cd0ece9 Mon Sep 17 00:00:00 2001 From: Björn Geiger Date: Tue, 12 Apr 2011 16:37:05 +0200 Subject: Rechte können nun wieder bei Rollen hinzugefügt und gelöscht werden, alle Rechte gleichzeitig von einer Rolle löschen --- .../modules/user/controllers/RoleController.php | 55 +++++++++++++++------- .../modules/user/views/scripts/role/show.phtml | 34 ++++++++----- 2 files changed, 59 insertions(+), 30 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) . "
"; echo "Message: " . $e->getMessage() . "
"; 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) . "
"; + echo "Message: " . $e->getMessage() . "
"; + 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 { diff --git a/application/modules/user/views/scripts/role/show.phtml b/application/modules/user/views/scripts/role/show.phtml index 8f4bb50..8c7503f 100644 --- a/application/modules/user/views/scripts/role/show.phtml +++ b/application/modules/user/views/scripts/role/show.phtml @@ -53,17 +53,22 @@ if($this->rightsAvailable === true) { echo $this->formButton('linkright', 'Add Rights', array( 'onclick' => 'self.location="/user/role/linkright/roleID/' . $this->role->getID() .'"', 'class' => 'addbutton'))?> -
rightsList)==0) -echo "There are no Rights to display."; -if(isset($this->rightcategorieslist)) { - foreach($this->rightcategorieslist as $k => $v): - $rights = $this->rightsList[$k]; - if(count($rights) > 0) { - ?> +if(count($this->rightsList)==0) { + echo "There are no Rights to display."; +} else { + if($this->removeRightOfRoleRight) echo $this->formButton('deleteallrights', 'Delete All Rights', array( + 'onclick' => 'self.location="/user/role/unlinkright/rightrolesID/' . $this->roleID . '-all"', + 'class' => 'rightbutton'));?> +
+ rightcategorieslist)) { + foreach($this->rightcategorieslist as $k => $v): + $rights = $this->rightsList[$k]; + if(count($rights) > 0) { + ?>

:

getDescription()) {
+endforeach +?> +
- -- cgit v1.2.3-55-g7522 From 64f18001b05a06d165b6ef79789983fd7a12cec2 Mon Sep 17 00:00:00 2001 From: michael pereira Date: Tue, 12 Apr 2011 16:39:11 +0200 Subject: Resource controller fix --- application/controllers/ResourceController.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/application/controllers/ResourceController.php b/application/controllers/ResourceController.php index 542fcda..c172bf5 100644 --- a/application/controllers/ResourceController.php +++ b/application/controllers/ResourceController.php @@ -82,7 +82,7 @@ class ResourceController extends Zend_Controller_Action $bmm = new Application_Model_BootMenuEntriesMapper(); $bmm->find($bootmenuentryID,$bootmenuentry); - $configID = $bootmenuentry->getConfigID(); + $configID = $bootmenuentry->ge(); if(is_dir("../resources/config/$configID/") && is_numeric($configID)){ @@ -137,9 +137,9 @@ class ResourceController extends Zend_Controller_Action header('Pragma: no-cache'); header('Expires: 0'); - if($bme->getKcl()){ - $kcl = $bootosmapper->find($bme->getBootosID())->getDefaultkcl(); - + $kcl = $bootosmapper->find($bme->getBootosID())->getDefaultkcl(); + + if($bme->getKcl() && $kcl != null){ $result = $kcl . " alpha=" . $this->_request->getParam('alpha') . " file=http://".$_SERVER['HTTP_HOST']."/resource/getconfig/alpha/".$this->_request->getParam('alpha')."/file/default.tgz ".$bme->getKclappend(); }else{ $result = "alpha=" . $this->_request->getParam('alpha') . " file=http://".$_SERVER['HTTP_HOST']."/resource/getconfig/alpha/".$this->_request->getParam('alpha')."/file/default.tgz ".$bme->getKclappend(); -- cgit v1.2.3-55-g7522