Skip to content

Commit

Permalink
Fix the issue when search request has a count less than max count
Browse files Browse the repository at this point in the history
  • Loading branch information
sandushi committed Oct 18, 2024
1 parent ebbbd3c commit 1ceadcd
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -633,12 +633,13 @@ public UsersGetResponse listUsersWithPost(SearchRequest searchRequest, Map<Strin
if (!IdentityUtil.isConsiderServerWideUserEndpointMaxLimitEnabled()) {
Resource maxLimitResource = getResourceByTenantId(carbonUM.getTenantId());
if (maxLimitResource != null) {
count = maxLimitResource.getAttributes().stream()
int maxLimit = maxLimitResource.getAttributes().stream()
.filter(item -> "userResponseMaxLimit".equals(item.getKey()))
.map(org.wso2.carbon.identity.configuration.mgt.core.model.Attribute::getValue)
.findFirst()
.map(Integer::parseInt)
.orElse(count); // Use the local count variable
count = Math.min(count, maxLimit);
}
} else {
count = SCIMCommonUtils.validateCountParameter(count);
Expand Down

0 comments on commit 1ceadcd

Please sign in to comment.