diff --git a/services/src/main/java/org/keycloak/services/resources/account/AccountConsole.java b/services/src/main/java/org/keycloak/services/resources/account/AccountConsole.java index 4eed9944af..43ddc4ac67 100644 --- a/services/src/main/java/org/keycloak/services/resources/account/AccountConsole.java +++ b/services/src/main/java/org/keycloak/services/resources/account/AccountConsole.java @@ -32,6 +32,9 @@ import javax.json.Json; import javax.json.JsonObjectBuilder; import javax.json.JsonWriter; import org.jboss.logging.Logger; +import org.keycloak.common.Profile; +import org.keycloak.events.EventStoreProvider; +import org.keycloak.forms.account.freemarker.model.FeaturesBean; import org.keycloak.models.ClientModel; import org.keycloak.protocol.oidc.utils.RedirectUtils; import org.keycloak.services.managers.RealmManager; @@ -108,6 +111,10 @@ public class AccountConsole { map.put("msgJSON", messagesToJsonString(messages)); map.put("supportedLocales", supportedLocales(messages)); map.put("properties", theme.getProperties()); + + EventStoreProvider eventStore = session.getProvider(EventStoreProvider.class); + map.put("isEventsEnabled", eventStore != null && realm.isEventsEnabled()); + map.put("isAuthorizationEnabled", Profile.isFeatureEnabled(Profile.Feature.AUTHORIZATION)); FreeMarkerUtil freeMarkerUtil = new FreeMarkerUtil(); String result = freeMarkerUtil.processTemplate(map, "index.ftl", theme); diff --git a/themes/src/main/resources/theme/keycloak-preview/account/index.ftl b/themes/src/main/resources/theme/keycloak-preview/account/index.ftl index d7495ce28e..a1914179ba 100644 --- a/themes/src/main/resources/theme/keycloak-preview/account/index.ftl +++ b/themes/src/main/resources/theme/keycloak-preview/account/index.ftl @@ -13,10 +13,16 @@ var baseUrl = '${baseUrl}'; var realm = '${realm.name}'; var resourceUrl = '${resourceUrl}'; - var isRegistrationEmailAsUsername = ${realm.registrationEmailAsUsername?c}; - var isEditUserNameAllowed = ${realm.editUsernameAllowed?c}; - var isInternationalizationEnabled = ${realm.internationalizationEnabled?c}; - + + var features = { + isRegistrationEmailAsUsername : ${realm.registrationEmailAsUsername?c}, + isEditUserNameAllowed : ${realm.editUsernameAllowed?c}, + isInternationalizationEnabled : ${realm.internationalizationEnabled?c}, + isLinkedAccountsEnabled : ${realm.identityFederationEnabled?c}, + isEventsEnabled : ${isEventsEnabled?c}, + isMyResourcesEnabled : ${(realm.userManagedAccessAllowed && isAuthorizationEnabled)?c} + } + var availableLocales = []; <#list supportedLocales as locale, label> availableLocales.push({locale : '${locale}', label : '${label}'}); @@ -190,7 +196,7 @@