Commit 2e1e4b58 by Tuomas Riihimäki

Merge branch 'master' of dev.intra.insomnia.fi:/data/bortal

2 parents 5e48f8b6 5489609f
......@@ -10,6 +10,8 @@ import fi.insomnia.bortal.model.Role;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
......@@ -21,9 +23,24 @@ public class RoleBean implements RoleBeanLocal {
@EJB
private RoleFacade roleFacade;
private static final Logger logger = LoggerFactory.getLogger(RoleBean.class);
public List<Role> listRoles() {
return roleFacade.findAll();
}
public void mergeChanges(Role role) {
roleFacade.merge(role);
}
public Role create(Role role) {
roleFacade.create(role);
return role;
}
// Add business logic below. (Right-click in editor and choose
// "Insert Code > Add Business Method")
......
......@@ -17,5 +17,9 @@ import javax.ejb.Local;
public interface RoleBeanLocal {
public List<Role> listRoles();
public void mergeChanges(Role role);
public Role create(Role role);
}
......@@ -81,9 +81,24 @@
<to-view-id>/NotImplementedYet.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/resources/tools/role/edit.xhtml</from-view-id>
<navigation-case>
<from-outcome>roleSaved</from-outcome>
<to-view-id>/modulePossibleReturnValues.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/resources/tools/role/create.xhtml</from-view-id>
<navigation-case>
<from-outcome>roleCreated</from-outcome>
<to-view-id>/modulePossibleReturnValues.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
<?xml version='1.0' encoding='UTF-8' ?>
<!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:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:tools="http://java.sun.com/jsf/composite/tools"
xmlns:role="http://java.sun.com/jsf/composite/tools/role">
<composite:interface>
</composite:interface>
<composite:implementation>
<h:form>
<tools:canWrite target="roleManagement">
<f:facet name="errorMessage">
<h:outputText value="#{i18n['nasty.user']}" />
</f:facet>
<ui:include src="form.xhtml" />
<h:commandButton value="#{i18n['create']}" action="#{roleView.create}" />
</tools:canWrite>
</h:form>
</composite:implementation>
</html>
<?xml version='1.0' encoding='UTF-8' ?>
<!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:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:tools="http://java.sun.com/jsf/composite/tools"
xmlns:role="http://java.sun.com/jsf/composite/tools/role">
<composite:interface>
</composite:interface>
<composite:implementation>
<h:form>
<tools:canWrite target="roleManagement">
<f:facet name="errorMessage">
<h:outputText value="#{i18n['nasty.user']}" />
</f:facet>
<ui:include src="form.xhtml" />
<h:commandButton value="#{i18n['save']}" action="#{roleView.save}" />
</tools:canWrite>
</h:form>
</composite:implementation>
</html>
<?xml version='1.0' encoding='UTF-8' ?>
<!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:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:tools="http://java.sun.com/jsf/composite/tools">
<ui:composition>
<h:panelGrid>
<h:outputText value="#{i18n['role.name']}" /><h:inputText value="#{roleView.role.name}" />
</h:panelGrid>
</ui:composition>
</html>
......@@ -2,54 +2,55 @@
<!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:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:tools="http://java.sun.com/jsf/composite/tools">
<composite:interface>
</composite:interface>
<composite:implementation>
<h:form>
<tools:canRead target="roleManagement">
<h:dataTable
border="1"
id="user"
value="#{roleView.roles}"
var="role">
<h:column>
<f:facet name="header">
<h:outputText value="#" />
</f:facet>
<h:outputText value="#{role.id}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['role.name']}" />
</f:facet>
<h:outputText value="#{role.name}" />
</h:column>
<tools:canWrite target="roleManagement">
<h:column>
<f:facet name="header">
<h:outputText value="Edit" />
</f:facet>
<h:commandButton
action="#{roleView.edit()}"
value="Edit" />
</h:column>
</tools:canWrite>
</h:dataTable>
</tools:canRead>
</h:form>
</composite:implementation>
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:tools="http://java.sun.com/jsf/composite/tools">
<composite:interface>
</composite:interface>
<composite:implementation>
<h:form>
<tools:canRead target="roleManagement">
<h:dataTable
border="1"
id="user"
value="#{roleView.roles}"
var="role">
<h:column>
<f:facet name="header">
<h:outputText value="#" />
</f:facet>
<h:outputText value="#{role.id}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['role.name']}" />
</f:facet>
<h:outputText value="#{role.name}" />
</h:column>
<tools:canWrite target="roleManagement">
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['edit']}" />
</f:facet>
<h:commandButton
action="#{roleView.edit()}"
value="Edit" />
</h:column>
</tools:canWrite>
</h:dataTable>
</tools:canRead>
</h:form>
</composite:implementation>
</html>
......@@ -2,15 +2,16 @@
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.view;
import fi.insomnia.bortal.beans.RoleBeanLocal;
import fi.insomnia.bortal.beans.SecurityBeanLocal;
import fi.insomnia.bortal.exceptions.PermissionDeniedException;
import fi.insomnia.bortal.handler.SessionHandler;
import fi.insomnia.bortal.model.Role;
import fi.insomnia.bortal.model.User;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.SessionScoped;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
......@@ -21,18 +22,22 @@ import org.slf4j.LoggerFactory;
*
* @author tuukka
*/
@ManagedBean(name="roleView")
@ManagedBean(name = "roleView")
@SessionScoped
public class RoleView {
Role role = new Role();
DataModel<Role> items;
@ManagedProperty("#{sessionHandler}")
private SessionHandler sessionhandler;
@EJB
private RoleBeanLocal roleBean;
private static final Logger logger = LoggerFactory.getLogger(RoleView.class);
@EJB
private SecurityBeanLocal securitybean;
private Role role = new Role();
DataModel<Role> items;
public DataModel<Role> getRoles() {
items = new ListDataModel<Role>(roleBean.listRoles());
logger.info("Fetching roles. Found {}", items.getRowCount());
......@@ -40,9 +45,33 @@ public class RoleView {
return items;
}
public String save() {
if (!sessionhandler.canWrite("roleManagement")) {
// Give message to administration what happened here.
throw new PermissionDeniedException(securitybean, getSessionhandler().getUser(), "User " + getSessionhandler().getUser() + " does not have permission to modify role!");
}
roleBean.mergeChanges(role);
return "roleSaved";
}
public String create() {
if (!sessionhandler.canWrite("roleManagement")) {
// Give message to administration what happened here.
throw new PermissionDeniedException(securitybean, getSessionhandler().getUser(), "User " + getSessionhandler().getUser() + " does not have permission to create role!");
}
role = roleBean.create(role);
return "roleCreated";
}
public String edit() {
role = items.getRowData();
setRole(items.getRowData());
return "roleEdit";
}
......@@ -51,4 +80,31 @@ public class RoleView {
public RoleView() {
}
/**
* @return the role
*/
public Role getRole() {
return role;
}
/**
* @param role the role to set
*/
public void setRole(Role role) {
this.role = role;
}
/**
* @return the sessionhandler
*/
public SessionHandler getSessionhandler() {
return sessionhandler;
}
/**
* @param sessionhandler the sessionhandler to set
*/
public void setSessionhandler(SessionHandler sessionhandler) {
this.sessionhandler = sessionhandler;
}
}
......@@ -17,3 +17,4 @@ fallbackstr="fallback default"
teststr=default locale test
defaultstr="Something default..."
logout=H\u00E4ivy
nasty.user=paha k\u00E4ytt\u00E4j\u00E4 ei yrit\u00E4 haxoroida meid\u00E4n softaa. Kts.
......@@ -17,3 +17,4 @@ fallbackstr="fallback default"
teststr=default locale test
defaultstr="Something default..."
logout=H\u00E4ivy
nasty.user=paha k\u00E4ytt\u00E4j\u00E4 ei yrit\u00E4 haxoroida meid\u00E4n softaa. Kts.
......@@ -17,3 +17,4 @@ fallbackstr="fallback default"
teststr=default locale test
defaultstr="Something default..."
logout=H\u00E4ivy
nasty.user=paha k\u00E4ytt\u00E4j\u00E4 ei yrit\u00E4 haxoroida meid\u00E4n softaa. Kts.
......@@ -17,3 +17,4 @@ fallbackstr="fallback default"
teststr=default locale test
defaultstr="Something default..."
logout=H\u00E4ivy
nasty.user=paha k\u00E4ytt\u00E4j\u00E4 ei yrit\u00E4 haxoroida meid\u00E4n softaa. Kts.
......@@ -16,3 +16,4 @@ user.validate.notUniqueUsername=i18n K\u00E4ytt\u00E4j\u00E4tunnus on jo olemass
teststr=brlocale test
fallbackstr=InsomniaSpecific fallback
logout=H\u00E4ivy
nasty.user=paha k\u00E4ytt\u00E4j\u00E4 ei yrit\u00E4 haxoroida meid\u00E4n softaa. Kts.
teststr=XII locale test
logout=H\u00E4ivy
nasty.user=paha k\u00E4ytt\u00E4j\u00E4 ei yrit\u00E4 haxoroida meid\u00E4n softaa. Kts.
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry exported="true" kind="lib" path="commons-codec-1.4.jar" sourcepath="commons-codec-1.4-sources.jar">
<attributes>
<attribute name="javadoc_location" value="jar:platform:/resource/commons-codec-1.4/commons-codec-1.4-javadoc.jar!/"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>commons-codec-1.4</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
#Sun Mar 21 05:38:16 EET 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
Apache Commons Codec
Copyright 2002-2009 The Apache Software Foundation
This product includes software developed by
The Apache Software Foundation (http://www.apache.org/).
--------------------------------------------------------------------------------
src/test/org/apache/commons/codec/language/DoubleMetaphoneTest.java contains
test data from http://aspell.sourceforge.net/test/batch0.tab.
Copyright (C) 2002 Kevin Atkinson (kevina@gnu.org). Verbatim copying
and distribution of this entire article is permitted in any medium,
provided this notice is preserved.
--------------------------------------------------------------------------------
$Id: RELEASE-NOTES.txt 801709 2009-08-06 16:31:27Z niallp $
Commons Codec Package
Version 1.4
Release Notes
http://commons.apache.org/codec/
The codec package contains simple encoder and decoders for various formats
such as Base64 and Hexadecimal. In addition to these widely used encoders and
decoders, the codec package also maintains a collection of phonetic encoding
utilities.
Compatibility
o Codec 1.4 is binary compatible with Codec 1.3
o Codec 1.4 has a minimum requirement of JDK 1.4
Changes in this version include:
New Features:
o [CODEC-60] Implement Caverphone.
o [CODEC-52] Digest on InputStreams.
o [CODEC-39] DigestUtils: Add methods for SHA-256, SHA-384, and SHA-512.
o [CODEC-69] Streaming Base64 (Base64InputStream and Base64OutputStream added).
o [CODEC-59] Add methods to Base64 which work with String instead of byte[]
Fixed bugs:
o [CODEC-77] Base64 bug with empty input (new byte[0]).
o [CODEC-72] Soundex and RefinedSoundex issues with character arrays.
o [CODEC-71] Base64.isArrayByteBase64() method is inefficient for large byte arrays.
o [CODEC-70] Thread safety and malicious code safety improvements.
o [CODEC-68] isBase64 throws ArrayIndexOutOfBoundsException on some non-BASE64 bytes.
o [CODEC-65] Fix case-insensitive string handling.
o [CODEC-61] Base64.encodeBase64() throws NegativeArraySizeException on large files.
o [CODEC-58] Character set used by Base64 not documented.
o [CODEC-56] RefinedSoundex creates instance before al fields have been initialized.
o [CODEC-51] Test failures in SoundexTest
o [CODEC-10] Using US_ENGLISH in Soundex caused an NullPointerException.
o [CODEC-6] Source tarball spews files all over the place.
o [CODEC-22] Base64.isArrayByteBase64() throws an ArrayIndexOutOfBoundsException for negative octets
o [CODEC-78] Base64: Improve Code Coverage
o [CODEC-81] Base64's new constructor parameters ignored
o [CODEC-83] Improve Double Metaphone test coverage
o [CODEC-84] Double Metaphone bugs in alternative encoding
o [CODEC-73] Make string2byte conversions indepedent of platform default encoding
Changes:
o [CODEC-75] Make Base64 URL-safe
o [CODEC-74] Allow for uppercase letters output in Hex.encodeHex().
o [CODEC-40] Add crypto-compatible BigInteger encoding support to Base64.
Have fun!
-The commons-codec team
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!