summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--application/modules/user/controllers/GroupController.php24
-rw-r--r--application/modules/user/views/scripts/group/show.phtml16
2 files changed, 28 insertions, 12 deletions
diff --git a/application/modules/user/controllers/GroupController.php b/application/modules/user/controllers/GroupController.php
index 39053ae..7a136c8 100644
--- a/application/modules/user/controllers/GroupController.php
+++ b/application/modules/user/controllers/GroupController.php
@@ -219,9 +219,6 @@ class User_GroupController extends Zend_Controller_Action
$this->view->usergroup = $this->membership->getGroupID();
$this->view->requestgroup = $groupID;
- // ACL is he allowed to see the requests of a group ?
- // TODO: THERE IS NO RIGHT TO EDIT A GROUP
- # if(Pbs_Acl::checkRight('')){
$groupRequests = $this->groupRequestMapper->findBy(array('groupID' => $groupID),true);
if(isset($groupRequests)) {
foreach($groupRequests as $groupRequest) {
@@ -234,10 +231,25 @@ class User_GroupController extends Zend_Controller_Action
if(is_array($groupRequestList)) {
$this->view->groupRequestList = $groupRequestList;
}
- // TODO: expand with al inherit roles
- $this->view->roleList = $this->rolemapper->findBy(array('groupID' => $groupID),true);
+ // Search all inherit Roles
+ $roles = array();
+ $groupGroupsMapper = new Application_Model_GroupGroupsMapper();
+ $parents = $groupGroupsMapper->getParentGroups($groupID);
+ $groupMapper = new Application_Model_GroupMapper();
+ foreach($parents as $p){
+ foreach($p as $a){
+ $group = $groupMapper->find($a);
+ if($groupID != $a)
+ $r = $this->rolemapper->findBy(array('groupID' => $a,'inheritance'=>"1"));
+ else
+ $r = $this->rolemapper->findBy(array('groupID' => $a));
+ foreach($r as $d){
+ $roles[$group->getTitle()][] = $d;
+ }
+ }
+ }
+ $this->view->roleList = $roles;
}
- # }
if(Pbs_Acl::checkRight('gsmg') || Pbs_Acl::checkRight('gsmgo')){
$members = $this->membershipMapper->findBy(array('groupID' => $groupID),true);
diff --git a/application/modules/user/views/scripts/group/show.phtml b/application/modules/user/views/scripts/group/show.phtml
index c8363cd..386c782 100644
--- a/application/modules/user/views/scripts/group/show.phtml
+++ b/application/modules/user/views/scripts/group/show.phtml
@@ -66,7 +66,7 @@ foreach($this->groupRequestList as $grouprequest) {
?>
<div class='actions'><?php if(Pbs_Acl::checkRight('gam')): ?>
<form action="/user/group/grantperson" method="post">
- <input type="hidden" name="grouprequestID" value="<?php echo $grouprequestID; ?>" /> <?php printRoleSelect($this->roleList); ?>
+ <input type="hidden" name="grouprequestID" value="<?php echo $grouprequestID; ?>" />Role:<?php printRoleSelect($this->roleList); ?>
<input type="image" src='/media/img/save.png' alt='Grant Person' name="confirm" value="confirm" /> <?php endif; ?> <?php if(Pbs_Acl::checkRight('gdm')): ?>
<a href="<?php echo $this->url(
array(
@@ -193,12 +193,16 @@ if((Pbs_Acl::checkRight('gdmo') && $this->usergroup == $this->requestgroup) || (
}
function printRoleSelect($roleList) {
- if(!is_array($roleList)) {
- return;
- }
+ $s = '';
+ #print_a($roleList);
echo "<select name=\"roleID\">";
- foreach($roleList as $role) {
- echo "<option value=\"" . $role['roleID'] . "\">" . $role['title'] . "</option>";
+ foreach($roleList as $grouptitle=>$head) {
+ #print_a($grouptitle,$head);
+ echo "<optgroup label='".$grouptitle."'>";
+ foreach($head as $role){
+ echo "<option value=\"" . $role->getID() . "\">" . $role->getTitle() . "</option>";
+ }
+ echo "</optgroup>";
}
echo "</select>";
}