Commit dbc76c6e586868fc4cfe5496173439370b81381f
1 parent
19822795
#2978 only display system administrator groups if you are a system administrator
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2758 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
23 additions
and
7 deletions
presentation/lookAndFeel/knowledgeTree/administration/groupmanagement/listGroupsUI.inc
| ... | ... | @@ -42,13 +42,29 @@ function getUnitDisplay($iUnitID) { |
| 42 | 42 | |
| 43 | 43 | function getGroups($fUnitID) { |
| 44 | 44 | global $default; |
| 45 | - $sQuery = "SELECT groups_lookup.id as groupID, units_lookup.name as UnitNameB4, groups_lookup.name as name, 'Edit' , 'Delete', 'Edit Unit', " . | |
| 46 | - "CASE WHEN units_lookup.name Is Null THEN '<font color=darkgrey>No Unit Assigned</font>' ELSE units_lookup.name END AS UnitName " . | |
| 47 | - "FROM (groups_lookup LEFT join groups_units_link on groups_lookup.id = groups_units_link.group_id) " . | |
| 48 | - "LEft join units_lookup on units_lookup.id = groups_units_link.unit_id " . | |
| 49 | - ($fUnitID ? "WHERE groups_units_link.unit_id =$fUnitID " : "") . | |
| 50 | - "ORDER BY groups_lookup.name "; | |
| 51 | - | |
| 45 | + $sQuery = "SELECT GL.id AS groupID, UL.name AS UnitNameB4, GL.name AS name, 'Edit' , 'Delete', 'Edit Unit', " . | |
| 46 | + "CASE WHEN UL.name IS NULL THEN '<font color=darkgrey>No Unit Assigned</font>' ELSE UL.name END AS UnitName " . | |
| 47 | + "FROM ($default->groups_table GL LEFT JOIN $default->groups_units_table GUL ON GL.id = GUL.group_id) " . | |
| 48 | + "LEFT JOIN $default->units_table UL ON UL.id = GUL.unit_id "; | |
| 49 | + | |
| 50 | + // #2978 don't display system admin groups if you're not a sys admin | |
| 51 | + // filter by unit | |
| 52 | + if ($fUnitID) { | |
| 53 | + $sWhereClause = "WHERE GUL.unit_id =$fUnitID "; | |
| 54 | + } | |
| 55 | + // #2978 don't display sys admin groups if you're not a sysadmin | |
| 56 | + if (!Permission::userIsSystemAdministrator()) { | |
| 57 | + $sRestrictGroups = " GL.is_sys_admin = 0 "; | |
| 58 | + if (strlen($sWhereClause) > 0) { | |
| 59 | + $sWhereClause .= " AND $sRestrictGroups"; | |
| 60 | + } else { | |
| 61 | + $sWhereClause = "WHERE $sRestrictGroups"; | |
| 62 | + } | |
| 63 | + } | |
| 64 | + | |
| 65 | + $sQuery .= $sWhereClause . "ORDER BY GL.name"; | |
| 66 | + $default->log->info("groupQuery: $sQuery"); | |
| 67 | + | |
| 52 | 68 | $aColumns = array("name", "UnitName", "Edit", "Delete", "Edit Unit"); |
| 53 | 69 | $aColumnNames = array( "Name", "Unit Name", "Edit", "Delete", "Edit Unit"); |
| 54 | 70 | $aColumnTypes = array(1,1,3,3,3); | ... | ... |