From 402aa422014f5f164137f87d70e07c334f1f876f Mon Sep 17 00:00:00 2001 From: keshavprashantdeshpande Date: Mon, 23 Sep 2024 08:28:06 +0200 Subject: [PATCH] Add subgroup count to groupByPath (#33161) Closes #31410 Signed-off-by: Keshav Deshpande --- .../keycloak/services/resources/admin/RealmAdminResource.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/src/main/java/org/keycloak/services/resources/admin/RealmAdminResource.java b/services/src/main/java/org/keycloak/services/resources/admin/RealmAdminResource.java index b734e6be7511..2781abf7b311 100644 --- a/services/src/main/java/org/keycloak/services/resources/admin/RealmAdminResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/RealmAdminResource.java @@ -116,6 +116,7 @@ import org.keycloak.storage.DatastoreProvider; import org.keycloak.storage.ExportImportManager; import org.keycloak.storage.StoreSyncEvent; +import org.keycloak.utils.GroupUtils; import org.keycloak.utils.ProfileHelper; import org.keycloak.utils.ReservedCharValidator; @@ -1093,7 +1094,8 @@ public GroupRepresentation getGroupByPath(@PathParam("path") String path) { } auth.groups().requireView(found); - return ModelToRepresentation.toRepresentation(found, true); + GroupRepresentation groupRep = ModelToRepresentation.toRepresentation(found, true); + return GroupUtils.populateSubGroupCount(found, groupRep); } /**