diff --git a/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/impl/SCIMUserManager.java b/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/impl/SCIMUserManager.java index b161b912b..c80ee1f27 100644 --- a/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/impl/SCIMUserManager.java +++ b/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/impl/SCIMUserManager.java @@ -733,6 +733,28 @@ private long getTotalUsers(String domainName) throws CharonException { return totalUsers; } + private long getTotalUsers(ExpressionNode node, String domainName) throws CharonException { + + long totalUsers = 0; + AbstractUserStoreManager secondaryUserStoreManager = null; + if (StringUtils.isNotBlank(domainName)) { + secondaryUserStoreManager = (AbstractUserStoreManager) carbonUM + .getSecondaryUserStoreManager(domainName); + } + try { + if (secondaryUserStoreManager instanceof JDBCUserStoreManager) { + if (node != null && node.getOperation() != null && SCIMCommonConstants.EQ.equals(node.getOperation())) { + totalUsers = secondaryUserStoreManager.countUsersWithClaims(node.getValue(), node.getOperation()); + } else { + totalUsers = secondaryUserStoreManager.countUsersWithClaims(USERNAME_CLAIM, SCIMCommonConstants.ANY); + } + } + } catch (org.wso2.carbon.user.core.UserStoreException e) { + throw resolveError(e, "Error while getting total user count in domain: " + domainName); + } + return totalUsers; + } + /** * Method to decide whether to paginate based on the offset and the limit in the request. * @@ -1408,7 +1430,7 @@ private UsersGetResponse filterUsersBySingleAttribute(ExpressionNode node, Map3.3.7 6.5.3 3.2.0.wso2v1 - 4.9.15 + 4.9.18 5.25.509 4.13.1 20030203.000129