Skip to content

Commit

Permalink
Get role count for a filter in a given tenant.
Browse files Browse the repository at this point in the history
  • Loading branch information
mpmadhavig committed Dec 10, 2024
1 parent af6e5f2 commit 9cb325e
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -472,16 +472,22 @@ private RolesV2GetResponse filterRolesByAttributes(Node node, Integer count, Int
LOG.debug(String.format("Filtering roles from search filter: %s", searchFilter));
}
List<Role> roles;
int roleCount;
List<RoleV2> scimRoles;
try {
roles = roleManagementService.getRoles(searchFilter, count, startIndex, sortBy, sortOrder, tenantDomain,
requiredAttributes);
scimRoles = getScimRolesList(roles, requiredAttributes);
roleCount = roleManagementService.getRolesCount(searchFilter, tenantDomain);
if (roleCount == 0) {
roleCount = scimRoles.size();
}
} catch (IdentityRoleManagementException e) {
throw new CharonException(
String.format("Error occurred while listing roles based on the search filter: %s", searchFilter),
e);
}
List<RoleV2> scimRoles = getScimRolesList(roles, requiredAttributes);
return new RolesV2GetResponse(scimRoles.size(), scimRoles);
return new RolesV2GetResponse(roleCount, scimRoles);
}

private String buildSearchFilter(Node node) throws BadRequestException {
Expand Down

0 comments on commit 9cb325e

Please sign in to comment.