diff --git a/core/org.wso2.carbon.user.core/src/main/java/org/wso2/carbon/user/core/ldap/LDAPConstants.java b/core/org.wso2.carbon.user.core/src/main/java/org/wso2/carbon/user/core/ldap/LDAPConstants.java index 1aae065189f..7b8c9683869 100644 --- a/core/org.wso2.carbon.user.core/src/main/java/org/wso2/carbon/user/core/ldap/LDAPConstants.java +++ b/core/org.wso2.carbon.user.core/src/main/java/org/wso2/carbon/user/core/ldap/LDAPConstants.java @@ -112,4 +112,6 @@ public class LDAPConstants { */ public static final String DEFAULT_LDAP_TIME_FORMATS_PATTERN = "[uuuuMMddHHmmss[,SSS][.SSS]X]" + "[uuuuMMddHHmmss[,SS][.SS]X][uuuuMMddHHmm[,S][.S]X]"; + + public static final boolean DESCENDING = false; } diff --git a/core/org.wso2.carbon.user.core/src/main/java/org/wso2/carbon/user/core/ldap/UniqueIDReadOnlyLDAPUserStoreManager.java b/core/org.wso2.carbon.user.core/src/main/java/org/wso2/carbon/user/core/ldap/UniqueIDReadOnlyLDAPUserStoreManager.java index c1090ee7841..e39edaba30a 100644 --- a/core/org.wso2.carbon.user.core/src/main/java/org/wso2/carbon/user/core/ldap/UniqueIDReadOnlyLDAPUserStoreManager.java +++ b/core/org.wso2.carbon.user.core/src/main/java/org/wso2/carbon/user/core/ldap/UniqueIDReadOnlyLDAPUserStoreManager.java @@ -1549,7 +1549,7 @@ protected UniqueIDPaginatedSearchResult doGetUserListWithID(Condition condition, ldapContext.setRequestControls(new Control[] { new PagedResultsControl(pageSize, Control.CRITICAL), new SortControl(userNameAttribute, Control.NONCRITICAL) }); } else { - SortKey sortKey = new SortKey(userNameAttribute, Control.NONCRITICAL, null); + SortKey sortKey = new SortKey(userNameAttribute, LDAPConstants.DESCENDING, null); SortKey[] sortKeyArray = new SortKey[1]; sortKeyArray[0] = sortKey; ldapContext.setRequestControls(new Control[] { new PagedResultsControl(pageSize, Control.CRITICAL),