From 24ac6cbbac17290654eac4501369755f07277853 Mon Sep 17 00:00:00 2001 From: Stian Thorgersen Date: Thu, 29 May 2014 10:28:05 +0100 Subject: [PATCH] Fix themes displayed multiple times in admin console --- .../resources/admin/ServerInfoAdminResource.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/services/src/main/java/org/keycloak/services/resources/admin/ServerInfoAdminResource.java b/services/src/main/java/org/keycloak/services/resources/admin/ServerInfoAdminResource.java index 86a1acc310..9c5549ac9a 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/ServerInfoAdminResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/ServerInfoAdminResource.java @@ -1,6 +1,7 @@ package org.keycloak.services.resources.admin; import org.keycloak.audit.AuditListener; +import org.keycloak.freemarker.ExtendingThemeManager; import org.keycloak.freemarker.Theme; import org.keycloak.freemarker.ThemeProvider; import org.keycloak.provider.ProviderSession; @@ -13,6 +14,7 @@ import javax.ws.rs.GET; import javax.ws.rs.core.Context; import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -42,14 +44,13 @@ public class ServerInfoAdminResource { } private void setThemes(ServerInfoRepresentation info) { - Set themeProviders = providers.getAllProviders(ThemeProvider.class); + ExtendingThemeManager themeManager = new ExtendingThemeManager(providers); info.themes = new HashMap>(); + for (Theme.Type type : Theme.Type.values()) { - List themes = new LinkedList(); - for (ThemeProvider p : themeProviders) { - themes.addAll(p.nameSet(type)); - } + List themes = new LinkedList(themeManager.nameSet(type)); Collections.sort(themes); + info.themes.put(type.toString().toLowerCase(), themes); } }