Commit 5882b2bb authored by michael.simon's avatar michael.simon
Browse files

more oidc config options

parent 84d55de0
......@@ -18,8 +18,12 @@ import javax.faces.bean.ViewScoped;
import javax.faces.event.ComponentSystemEvent;
import javax.inject.Inject;
import edu.kit.scc.webreg.entity.ScriptEntity;
import edu.kit.scc.webreg.entity.ServiceEntity;
import edu.kit.scc.webreg.entity.oidc.OidcClientConfigurationEntity;
import edu.kit.scc.webreg.entity.oidc.ServiceOidcClientEntity;
import edu.kit.scc.webreg.service.ScriptService;
import edu.kit.scc.webreg.service.ServiceService;
import edu.kit.scc.webreg.service.oidc.OidcClientConfigurationService;
import edu.kit.scc.webreg.service.oidc.ServiceOidcClientService;
......@@ -35,14 +39,24 @@ public class ShowOidcClientConfigurationBean implements Serializable {
@Inject
private ServiceOidcClientService serviceOidcClientService;
@Inject
private ScriptService scriptService;
@Inject
private ServiceService serviceService;
private OidcClientConfigurationEntity entity;
private List<ServiceOidcClientEntity> serviceOidcClientList;
private List<ScriptEntity> scriptList;
private List<ServiceEntity> serviceList;
private Long id;
private String newKey;
private String newValue;
private ServiceOidcClientEntity newSoce;
public void preRenderView(ComponentSystemEvent ev) {
}
......@@ -74,6 +88,18 @@ public class ShowOidcClientConfigurationBean implements Serializable {
return id;
}
public void addSoce() {
serviceOidcClientService.save(newSoce);
newSoce = null;
serviceOidcClientList = null;
}
public void removeSoce(ServiceOidcClientEntity oldSoce) {
serviceOidcClientService.delete(oldSoce);
newSoce = oldSoce;
serviceOidcClientList = null;
}
public void setId(Long id) {
this.id = id;
}
......@@ -99,4 +125,28 @@ public class ShowOidcClientConfigurationBean implements Serializable {
serviceOidcClientList = serviceOidcClientService.findByClientConfig(getEntity());
return serviceOidcClientList;
}
public ServiceOidcClientEntity getNewSoce() {
if (newSoce == null) {
newSoce = new ServiceOidcClientEntity();
newSoce.setClientConfig(getEntity());
}
return newSoce;
}
public void setNewSoce(ServiceOidcClientEntity newSoce) {
this.newSoce = newSoce;
}
public List<ScriptEntity> getScriptList() {
if (scriptList == null)
scriptList = scriptService.findAll();
return scriptList;
}
public List<ServiceEntity> getServiceList() {
if (serviceList == null)
serviceList = serviceService.findAll();
return serviceList;
}
}
/*******************************************************************************
* 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.converter;
import javax.inject.Inject;
import javax.inject.Named;
import edu.kit.scc.webreg.entity.BaseEntity;
import edu.kit.scc.webreg.service.BaseService;
import edu.kit.scc.webreg.service.ScriptService;
@Named("scriptConverter")
public class ScriptConverter extends AbstractConverter {
private static final long serialVersionUID = 1L;
@Inject
private ScriptService service;
@Override
protected BaseService<? extends BaseEntity<Long>, Long> getService() {
return service;
}
}
/*******************************************************************************
* 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.converter;
import javax.inject.Inject;
import javax.inject.Named;
import edu.kit.scc.webreg.entity.BaseEntity;
import edu.kit.scc.webreg.service.BaseService;
import edu.kit.scc.webreg.service.oidc.ServiceOidcClientService;
@Named("serviceOidcClientConverter")
public class ServiceOidcClientConverter extends AbstractConverter {
private static final long serialVersionUID = 1L;
@Inject
private ServiceOidcClientService service;
@Override
protected BaseService<? extends BaseEntity<Long>, Long> getService() {
return service;
}
}
......@@ -24,7 +24,7 @@
<h:form id="form">
<h2><h:outputText value="#{messages.rp_config}: #{showOidcClientConfigurationBean.entity.name}"/></h2>
<p:panel header="#{messages.rp_config}">
<p:panel id="mainPanel" header="#{messages.rp_config}">
<p:panelGrid id="baseData" columns="2">
<h:outputText value="#{messages.id}:"/>
......@@ -51,7 +51,7 @@
<h:outputText value="#{key}:"/>
<h:outputText value="#{showOidcClientConfigurationBean.entity.genericStore.get(key)}"/>
<h:commandLink value="(#{messages.delete})" action="#{showOidcClientConfigurationBean.removeGenericStore(key)}">
<f:ajax render="@form" />
<f:ajax render=":form:mainPanel" />
</h:commandLink>
</h:panelGrid>
</li>
......@@ -61,7 +61,7 @@
<h:inputText id="key_input" value="#{showOidcClientConfigurationBean.newKey}"/>
<h:inputText id="value_input" value="#{showOidcClientConfigurationBean.newValue}"/>
<h:commandLink value="#{messages.add}" action="#{showOidcClientConfigurationBean.addGenericStore()}">
<f:ajax execute="form" render="form" />
<f:ajax execute=":form:mainPanel" render=":form:mainPanel" />
</h:commandLink>
</h:panelGrid>
</h:panelGroup>
......@@ -73,15 +73,48 @@
</p:panel>
<p:panel header="#{messages.attribute_scripts}">
<p:panel id="scriptPanel" header="#{messages.attribute_scripts}">
<ui:repeat var="scc" value="#{showOidcClientConfigurationBean.serviceOidcClientList}">
<h:outputText value="#{scc.script.name} (#{scc.script.id})" /> -
<h:outputText value="#{scc.service.name}" />
<h:outputText value=" (wants elevation: #{scc.wantsElevation})" />
<h:outputText value=" (order criteria: #{scc.orderCriteria})" />
<p:outputPanel>
<h:outputText value="#{scc.script.name} (#{scc.script.id})" /> -
<h:outputText value="#{scc.service.name}" rendered="#{scc.service != null}"/>
<h:outputText value="No service" rendered="#{scc.service == null}"/>
<h:outputText value=" (wants elevation: #{scc.wantsElevation})" />
<h:outputText value=" (order criteria: #{scc.orderCriteria}) " />
<h:commandLink value="#{messages.delete}" action="#{showOidcClientConfigurationBean.removeSoce(scc)}">
<f:ajax render=":form:scriptPanel" />
</h:commandLink>
</p:outputPanel>
</ui:repeat>
<p:panelGrid columns="2">
<h:outputText value="#{messages.script}" />
<h:selectOneMenu value="#{showOidcClientConfigurationBean.newSoce.script}"
converter="#{scriptConverter}">
<f:selectItem itemLabel="Kein Script" itemValue="#{null}"/>
<f:selectItems value="#{showOidcClientConfigurationBean.scriptList}"
var="script" itemLabel="#{script.name} (id #{script.id})" itemValue="#{script}"/>
</h:selectOneMenu>
<h:outputText value="#{messages.sservice}" />
<h:selectOneMenu value="#{showOidcClientConfigurationBean.newSoce.service}"
converter="#{serviceConverter}">
<f:selectItem itemLabel="Kein Service" itemValue="#{null}"/>
<f:selectItems value="#{showOidcClientConfigurationBean.serviceList}"
var="service" itemLabel="#{service.name} (id #{service.id})" itemValue="#{service}"/>
</h:selectOneMenu>
<h:outputText value="#{messages.wants_elevation}" />
<p:inputSwitch value="#{showOidcClientConfigurationBean.newSoce.wantsElevation}"/>
<h:outputText value="#{messages.orderCriteria}" />
<p:inputText value="#{showOidcClientConfigurationBean.newSoce.orderCriteria}"/>
</p:panelGrid>
<h:commandLink value="#{messages.add}" action="#{showOidcClientConfigurationBean.addSoce()}">
<f:ajax execute=":form:scriptPanel" render=":form:scriptPanel" />
</h:commandLink>
</p:panel>
</h:form>
......
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