KEYCLOAK-475
Log is shown in menu when audit is disabled for realm
This commit is contained in:
parent
952f098440
commit
d68131ac00
3 changed files with 19 additions and 13 deletions
|
@ -24,7 +24,7 @@
|
|||
<td>${event.date?datetime}</td>
|
||||
<td>${event.event}</td>
|
||||
<td>${event.ipAddress}</td>
|
||||
<td>${event.client}</td>
|
||||
<td>${event.client!}</td>
|
||||
<td><#list event.details as detail>${detail.key} = ${detail.value} <#if detail_has_next>, </#if></#list></td>
|
||||
</tr>
|
||||
</#list>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<table class="table">
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>IP</td>
|
||||
|
@ -27,18 +27,14 @@
|
|||
<td>${session.lastAccess?datetime}</td>
|
||||
<td>${session.expires?datetime}</td>
|
||||
<td>
|
||||
<ul style="list-style: none; ">
|
||||
<#list session.applications as app>
|
||||
<li>${app}</li>
|
||||
</#list>
|
||||
</ul>
|
||||
<#list session.applications as app>
|
||||
${app}<br/>
|
||||
</#list>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="list-style: none; ">
|
||||
<#list session.clients as client>
|
||||
<li>${client}</li>
|
||||
</#list>
|
||||
</ul>
|
||||
<#list session.clients as client>
|
||||
${client}<br/>
|
||||
</#list>
|
||||
</td>
|
||||
</tr>
|
||||
</#list>
|
||||
|
|
|
@ -160,7 +160,9 @@ public class AccountService {
|
|||
}
|
||||
}
|
||||
|
||||
account.setFeatures(realm.isSocial(), auditProvider != null, passwordUpdateSupported);
|
||||
boolean auditEnabled = auditProvider != null && realm.isAuditEnabled();
|
||||
|
||||
account.setFeatures(realm.isSocial(), auditEnabled, passwordUpdateSupported);
|
||||
}
|
||||
|
||||
public static UriBuilder accountServiceBaseUrl(UriInfo uriInfo) {
|
||||
|
@ -246,6 +248,14 @@ public class AccountService {
|
|||
public Response logPage() {
|
||||
if (auth != null) {
|
||||
List<Event> events = auditProvider.createQuery().event(AUDIT_EVENTS).user(auth.getUser().getId()).maxResults(30).getResultList();
|
||||
for (Event e : events) {
|
||||
Iterator<Map.Entry<String, String>> itr = e.getDetails().entrySet().iterator();
|
||||
while (itr.hasNext()) {
|
||||
if (!AUDIT_DETAILS.contains(itr.next().getKey())) {
|
||||
itr.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
account.setEvents(events);
|
||||
}
|
||||
return forwardToPage("log", AccountPages.LOG);
|
||||
|
|
Loading…
Reference in a new issue