summaryrefslogtreecommitdiffstats
path: root/application/modules/user/controllers/RoleController.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/modules/user/controllers/RoleController.php')
-rw-r--r--application/modules/user/controllers/RoleController.php36
1 files changed, 20 insertions, 16 deletions
diff --git a/application/modules/user/controllers/RoleController.php b/application/modules/user/controllers/RoleController.php
index 3db425f..d8ed9e6 100644
--- a/application/modules/user/controllers/RoleController.php
+++ b/application/modules/user/controllers/RoleController.php
@@ -131,12 +131,26 @@ class User_RoleController extends Zend_Controller_Action
if(count($rightroles) > 0) {
foreach($rightroles as $rightrole) {
$right = $this->rightMapper->find($rightrole['rightID']);
- $rightsList[] = $right;
+ $rightsList[$right->getRightcategoryID()][] = $right;
}
if(is_array($rightsList)) {
$this->view->rightsList = $rightsList;
}
}
+ $rightCategoryMapper = new Application_Model_RightCategoryMapper();
+ $rightCategories = $rightCategoryMapper->fetchAll();
+ if(count($rightCategories) > 0) {
+ foreach($rightCategories as $rightCategory) {
+ $rightcategorieslist[$rightCategory->getID()] = $rightCategory->getTitle();
+ }
+ $this->view->rightcategorieslist = $rightcategorieslist;
+ }
+ $rights = $this->rightMapper->fetchAll();
+ if(count($rights) == count($rightroles)) {
+ $this->view->rightsAvailable = false;
+ } else {
+ $this->view->rightsAvailable = true;
+ }
$this->view->role = $this->roleMapper->find($roleID);
$this->view->roleID = $roleID;
$this->view->userIDsNamespace = $this->userIDsNamespace;
@@ -206,6 +220,7 @@ class User_RoleController extends Zend_Controller_Action
$rights = $this->rightMapper->fetchAll();
if(count($rightroles) > 0) {
if(count($rights) > 0) {
+ $rightCategoryMapper = new Application_Model_RightCategoryMapper();
foreach($rights as $right) {
foreach($rightroles as $rightrole) {
if($right->getID() == $rightrole['rightID']) {
@@ -214,8 +229,8 @@ class User_RoleController extends Zend_Controller_Action
}
}
if(!$found) {
- $rightCategory = $right->getRightcategoryID();
- $rightlist[$rightCategory][] = $right;
+ $rightCategory = $rightCategoryMapper->find($right->getRightcategoryID());
+ $rightlist[$rightCategory->getTitle()][$right->getID()] = $right->getTitle();
}
$found = false;
}
@@ -224,22 +239,11 @@ class User_RoleController extends Zend_Controller_Action
$rightlist = $rights;
}
if(count($rightlist) > 0) {
- $rightCategoryMapper = new Application_Model_RightCategoryMapper();
- $rightCategories = $rightCategoryMapper->fetchAll();
- if(count($rightCategories) > 0) {
- foreach($rightCategories as $rightCategory) {
- $rightcategorieslist[$rightCategory->getID()] = $rightCategory->getTitle();
- }
- }
if (!isset($_POST["link"])){
- $linkForm = new user_Form_LinkRight(array('rightlist' => $rightlist, 'rightcategorieslist' => $rightcategorieslist, 'roleID' => $roleID));
+ $linkForm = new user_Form_LinkRight(array('rightlist' => $rightlist, 'roleID' => $roleID));
} else {
- $linkForm = new user_Form_LinkRight(array('rightlist' => $rightlist, 'rightcategorieslist' => $rightcategorieslist, 'roleID' => $roleID), $_POST);
+ $linkForm = new user_Form_LinkRight(array('rightlist' => $rightlist, 'roleID' => $roleID), $_POST);
if ($linkForm->isValid($_POST)) {
- if(strpos($_POST['rightID'], 'category') !== false) {
- $this->_redirect($_SERVER['HTTP_REFERER']);
- return;
- }
$rightroles = new Application_Model_RightRoles();
$rightroles->setRightID($_POST['rightID']);
$rightroles->setRoleID($roleID);