Commit 4cd5ecb78386439d2c9f9b909b6ed7908f21f39a

Authored by Michael Joseph
1 parent ca772ff8

only remove groups that are in your unit


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1570 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/administration/groupmanagement/removeGroupFromUnitUI.inc
... ... @@ -132,23 +132,26 @@ function getPageSuccess() {
132 132 // show listbox of groups belonging to groups_units_link table
133 133 function getGroupDisplay($oGroup) {
134 134 global $default;
135   - // added clauses to get those groups belonging to the groups_units_link table
136   - $from = "," . $default->owl_groups_units_table . " AS GU";
137   - $where = "(ST.id = GU.group_id)";
138   -
139 135  
140 136 if (!isset($oGroup)) {
141   - $oPatternListBox = & new PatternListBox($default->owl_groups_table, "name", "id", "fGroupID");
142   - $oPatternListBox->setWhereClause($where);
143   - $oPatternListBox->setFromClause($from);
144   - //$oPatternListBox->setIncludeDefaultValue(true);
145   - //$oPatternListBox->setPostBackOnChange(true);
  137 + $oPatternListBox = & new PatternListBox($default->owl_groups_table, "name", "id", "fGroupID");
  138 + if (Permission::userIsSystemAdministrator()) {
  139 + $default->log->info("getGroupDisplay sysadmin");
  140 + // if this is the system administrator, prepend group names with unit name
  141 + $oPatternListBox->setFromClause("LEFT OUTER JOIN groups_units_link GUL on ST.id=GUL.group_id " .
  142 + "LEFT OUTER JOIN units_lookup UL on GUL.unit_id=UL.id");
  143 + $oPatternListBox->setCompositeDisplayName("DISTINCT COALESCE(CONCAT(CONCAT(UL.name, '-'),ST.name),ST.name)");
  144 + } else if (Permission::userIsUnitAdministrator()) {
  145 + $default->log->info("getGroupDisplay unitadmin");
  146 + // else if this is a unit administrator, only display the groups in your unit
  147 + $oPatternListBox->setFromClause("INNER JOIN $default->owl_groups_units_table GUL on ST.id=GUL.group_id");
  148 + $oPatternListBox->setWhereClause("GUL.unit_id=" . User::getUnitID($_SESSION["userID"]));
  149 + }
146 150 return $oPatternListBox->render();
147 151 } else {
148 152 return "<input type=\"hidden\" name=\"fGroupID\" value=\"" . $oGroup->iId . "\">\n" .
149 153 $oGroup->getName();
150 154 }
151   -
152 155 }
153 156  
154 157 // show unit details on confirm deletion page
... ...