Commit 8e93dd17 authored by michael.simon's avatar michael.simon
Browse files

change user props bean and page

parent fc8d9718
......@@ -38,7 +38,7 @@ public class UserPropertiesBean implements Serializable {
private IdentityEntity identity;
private List<UserEntity> userList;
private UserEntity selectedUser;
private UserEntity user;
private SamlIdpMetadataEntity idpEntity;
......@@ -65,12 +65,12 @@ public class UserPropertiesBean implements Serializable {
if (identity == null) {
identity = identityService.findById(sessionManager.getIdentityId());
userList = userService.findByIdentity(identity);
selectedUser = userService.findByIdWithStore(userList.get(0).getId());
roleList = roleService.findByUser(selectedUser);
groupList = groupService.findByUser(selectedUser);
user = userService.findByIdWithStore(userList.get(0).getId());
roleList = roleService.findByUser(user);
groupList = groupService.findByUser(user);
if (selectedUser instanceof SamlUserEntity) {
idpEntity = ((SamlUserEntity) selectedUser).getIdp();
if (user instanceof SamlUserEntity) {
idpEntity = ((SamlUserEntity) user).getIdp();
}
}
}
......@@ -87,11 +87,19 @@ public class UserPropertiesBean implements Serializable {
return groupList;
}
public UserEntity getSelectedUser() {
return selectedUser;
public IdentityEntity getIdentity() {
return identity;
}
public void setSelectedUser(UserEntity selectedUser) {
this.selectedUser = selectedUser;
public List<UserEntity> getUserList() {
return userList;
}
public UserEntity getUser() {
return user;
}
public void setUser(UserEntity user) {
this.user = user;
}
}
/*******************************************************************************
* Copyright (c) 2014 Michael Simon.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
*
* Contributors:
* Michael Simon - initial
******************************************************************************/
package edu.kit.scc.webreg.bean.admin;
import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.event.ComponentSystemEvent;
import javax.inject.Inject;
import org.primefaces.model.LazyDataModel;
import edu.kit.scc.webreg.entity.identity.IdentityEntity;
import edu.kit.scc.webreg.model.GenericLazyDataModelImpl;
import edu.kit.scc.webreg.service.identity.IdentityService;
@ManagedBean
@ViewScoped
public class ListIdentityBean implements Serializable {
private static final long serialVersionUID = 1L;
private LazyDataModel<IdentityEntity> list;
@Inject
private IdentityService service;
public void preRenderView(ComponentSystemEvent ev) {
}
public LazyDataModel<IdentityEntity> getIdentityEntityList() {
if (list == null) {
list = new GenericLazyDataModelImpl<IdentityEntity, IdentityService, Long>(service, "users");
}
return list;
}
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:bw="http://www.scc.kit.edu/bwfacelets"
xmlns:p="http://primefaces.org/ui"
xmlns:of="http://omnifaces.org/functions">
<head>
<title></title>
</head>
<body>
<f:view>
<f:metadata>
<f:event type="javax.faces.event.PreRenderViewEvent"
listener="#{listIdentityBean.preRenderView}" />
</f:metadata>
<ui:composition template="/template/default-admin.xhtml">
<ui:param name="title" value="#{messages.title}"/>
<ui:define name="content">
<h:form id="form">
<p:dataTable id="dataTable" var="identity" value="#{listIdentityBean.identityEntityList}" paginator="true"
lazy="true" rows="15">
<p:column sortBy="#{identity.id}" style="width:48px;">
<f:facet name="header">
<h:outputText value="#{messages.id}" />
</f:facet>
<h:outputText value="#{identity.id}"/>
</p:column>
<p:column sortBy="#{identity.userPreferredName}" filterBy="#{identity.userPreferredName}">
<f:facet name="header">
<h:outputText value="#{messages.user_preferred_name}" />
</f:facet>
<h:outputText value="#{identity.userPreferredName}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{messages.eppn}" />
</f:facet>
<ui:repeat var="user" value="#{identity.users}">
<h:link outcome="show-user.xhtml" value="#{user.eppn}">
<f:param name="id" value="#{user.id}"/>
</h:link><br/>
</ui:repeat>
</p:column>
</p:dataTable>
</h:form>
</ui:define>
</ui:composition>
</f:view>
</body>
</html>
......@@ -26,6 +26,12 @@
<h:form>
<div class="panel">
<p:panel rendered="#{userPropertiesBean.userList.size() gt 1}">
<p:outputLabel for="@next" value="Choose account: " />
<p:selectOneMenu id="userSelect" value="#{userPropertiesBean.user}" converter="#{userConverter}">
<f:selectItems value="#{userPropertiesBean.userList}" var="user" itemLabel="#{user.eppn}" itemValue="#{user}" />
</p:selectOneMenu>
</p:panel>
<p:tabView id="tabVw" dynamic="true" cache="true">
<p:tab id="tab1" title="#{messages.my_data}">
<div class="panel">#{messages.my_data_explanation}</div>
......
Supports Markdown
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