Commit c978fe8bbe68ffd8686df5076ab8a0d8393b0e93

Authored by Michael Joseph
1 parent 5be4c4e1

#2978 only display system administrator user accounts if you are a system administrator


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2757 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/administration/usermanagement/listUsersUI.inc
... ... @@ -48,11 +48,25 @@ function getGroupDisplay($iGroupID) {
48 48  
49 49 function getUsers($fGroupID) {
50 50 global $default;
51   - $sQuery = "SELECT users.id as userID, users.name as name, username, " .
52   - "'Edit' , 'Delete', 'Edit Groups' " .
53   - "FROM users " .
54   - ($fGroupID ? "INNER JOIN users_groups_link ON users.id = users_groups_link.user_id WHERE users_groups_link.group_id = $fGroupID " : "") .
55   - "ORDER BY users.name";
  51 + $sQuery = "SELECT U.id as userID, U.name as name, U.username, " .
  52 + "'Edit', 'Delete', 'Edit Groups' " .
  53 + "FROM $default->users_table U " .
  54 + "INNER JOIN $default->users_groups_table UGL ON U.id = UGL.user_id " .
  55 + "INNER JOIN $default->groups_table GL ON UGL.group_id = GL.id ";
  56 + // filter by group
  57 + if ($fGroupID) {
  58 + $sWhereClause = "WHERE UGL.group_id = $fGroupID ";
  59 + }
  60 + // #2978 don't display sys admin accounts if you're not a sysadmin
  61 + if (!Permission::userIsSystemAdministrator()) {
  62 + $sRestrictUsers = " GL.is_sys_admin = 0 ";
  63 + if (strlen($sWhereClause) > 0) {
  64 + $sWhereClause .= " AND $sRestrictUsers";
  65 + } else {
  66 + $sWhereClause = "WHERE $sRestrictUsers";
  67 + }
  68 + }
  69 + $sQuery .= $sWhereClause . "ORDER BY U.name";
56 70  
57 71 $aColumns = array("name", "username", "Edit", "Delete", "Edit Groups");
58 72 $aColumnNames = array("Name", "Username", "Edit", "Delete", "Edit Groups");
... ...