diff --git a/services/api/src/models/group.ts b/services/api/src/models/group.ts index 16b443a11c..deb9c416b0 100644 --- a/services/api/src/models/group.ts +++ b/services/api/src/models/group.ts @@ -539,16 +539,8 @@ export const Group = (clients: { const getGroupMemberCount = async ( group: Group ): Promise => { - const roleSubgroups = group.subGroups.filter(isRoleSubgroup); - let membership = 0; - for (const roleSubgroup of roleSubgroups) { - const keycloakUsers = await keycloakAdminClient.groups.listMembers({ - id: roleSubgroup.id - }); - - membership = membership + keycloakUsers.length; - } - return membership; + const membership = await getGroupMembership(group) + return membership.length; }; const addGroup = async (groupInput: Group, projectId?: number, organizationId?: number): Promise => {