maded applications editable, made UUID visible
This commit is contained in:
@ -4,14 +4,14 @@ ldap.url = ldaps://host:port
|
||||
## we will use provided username / password from webapplication
|
||||
ldap.user = user
|
||||
ldap.password = secret
|
||||
ldap.suffix = @diebold.com
|
||||
ldap.fallbackSuffix = @dieboldnixdorf.com
|
||||
ldap.searchBase = dc=ad,dc=diebold,dc=com
|
||||
ldap.principalSuffix = @primarySuffix
|
||||
ldap.fallbackPrincipalSuffixes = @fallback1, @fallback2
|
||||
ldap.searchBase = dc=domain,dc=com
|
||||
ldap.searchFilter = (&(objectClass=*)(mail={0}))
|
||||
|
||||
## NO CHANGES BEHIND THIS LINE REQUIRED
|
||||
shiro.contextFactory = contextFactory = org.apache.shiro.realm.ldap.JndiLdapContextFactory${line.separator}contextFactory.url = ${ldap.url}${line.separator}contextFactory.systemUsername = ${ldap.user}${line.separator}contextFactory.systemPassword = ${ldap.password}${line.separator}contextFactory.environment[java.naming.security.protocol] = ssl
|
||||
shiro.passwordMatcher= passwordMatcher=org.apache.shiro.authc.credential.AllowAllCredentialsMatcher
|
||||
shiro.ldapRealm = ldapRealm = de.muehlencord.shared.account.shiro.realm.UserNameActiveDirectoryRealm${line.separator}ldapRealm.principalSuffix = ${ldap.suffix}${line.separator}ldapRealm.fallbackPrincipalSuffix = ${ldap.fallbackSuffix}${line.separator}ldapRealm.ldapContextFactory = $contextFactory${line.separator}ldapRealm.searchBase = ${ldap.searchBase}${line.separator}ldapRealm.searchFilter = ${ldap.searchFilter}${line.separator}ldapRealm.permissionsLookupEnabled=false
|
||||
shiro.ldapRealm = ldapRealm = de.muehlencord.shared.account.shiro.realm.UserNameActiveDirectoryRealm${line.separator}ldapRealm.principalSuffix = ${ldap.principalSuffix}${line.separator}ldapRealm.fallbackPrincipalSuffixes = ${ldap.fallbackPrincipalSuffixes}${line.separator}ldapRealm.ldapContextFactory = $contextFactory${line.separator}ldapRealm.searchBase = ${ldap.searchBase}${line.separator}ldapRealm.searchFilter = ${ldap.searchFilter}${line.separator}ldapRealm.permissionsLookupEnabled=false
|
||||
shiro.authcStrategy = org.apache.shiro.authc.pam.AllSuccessfulStrategy
|
||||
shiro.realms=$jdbcRealm,$ldapRealm
|
||||
|
||||
@ -1,151 +1,155 @@
|
||||
package de.muehlencord.shared.account.web.presentation;
|
||||
|
||||
import de.muehlencord.shared.account.business.application.control.ApplicationControl;
|
||||
import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
|
||||
import de.muehlencord.shared.account.util.AccountSecurityException;
|
||||
import de.muehlencord.shared.jeeutil.FacesUtil;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
import javax.enterprise.context.SessionScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Joern Muehlencord <joern at muehlencord.de>
|
||||
*/
|
||||
@SessionScoped
|
||||
@Named("applicationView")
|
||||
public class ApplicationView implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -5515249316880163539L;
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationView.class);
|
||||
|
||||
@Inject
|
||||
ApplicationControl applicationService;
|
||||
|
||||
@Inject
|
||||
InstanceView instanceView;
|
||||
|
||||
@Inject
|
||||
Locale locale;
|
||||
|
||||
private ApplicationEntity currentApplication = null;
|
||||
private ApplicationEntity editApplication = null;
|
||||
private List<ApplicationEntity> applicationList = null;
|
||||
|
||||
@PostConstruct
|
||||
public void selectDefaultCurrentApplication() {
|
||||
// force applications to be loaded from database
|
||||
getAllApplications();
|
||||
if ((applicationList != null) && (!applicationList.isEmpty())) {
|
||||
currentApplication = applicationList.get(0);
|
||||
}
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("post construct executed");
|
||||
}
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
public void predestroy() {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Predestroy executed");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<ApplicationEntity> getAllApplications() {
|
||||
if (applicationList == null) {
|
||||
try {
|
||||
applicationList = applicationService.getAllApplications();
|
||||
|
||||
// if no role is assigned to user, ensure that at least current application is added
|
||||
if ((applicationList == null) || (applicationList.isEmpty())) {
|
||||
applicationList = new ArrayList<>();
|
||||
applicationList.add(instanceView.getInstanceApplication());
|
||||
}
|
||||
|
||||
return applicationList;
|
||||
} catch (AccountSecurityException ex) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Detailed stacktrace", new Object[]{ex});
|
||||
}
|
||||
FacesUtil.addGlobalErrorMessage("Error " + ex.getErrorCode(), ex.getLocalizedMessage(locale));
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
return applicationList;
|
||||
}
|
||||
|
||||
public void selectApplication() {
|
||||
if (currentApplication != null) {
|
||||
LOGGER.info("selected application: {}", currentApplication.getApplicationName());
|
||||
FacesUtil.addGlobalInfoMessage("Success", "Selected application " + currentApplication.getApplicationName());
|
||||
}
|
||||
}
|
||||
|
||||
public void newApplication() {
|
||||
this.editApplication = new ApplicationEntity();
|
||||
}
|
||||
|
||||
public void cancelEditApplication() {
|
||||
this.editApplication = null;
|
||||
}
|
||||
|
||||
public void saveEditApplication() {
|
||||
if (editApplication == null) {
|
||||
FacesUtil.addGlobalErrorMessage("Error", "Need to provide data");
|
||||
} else if ((editApplication.getApplicationName() == null) || (editApplication.getApplicationName().trim().equals(""))) {
|
||||
String hint;
|
||||
if (editApplication.getId() == null) {
|
||||
hint = "Cannot create application";
|
||||
} else {
|
||||
hint = "Cannot save application";
|
||||
}
|
||||
FacesUtil.addGlobalErrorMessage(hint, "Application name must not be empty");
|
||||
} else {
|
||||
currentApplication = applicationService.createOrUpdate(editApplication);
|
||||
// force reload of to update view
|
||||
applicationList = null;
|
||||
FacesUtil.addGlobalInfoMessage("Info", "Application saved");
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteApplication() {
|
||||
if (currentApplication == null) {
|
||||
FacesUtil.addGlobalErrorMessage("Error", "Need to provide data");
|
||||
} else if (currentApplication.getId() == null) {
|
||||
FacesUtil.addGlobalErrorMessage("Error", "Cannot delete non persistent data");
|
||||
} else {
|
||||
String applicationName = currentApplication.getApplicationName();
|
||||
applicationService.delete(currentApplication);
|
||||
applicationList = null; // force reload to update view
|
||||
currentApplication = null;
|
||||
selectDefaultCurrentApplication();
|
||||
FacesUtil.addGlobalInfoMessage("Info", "Application " + applicationName + " deleted");
|
||||
}
|
||||
}
|
||||
|
||||
/* *** getter / setter *** */
|
||||
public ApplicationEntity getCurrentApplication() {
|
||||
return currentApplication;
|
||||
}
|
||||
|
||||
public void setCurrentApplication(ApplicationEntity currentApplication) {
|
||||
this.currentApplication = currentApplication;
|
||||
}
|
||||
|
||||
public ApplicationEntity getEditApplication() {
|
||||
return editApplication;
|
||||
}
|
||||
|
||||
public void setEditApplication(ApplicationEntity editApplication) {
|
||||
this.editApplication = editApplication;
|
||||
}
|
||||
}
|
||||
package de.muehlencord.shared.account.web.presentation;
|
||||
|
||||
import de.muehlencord.shared.account.business.application.control.ApplicationControl;
|
||||
import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
|
||||
import de.muehlencord.shared.account.util.AccountSecurityException;
|
||||
import de.muehlencord.shared.jeeutil.FacesUtil;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
import javax.enterprise.context.SessionScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Joern Muehlencord <joern at muehlencord.de>
|
||||
*/
|
||||
@SessionScoped
|
||||
@Named("applicationView")
|
||||
public class ApplicationView implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -5515249316880163539L;
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationView.class);
|
||||
|
||||
@Inject
|
||||
ApplicationControl applicationService;
|
||||
|
||||
@Inject
|
||||
InstanceView instanceView;
|
||||
|
||||
@Inject
|
||||
Locale locale;
|
||||
|
||||
private ApplicationEntity currentApplication = null;
|
||||
private ApplicationEntity editApplication = null;
|
||||
private List<ApplicationEntity> applicationList = null;
|
||||
|
||||
@PostConstruct
|
||||
public void selectDefaultCurrentApplication() {
|
||||
// force applications to be loaded from database
|
||||
getAllApplications();
|
||||
if ((applicationList != null) && (!applicationList.isEmpty())) {
|
||||
currentApplication = applicationList.get(0);
|
||||
}
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("post construct executed");
|
||||
}
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
public void predestroy() {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Predestroy executed");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<ApplicationEntity> getAllApplications() {
|
||||
if (applicationList == null) {
|
||||
try {
|
||||
applicationList = applicationService.getAllApplications();
|
||||
|
||||
// if no role is assigned to user, ensure that at least current application is added
|
||||
if ((applicationList == null) || (applicationList.isEmpty())) {
|
||||
applicationList = new ArrayList<>();
|
||||
applicationList.add(instanceView.getInstanceApplication());
|
||||
}
|
||||
|
||||
return applicationList;
|
||||
} catch (AccountSecurityException ex) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Detailed stacktrace", new Object[]{ex});
|
||||
}
|
||||
FacesUtil.addGlobalErrorMessage("Error " + ex.getErrorCode(), ex.getLocalizedMessage(locale));
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
return applicationList;
|
||||
}
|
||||
|
||||
public void selectApplication() {
|
||||
if (currentApplication != null) {
|
||||
LOGGER.info("selected application: {}", currentApplication.getApplicationName());
|
||||
FacesUtil.addGlobalInfoMessage("Success", "Selected application " + currentApplication.getApplicationName());
|
||||
}
|
||||
}
|
||||
|
||||
public void startEditApplication() {
|
||||
this.editApplication = currentApplication;
|
||||
}
|
||||
|
||||
public void newApplication() {
|
||||
this.editApplication = new ApplicationEntity();
|
||||
}
|
||||
|
||||
public void cancelEditApplication() {
|
||||
this.editApplication = null;
|
||||
}
|
||||
|
||||
public void saveEditApplication() {
|
||||
if (editApplication == null) {
|
||||
FacesUtil.addGlobalErrorMessage("Error", "Need to provide data");
|
||||
} else if ((editApplication.getApplicationName() == null) || (editApplication.getApplicationName().trim().equals(""))) {
|
||||
String hint;
|
||||
if (editApplication.getId() == null) {
|
||||
hint = "Cannot create application";
|
||||
} else {
|
||||
hint = "Cannot save application";
|
||||
}
|
||||
FacesUtil.addGlobalErrorMessage(hint, "Application name must not be empty");
|
||||
} else {
|
||||
currentApplication = applicationService.createOrUpdate(editApplication);
|
||||
// force reload of to update view
|
||||
applicationList = null;
|
||||
FacesUtil.addGlobalInfoMessage("Info", "Application saved");
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteApplication() {
|
||||
if (currentApplication == null) {
|
||||
FacesUtil.addGlobalErrorMessage("Error", "Need to provide data");
|
||||
} else if (currentApplication.getId() == null) {
|
||||
FacesUtil.addGlobalErrorMessage("Error", "Cannot delete non persistent data");
|
||||
} else {
|
||||
String applicationName = currentApplication.getApplicationName();
|
||||
applicationService.delete(currentApplication);
|
||||
applicationList = null; // force reload to update view
|
||||
currentApplication = null;
|
||||
selectDefaultCurrentApplication();
|
||||
FacesUtil.addGlobalInfoMessage("Info", "Application " + applicationName + " deleted");
|
||||
}
|
||||
}
|
||||
|
||||
/* *** getter / setter *** */
|
||||
public ApplicationEntity getCurrentApplication() {
|
||||
return currentApplication;
|
||||
}
|
||||
|
||||
public void setCurrentApplication(ApplicationEntity currentApplication) {
|
||||
this.currentApplication = currentApplication;
|
||||
}
|
||||
|
||||
public ApplicationEntity getEditApplication() {
|
||||
return editApplication;
|
||||
}
|
||||
|
||||
public void setEditApplication(ApplicationEntity editApplication) {
|
||||
this.editApplication = editApplication;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,32 +1,38 @@
|
||||
admin.loginPage=login.xhtml
|
||||
admin.indexPage=web/index.xhtml
|
||||
#admin.dateFormat=
|
||||
admin.loginPage=login.xhtml
|
||||
admin.indexPage=web/index.xhtml
|
||||
#admin.dateFormat=
|
||||
#admin.breadcrumbSize=5
|
||||
admin.renderMessages=true
|
||||
#admin.renderAjaxStatus=true
|
||||
## disable filter to redirect to login page - shiro security filter is already doing this
|
||||
admin.renderAjaxStatus=false
|
||||
admin.disableFilter=true
|
||||
#admin.renderBreadCrumb=true
|
||||
#admin.enableSlideMenu=true
|
||||
#admin.enableRipple=true
|
||||
#admin.rippleElements= .ripplelink,button.ui-button,.ui-selectlistbox-item,.ui-multiselectlistbox-item,.ui-selectonemenu-label,.ui-selectcheckboxmenu,\
|
||||
#.ui-autocomplete-dropdown, .ui-autocomplete-item ... (the list goes on)
|
||||
admin.skin=skin-purple-light
|
||||
#admin.autoShowNavbar=true
|
||||
#admin.ignoredResources=
|
||||
#admin.loadingImage=ajaxloadingbar.gif
|
||||
#admin.extensionLessUrls=false
|
||||
admin.renderControlSidebar=false
|
||||
#admin.controlSidebar.showOnMobile=false
|
||||
#admin.controlSidebar.leftMenuTemplate=true
|
||||
#admin.controlSidebar.fixedLayout=false
|
||||
#admin.controlSidebar.boxedLayout=false
|
||||
#admin.controlSidebar.sidebarCollapsed=false
|
||||
#admin.controlSidebar.expandOnHover=false
|
||||
#admin.controlSidebar.fixed=false
|
||||
#admin.controlSidebar.darkSkin=true
|
||||
#admin.rippleMobileOnly=true
|
||||
admin.renderBreadCrumb=false
|
||||
#admin.extensionLessUrls=false
|
||||
#admin.enableSlideMenu=true
|
||||
#admin.enableRipple=true
|
||||
#admin.rippleMobileOnly=true
|
||||
admin.renderMenuSearch=false
|
||||
## do not autohide
|
||||
#admin.renderControlSidebar=false
|
||||
#admin.controlSidebar.showOnMobile=false
|
||||
#admin.controlSidebar.leftMenuTemplate=true
|
||||
#admin.controlSidebar.fixedLayout=false
|
||||
#admin.controlSidebar.boxedLayout=false
|
||||
#admin.controlSidebar.sidebarCollapsed=false
|
||||
#admin.controlSidebar.expandOnHover=false
|
||||
#admin.controlSidebar.fixed=false
|
||||
admin.controlSidebar.darkSkin=false
|
||||
admin.autoHideMessages=false
|
||||
#admin.messagesHideTimeout=2500
|
||||
admin.renderFormAsterisks=true
|
||||
#admin.enableMobileHeader=true
|
||||
#admin.closableLoading=true
|
||||
#admin.messagesHideTimeout=2500
|
||||
admin.skin=skin-purple-light
|
||||
#admin.autoShowNavbar=true
|
||||
#admin.loadingImage=ajaxloadingbar.gif
|
||||
#admin.iconsEffect=true
|
||||
#admin.rippleElements=.ripplelink,button.ui-button:not([class*=ui-picklist]):not([class*=ui-orderlist]),li.ui-selectlistbox-item,li.ui-multiselectlistbox-item,.ui-selectonemenu-label,.ui-selectcheckboxmenu,\
|
||||
# .ui-autocomplete-dropdown, .ui-autocomplete-item, .ui-splitbutton-menubutton, .ui-splitbutton button.ui-button,.input-group, .ui-selectbooleanbutton, \
|
||||
# div.ui-button,.ui-chkbox-icon, .ui-link, .form-control, .btn, .ui-sortable-column,.ui-link, .ui-tabs-nav > li,.ui-selectonemenu-trigger, \
|
||||
# .ui-accordion-header, .treeview, .sidebar-toggle, .ui-radiobutton-icon, td[role="gridcell"], .ui-selectcheckboxmenu-trigger,.ui-paginator-page, \
|
||||
# .ui-panelmenu-header > a, a#layout-setup, .control-sidebar div#restore-defaults > a, .control-sidebar div.ui-selectbooleancheckbox .ui-chkbox, \
|
||||
# .control-sidebar span.control-sidebar-subheading > label, .control-sidebar a.skin-link, button.navbar-toggle, li.dropdown > a
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
</session-timeout>
|
||||
</session-config>
|
||||
<welcome-file-list>
|
||||
<welcome-file>web/index.xhtml</welcome-file>
|
||||
<welcome-file>index.xhtml</welcome-file>
|
||||
</welcome-file-list>
|
||||
<!-- Shiro Web Environment -->
|
||||
<listener>
|
||||
|
||||
23
account-ui/src/main/webapp/index.xhtml
Normal file
23
account-ui/src/main/webapp/index.xhtml
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||
xmlns:p="http://primefaces.org/ui"
|
||||
template="/resources/templates/template.xhtml"
|
||||
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||
xmlns:f="http://xmlns.jcp.org/jsf/core"
|
||||
xmlns:shiro="http://shiro.apache.org/tags">
|
||||
|
||||
<ui:define name="head">
|
||||
<meta http-equiv="refresh" content="0; URL=web/index.xhtml" />
|
||||
</ui:define>
|
||||
|
||||
<ui:define name="body">
|
||||
<p:panel id = "redirectPanel" header="Redirect" styleClass="card box-info">
|
||||
<h:form id="redirectForm">
|
||||
<p:link href="web/index.xhtml" value="Home" />
|
||||
</h:form>
|
||||
</p:panel>
|
||||
|
||||
</ui:define>
|
||||
|
||||
</ui:composition>
|
||||
@ -19,7 +19,7 @@
|
||||
<h:form id="applicationForm" prependId="false">
|
||||
|
||||
<div class="ui-g ui-fluid">
|
||||
<div class="col-sm-12 col-md-6">
|
||||
<div class="col-sm-12 col-md-4">
|
||||
<p:selectOneMenu id="applicationSelect" value="#{applicationView.currentApplication}" converter="omnifaces.SelectItemsConverter" required="true">
|
||||
<f:selectItems value="#{applicationView.allApplications}" var="app" itemLabel="#{app.applicationName}" itemValue="#{app}" />
|
||||
</p:selectOneMenu>
|
||||
@ -27,6 +27,12 @@
|
||||
<div class="col-sm-12 col-md-2">
|
||||
<p:commandButton value="Select" styleClass="btn-primary btn-solid}" actionListener="#{applicationView.selectApplication}" />
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-2">
|
||||
<p:commandButton value="Edit" id="editButton" icon="fa fa-pen"
|
||||
update="editDialog" oncomplete="PF('editDialogVar').show();"
|
||||
actionListener="#{applicationView.startEditApplication}" styleClass="btn-teal btn-block" />
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 col-md-2">
|
||||
<p:commandButton value="New" id="newButton" icon="fa fa-plus"
|
||||
update="editDialog" oncomplete="PF('editDialogVar').show();"
|
||||
@ -52,11 +58,22 @@
|
||||
</p:messages>
|
||||
|
||||
<div class="ui-g ui-fluid">
|
||||
<div class="col-sm-12 col-md-3">
|
||||
<p:outputLabel for="applicationId" value="ID" />
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-9">
|
||||
<c:if test="#{empty applicationView.editApplication.id}">
|
||||
<p:inputText id="applicationId" value="#{applicationView.editApplication.id}" required="false"/>
|
||||
</c:if>
|
||||
<c:if test="#{!empty applicationView.editApplication.id}">
|
||||
<p:outputLabel id="applicationId" value="#{applicationView.editApplication.id}" />
|
||||
</c:if>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-3">
|
||||
<p:outputLabel for="applicationName" value="Application name" />
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-6">
|
||||
<p:inputText id="applicationName" value="#{applicationView.editApplication.applicationName}">
|
||||
<div class="col-sm-12 col-md-9">
|
||||
<p:inputText id="applicationName" value="#{applicationView.editApplication.applicationName}" required="true">
|
||||
<f:validator validatorId="uniqueApplicationValidator"/>
|
||||
</p:inputText>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user