From d59c8361e2d22a63a461f6e6003a7ed4c9389957 Mon Sep 17 00:00:00 2001 From: Megan Watson Date: Mon, 11 Feb 2008 10:22:51 +0000 Subject: [PATCH] KTS-2892 "Search for user by username returns all users and filter is ignored." Fixed. The sql function to get the list of users was overwriting the filter. --- lib/users/User.inc | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/users/User.inc b/lib/users/User.inc index 8ab6ebe..91eba61 100644 --- a/lib/users/User.inc +++ b/lib/users/User.inc @@ -323,10 +323,19 @@ class User extends KTEntity { * @return Array array of User objects, false otherwise and set $_SESSION["errorMessage"] */ function getList($sWhereClause = null, $aOptions = null) { - if(!is_array($aOptions)) $aOptions = array($aOptions); - $aOptions['orderby'] = KTUtil::arrayGet($aOptions, 'orderby', 'name'); - //if disabled = 2 then the user is deleted - $sWhereClause = 'disabled != \'2\''; + if(!is_array($aOptions)) $aOptions = array($aOptions); + $aOptions['orderby'] = KTUtil::arrayGet($aOptions, 'orderby', 'name'); + + // don't include deleted users: disabled = 2 + if(!empty($sWhereClause)){ + if(strpos(strtolower($sWhereClause), 'where ') === false){ + $sWhereClause = '('.$sWhereClause.')'; + } + $sWhereClause .= ' AND disabled != 2'; + }else{ + $sWhereClause = 'disabled != 2'; + } + return KTEntityUtil::getList2('User', $sWhereClause, $aOptions); } -- libgit2 0.21.4