Commit 68602e2f authored by michael.simon's avatar michael.simon
Browse files

refurbish admin interface show-user

parent d47bf935
......@@ -26,12 +26,17 @@ import org.primefaces.model.DualListModel;
import org.slf4j.Logger;
import edu.kit.scc.webreg.drools.KnowledgeSessionService;
import edu.kit.scc.webreg.entity.GroupEntity;
import edu.kit.scc.webreg.entity.RegistryEntity;
import edu.kit.scc.webreg.entity.RegistryStatus;
import edu.kit.scc.webreg.entity.RoleEntity;
import edu.kit.scc.webreg.entity.UserEntity;
import edu.kit.scc.webreg.entity.UserRoleEntity;
import edu.kit.scc.webreg.entity.as.ASUserAttrEntity;
import edu.kit.scc.webreg.entity.as.AttributeSourceEntity;
import edu.kit.scc.webreg.exc.RegisterException;
import edu.kit.scc.webreg.service.ASUserAttrService;
import edu.kit.scc.webreg.service.AttributeSourceService;
import edu.kit.scc.webreg.service.GroupService;
import edu.kit.scc.webreg.service.RegistryService;
import edu.kit.scc.webreg.service.RoleService;
import edu.kit.scc.webreg.service.UserService;
......@@ -59,9 +64,18 @@ public class ShowUserBean implements Serializable {
@Inject
private RegistryService registryService;
@Inject
private GroupService groupService;
@Inject
private KnowledgeSessionService knowledgeSessionService;
@Inject
private ASUserAttrService asUserAttrService;
@Inject
private AttributeSourceService attributeSourceService;
@Inject
private SessionManager sessionManager;
......@@ -73,20 +87,17 @@ public class ShowUserBean implements Serializable {
private List<RegistryEntity> registryList;
private List<GroupEntity> groupList;
private List<ASUserAttrEntity> asUserAttrList;
private AttributeSourceEntity selectedAttributeSource;
private ASUserAttrEntity selectedUserAttr;
private Long id;
public void preRenderView(ComponentSystemEvent ev) {
if (user == null) {
user = userService.findByIdWithAll(id);
roleList = new DualListModel<RoleEntity>();
List<RoleEntity> targetList = new ArrayList<RoleEntity>(user.getRoles().size());
for (UserRoleEntity userRole : user.getRoles())
targetList.add(userRole.getRole());
roleList.setTarget(targetList);
List<RoleEntity> sourceList = roleService.findAll();
sourceList.removeAll(targetList);
roleList.setSource(sourceList);
registryList = registryService.findByUser(user);
user = userService.findByIdWithAttrs(id, "genericStore", "attributeStore");
}
}
......@@ -170,6 +181,14 @@ public class ShowUserBean implements Serializable {
}
public DualListModel<RoleEntity> getRoleList() {
if (roleList == null) {
roleList = new DualListModel<RoleEntity>();
List<RoleEntity> targetList = roleService.findByUser(user);
roleList.setTarget(targetList);
List<RoleEntity> sourceList = roleService.findAll();
sourceList.removeAll(targetList);
roleList.setSource(sourceList);
}
return roleList;
}
......@@ -178,11 +197,35 @@ public class ShowUserBean implements Serializable {
}
public List<RegistryEntity> getRegistryList() {
if (registryList == null)
registryList = registryService.findByUser(user);
return registryList;
}
public void setRegistryList(List<RegistryEntity> registryList) {
this.registryList = registryList;
public List<GroupEntity> getGroupList() {
if (groupList == null)
groupList = groupService.findByUser(user);
return groupList;
}
public List<ASUserAttrEntity> getAsUserAttrList() {
if (asUserAttrList == null)
asUserAttrList = asUserAttrService.findForUser(user);
return asUserAttrList;
}
public ASUserAttrEntity getSelectedUserAttr() {
return selectedUserAttr;
}
public void setSelectedUserAttr(ASUserAttrEntity selectedUserAttr) {
selectedUserAttr = asUserAttrService.findByIdWithAttrs(selectedUserAttr.getId(), "values");
selectedAttributeSource = attributeSourceService.findByIdWithAttrs(
selectedUserAttr.getAttributeSource().getId(), "attributeSourceServices");
this.selectedUserAttr = selectedUserAttr;
}
public AttributeSourceEntity getSelectedAttributeSource() {
return selectedAttributeSource;
}
}
......@@ -28,170 +28,223 @@
<p:messages id="messageBox" showDetail="true" />
<div id="panelInline">
<p:panel header="#{messages.user_properties}">
<p:panelGrid id="baseData" columns="2">
<h:outputText value="#{messages.id}:"/>
<h:outputText value="#{showUserBean.entity.id}"/>
<h:outputText value="#{messages.given_name}:"/>
<h:outputText value="#{showUserBean.entity.givenName}"/>
<h:outputText value="#{messages.sur_name}:"/>
<h:outputText value="#{showUserBean.entity.surName}"/>
<h:outputText value="#{messages.eppn}:"/>
<h:outputText value="#{showUserBean.entity.eppn}"/>
<h:outputText value="#{messages.email}:"/>
<h:outputText value="#{showUserBean.entity.email}"/>
<h:outputText value="#{messages.email_more}:"/>
<h:panelGroup>
<ul>
<ui:repeat var="emailAddress" value="#{showUserBean.entity.emailAddresses.toArray()}">
<li><h:outputText value="#{emailAddress}"/></li>
</ui:repeat>
</ul>
</h:panelGroup>
<div id="panel">
<p:tabView id="tabVw" dynamic="true" cache="true">
<h:outputText value="#{messages.uid_number}:"/>
<h:outputText value="#{showUserBean.entity.uidNumber}"/>
<h:outputText value="#{messages.primary_group}:"/>
<h:outputText value="#{showUserBean.entity.primaryGroup.name} (Prefix: #{showUserBean.entity.primaryGroup.prefix}, GID: #{showUserBean.entity.primaryGroup.gidNumber})"/>
<h:outputText value="#{messages.persistent_id}:"/>
<h:outputText value="#{showUserBean.entity.persistentId} (#{showUserBean.entity.persistentSpId}, #{showUserBean.entity.persistentIdpId})"/>
<p:tab id="tab1" title="#{messages.user_properties}">
<p:panelGrid id="baseData" columns="2">
<h:outputText value="#{messages.id}:"/>
<h:outputText value="#{showUserBean.entity.id}"/>
<h:outputText value="#{messages.given_name}:"/>
<h:outputText value="#{showUserBean.entity.givenName}"/>
<h:outputText value="#{messages.sur_name}:"/>
<h:outputText value="#{showUserBean.entity.surName}"/>
<h:outputText value="#{messages.eppn}:"/>
<h:outputText value="#{showUserBean.entity.eppn}"/>
<h:outputText value="#{messages.email}:"/>
<h:outputText value="#{showUserBean.entity.email}"/>
<h:outputText value="#{messages.email_more}:"/>
<h:panelGroup>
<ul>
<ui:repeat var="emailAddress" value="#{showUserBean.entity.emailAddresses.toArray()}">
<li><h:outputText value="#{emailAddress}"/></li>
</ui:repeat>
</ul>
</h:panelGroup>
</p:panelGrid>
</p:panel>
</div>
<div id="panelInline">
<p:panel id="rolePanel" header="#{messages.roles}">
<p:pickList var="role" value="#{showUserBean.roleList}" itemLabel="#{role.name}"
itemValue="#{role}" converter="#{roleConverter}"
showSourceFilter="true" showTargetFilter="true" filterMatchMode="contains">
<p:ajax event="transfer" listener="#{showUserBean.onTransfer}" />
</p:pickList>
</p:panel>
</div>
<div id="panelInline">
<p:panel id="attrPanel" header="#{messages.saml_values}">
<p:dataTable id="attrData" style="min-width: 500px;"
value="#{showUserBean.entity.attributeStore.keySet().toArray()}" var="key">
<p:column>
<f:facet name="header">
<h:outputText value="#{messages.name}" />
</f:facet>
<h:outputText value="#{key}" style="font-size: 80%;" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{messages.value}" />
</f:facet>
<h:outputText value="#{showUserBean.entity.attributeStore.get(key)}" />
</p:column>
</p:dataTable>
<div style="margin-top: 12px;">
<p:commandButton value="#{messages.attr_query}" action="#{showUserBean.updateFromIdp()}" update="@form" />
<p:ajaxStatus id="ajaxStatusPanel" style="display: inline-block; margin-left: 8px; vertical-align: baseline;">
<f:facet name="start">
<h:graphicImage value="#{resource['/img/ajax-loader.gif']}" alt="#{messages.loading}"/>
</f:facet>
<f:facet name="complete">
<h:outputText value="" />
</f:facet>
</p:ajaxStatus>
</div>
</p:panel>
</div>
<h:outputText value="#{messages.uid_number}:"/>
<h:outputText value="#{showUserBean.entity.uidNumber}"/>
<h:outputText value="#{messages.primary_group}:"/>
<h:outputText value="#{showUserBean.entity.primaryGroup.name} (Prefix: #{showUserBean.entity.primaryGroup.prefix}, GID: #{showUserBean.entity.primaryGroup.gidNumber})"/>
<h:outputText value="#{messages.persistent_id}:"/>
<h:outputText value="#{showUserBean.entity.persistentId} (#{showUserBean.entity.persistentSpId}, #{showUserBean.entity.persistentIdpId})"/>
</p:panelGrid>
</p:tab>
<p:tab id="tab2" title="#{messages.roles}">
<p:pickList var="role" value="#{showUserBean.roleList}" itemLabel="#{role.name}"
itemValue="#{role}" converter="#{roleConverter}"
showSourceFilter="true" showTargetFilter="true" filterMatchMode="contains">
<p:ajax event="transfer" listener="#{showUserBean.onTransfer}" />
</p:pickList>
</p:tab>
<div id="panelInline">
<p:panel header="#{messages.registered_services}">
<p:dataTable id="registeredTable" var="registry" value="#{showUserBean.registryList}">
<p:column>
<f:facet name="header">
<h:outputText value="#{messages.id}" />
</f:facet>
<h:outputText value="#{registry.id}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{messages.service}" />
</f:facet>
<h:link outcome="show-registry.xhtml" value="#{registry.service.name}">
<f:param name="id" value="#{registry.id}"/>
</h:link>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{messages.registered_time}" />
</f:facet>
<h:outputText value="#{of:formatDate(registry.agreedTime, 'dd.MM.yyyy HH:mm')}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{messages.status}" />
</f:facet>
<h:outputText value="#{registry.registryStatus}" />
</p:column>
</p:dataTable>
<div style="margin-top: 12px;">
<p:commandButton value="#{messages.check_registries}" action="#{showUserBean.checkAllRegistries()}" update="@form" />
<p:ajaxStatus id="ajaxCARStatusPanel" style="display: inline-block; margin-left: 8px; vertical-align: baseline;">
<f:facet name="start">
<h:graphicImage value="#{resource['/img/ajax-loader.gif']}" alt="#{messages.loading}"/>
</f:facet>
<f:facet name="complete">
<h:outputText value="" />
</f:facet>
</p:ajaxStatus>
</div>
</p:panel>
</div>
<p:tab id="tab3" title="#{messages.saml_values}">
<p:dataTable id="attrData" style="min-width: 500px;"
value="#{showUserBean.entity.attributeStore.keySet().toArray()}" var="key">
<p:column>
<f:facet name="header">
<h:outputText value="#{messages.name}" />
</f:facet>
<h:outputText value="#{key}" style="font-size: 80%;" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{messages.value}" />
</f:facet>
<h:outputText value="#{showUserBean.entity.attributeStore.get(key)}" />
</p:column>
</p:dataTable>
<div style="margin-top: 12px;">
<p:commandButton value="#{messages.attr_query}" action="#{showUserBean.updateFromIdp()}" update="@form" />
<p:ajaxStatus id="ajaxStatusPanel" style="display: inline-block; margin-left: 8px; vertical-align: baseline;">
<f:facet name="start">
<h:graphicImage value="#{resource['/img/ajax-loader.gif']}" alt="#{messages.loading}"/>
</f:facet>
<f:facet name="complete">
<h:outputText value="" />
</f:facet>
</p:ajaxStatus>
</div>
</p:tab>
<div id="panelInline">
<p:panel header="#{messages.more_properties}">
<p:dataTable id="storeData" style="min-width: 500px;"
value="#{showUserBean.entity.genericStore.keySet().toArray()}" var="key">
<p:column>
<f:facet name="header">
<h:outputText value="#{messages.name}" />
</f:facet>
<h:outputText value="#{key}" style="font-size: 80%;" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{messages.value}" />
</f:facet>
<h:outputText value="#{showUserBean.entity.genericStore.get(key)}" />
</p:column>
</p:dataTable>
</p:panel>
<p:tab id="tab4" title="#{messages.registered_services}">
<p:dataTable id="registeredTable" var="registry" value="#{showUserBean.registryList}">
<p:column>
<f:facet name="header">
<h:outputText value="#{messages.id}" />
</f:facet>
<h:outputText value="#{registry.id}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{messages.service}" />
</f:facet>
<h:link outcome="show-registry.xhtml" value="#{registry.service.name}">
<f:param name="id" value="#{registry.id}"/>
</h:link>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{messages.registered_time}" />
</f:facet>
<h:outputText value="#{of:formatDate(registry.agreedTime, 'dd.MM.yyyy HH:mm')}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{messages.status}" />
</f:facet>
<h:outputText value="#{registry.registryStatus}" />
</p:column>
</p:dataTable>
<div style="margin-top: 12px;">
<p:commandButton value="#{messages.check_registries}" action="#{showUserBean.checkAllRegistries()}" update="@form" />
<p:ajaxStatus id="ajaxCARStatusPanel" style="display: inline-block; margin-left: 8px; vertical-align: baseline;">
<f:facet name="start">
<h:graphicImage value="#{resource['/img/ajax-loader.gif']}" alt="#{messages.loading}"/>
</f:facet>
<f:facet name="complete">
<h:outputText value="" />
</f:facet>
</p:ajaxStatus>
</div>
</p:tab>
<p:tab id="tab5" title="#{messages.more_properties}">
<p:dataTable id="storeData" style="min-width: 500px;"
value="#{showUserBean.entity.genericStore.keySet().toArray()}" var="key">
<p:column>
<f:facet name="header">
<h:outputText value="#{messages.name}" />
</f:facet>
<h:outputText value="#{key}" style="font-size: 80%;" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{messages.value}" />
</f:facet>
<h:outputText value="#{showUserBean.entity.genericStore.get(key)}" />
</p:column>
</p:dataTable>
</p:tab>
<p:tab id="tab6" title="#{messages.secondary_groups}">
<p:dataTable id="secGroupData" style="min-width: 500px;"
value="#{showUserBean.groupList}" var="group">
<p:column>
<f:facet name="header">
<h:outputText value="#{messages.name}" />
</f:facet>
<h:outputText value="#{group.class.simpleName}: #{group.name} " />
<h:outputText value="(#{group.prefix})" rendered="#{group.class.simpleName == 'HomeOrgGroupEntity'}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{messages.id}" />
</f:facet>
<h:outputText value="#{group.gidNumber}" />
</p:column>
</p:dataTable>
</p:tab>
<p:tab id="tab7" title="#{messages.attribute_sources}">
<p:dataTable id="asData" style="min-width: 500px;"
value="#{showUserBean.asUserAttrList}" var="ua">
<p:column sortBy="#{ua.attributeSource.name}">
<f:facet name="header">
<h:outputText value="#{messages.name}" />
</f:facet>
<h:outputText value="#{ua.attributeSource.name}" />
</p:column>
<p:column sortBy="#{ua.lastSuccessfulQuery}">
<f:facet name="header">
<h:outputText value="#{messages.last_update}" />
</f:facet>
<h:outputText value="#{of:formatDate(ua.lastSuccessfulQuery, 'dd.MM.yyyy HH:mm')}" />
</p:column>
<p:column style="width:32px">
<p:commandLink update=":form:documentPanel"
oncomplete="PF('documentDialog').show()" title="View Detail"
styleClass="ui-icon ui-icon-search">
<f:setPropertyActionListener value="#{ua}"
target="#{showUserBean.selectedUserAttr}" />
</p:commandLink>
</p:column>
</p:dataTable>
</p:tab>
</p:tabView>
</div>
<div id="panelInline">
<p:panel header="#{messages.secondary_groups}">
<p:dataTable id="secGroupData" style="min-width: 500px;"
value="#{showUserBean.entity.groups.toArray()}" var="key">
<p:column>
<p:dialog id="dialog" header="Detail" showEffect="fade" widgetVar="documentDialog"
modal="true" resizable="true" width="600px">
<p:outputPanel id="documentPanel">
<p:panelGrid columns="2" columnClasses="label,value" rendered="#{not empty showUserBean.selectedUserAttr}">
<h:outputLabel for="name2" value="#{messages.name}" />
<h:outputText id="name2" value="#{showUserBean.selectedUserAttr.attributeSource.name}" />
<h:outputLabel value="#{messages.attribute_sources_for}" />
<p:dataList var="ass" value="#{showUserBean.selectedAttributeSource.attributeSourceServices.toArray()}">
<h:outputText value="#{ass.service.name}" />
</p:dataList>
</p:panelGrid>
<p:dataTable var="v" value="#{showUserBean.selectedUserAttr.values.toArray()}">
<p:column style="width:128px">
<f:facet name="header">
<h:outputText value="#{messages.name}" />
<h:outputText value="#{messages.key}" />
</f:facet>
<h:outputText value="#{key.group.class.simpleName}: #{key.group.name} " />
<h:outputText value="(#{key.group.prefix})" rendered="#{key.group.class.simpleName == 'HomeOrgGroupEntity'}" />
<h:outputText value="#{v.key}" />
</p:column>
<p:column>
<p:column style="width:256px">
<f:facet name="header">
<h:outputText value="#{messages.id}" />
<h:outputText value="#{messages.value}" />
</f:facet>
<h:outputText value="#{key.group.gidNumber}" />
<h:outputText value="#{v.valueString}" />
</p:column>
</p:dataTable>
</p:panel>
</div>
</p:outputPanel>
</p:dialog>
</h:form>
......
......@@ -44,9 +44,6 @@
<h:outputText value="#{of:formatDate(ua.lastSuccessfulQuery, 'dd.MM.yyyy HH:mm')}" />
</p:column>
<p:column style="width:32px">
<f:facet name="header">
<h:outputText value="#{messages.tools}" />
</f:facet>
<p:commandLink update=":form:documentPanel"
oncomplete="PF('documentDialog').show()" title="View Detail"
styleClass="ui-icon ui-icon-search">
......
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