Commit accafaed authored by michael.simon's avatar michael.simon
Browse files

Show auditing on user page for admin

parent 062ad72d
......@@ -12,6 +12,7 @@ package edu.kit.scc.webreg.bean.admin;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -23,8 +24,11 @@ import javax.inject.Inject;
import org.opensaml.saml2.core.Attribute;
import org.primefaces.event.TransferEvent;
import org.primefaces.model.DualListModel;
import org.primefaces.model.LazyDataModel;
import org.slf4j.Logger;
import edu.kit.scc.webreg.audit.AuditUserEntryService;
import edu.kit.scc.webreg.dao.ops.AndPredicate;
import edu.kit.scc.webreg.drools.KnowledgeSessionService;
import edu.kit.scc.webreg.entity.GroupEntity;
import edu.kit.scc.webreg.entity.RegistryEntity;
......@@ -33,7 +37,9 @@ import edu.kit.scc.webreg.entity.RoleEntity;
import edu.kit.scc.webreg.entity.UserEntity;
import edu.kit.scc.webreg.entity.as.ASUserAttrEntity;
import edu.kit.scc.webreg.entity.as.AttributeSourceEntity;
import edu.kit.scc.webreg.entity.audit.AuditUserEntity;
import edu.kit.scc.webreg.exc.UserUpdateException;
import edu.kit.scc.webreg.model.GenericLazyDataModelImpl;
import edu.kit.scc.webreg.service.ASUserAttrService;
import edu.kit.scc.webreg.service.AttributeSourceService;
import edu.kit.scc.webreg.service.GroupService;
......@@ -72,6 +78,9 @@ public class ShowUserBean implements Serializable {
@Inject
private AttributeSourceService attributeSourceService;
@Inject
private AuditUserEntryService auditUserEntryService;
@Inject
private SessionManager sessionManager;
......@@ -88,7 +97,8 @@ public class ShowUserBean implements Serializable {
private List<ASUserAttrEntity> asUserAttrList;
private AttributeSourceEntity selectedAttributeSource;
private ASUserAttrEntity selectedUserAttr;
private LazyDataModel<AuditUserEntity> auditUserEntryList;
private Long id;
public void preRenderView(ComponentSystemEvent ev) {
......@@ -224,4 +234,13 @@ public class ShowUserBean implements Serializable {
public AttributeSourceEntity getSelectedAttributeSource() {
return selectedAttributeSource;
}
public LazyDataModel<AuditUserEntity> getAuditUserEntryList() {
if (auditUserEntryList == null) {
Map<String, Object> additionalFilterMap = new HashMap<String, Object>();
additionalFilterMap.put("user", new AndPredicate(user));
auditUserEntryList = new GenericLazyDataModelImpl<AuditUserEntity, AuditUserEntryService, Long>(auditUserEntryService, additionalFilterMap);
}
return auditUserEntryList;
}
}
......@@ -241,7 +241,25 @@
</p:column>
</p:dataTable>
</p:tab>
<p:tab id="tab8" title="#{messages.audit}">
<p:dataTable id="auditData" style="min-width: 500px;"
value="#{showUserBean.auditUserEntryList}" var="audit" paginator="true"
lazy="true" rows="15">
<p:column sortBy="#{audit.id}">
<f:facet name="header">
<h:outputText value="#{messages.id}" />
</f:facet>
<h:outputText value="#{audit.id}" />
</p:column>
<p:column sortBy="#{audit.name}">
<f:facet name="header">
<h:outputText value="#{messages.name}" />
</f:facet>
<h:outputText value="#{audit.name}" />
</p:column>
</p:dataTable>
</p:tab>
</p:tabView>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment