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.php28
1 files changed, 16 insertions, 12 deletions
diff --git a/application/modules/user/controllers/RoleController.php b/application/modules/user/controllers/RoleController.php
index 4e0aa52..88e2eeb 100644
--- a/application/modules/user/controllers/RoleController.php
+++ b/application/modules/user/controllers/RoleController.php
@@ -303,20 +303,24 @@ class User_RoleController extends Zend_Controller_Action
}
if(count($rightlist) > 0) {
if (!isset($_POST["link"])){
- $linkForm = new user_Form_LinkRight(array('rightlist' => $rightlist, 'roleID' => $roleID));
+ $linkForm = new user_Form_LinkRight(array('rightlist' => $rightlist));
} else {
- $linkForm = new user_Form_LinkRight(array('rightlist' => $rightlist, 'roleID' => $roleID), $_POST);
+ $linkForm = new user_Form_LinkRight(array('rightlist' => $rightlist, $_POST));
if ($linkForm->isValid($_POST)) {
- $rightroles = new Application_Model_RightRoles();
- $rightroles->setRightID($_POST['rightID']);
- $rightroles->setRoleID($roleID);
- try {
- $this->rightRolesMapper->save($rightroles);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
+ foreach($_POST['rights'] as $rightID => $bool) {
+ if($bool == 1) {
+ $rightroles = new Application_Model_RightRoles();
+ $rightroles->setRightID($rightID);
+ $rightroles->setRoleID($roleID);
+ try {
+ $this->rightRolesMapper->save($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;