Merge branch 'master' of https://gitbox.apache.org/repos/asf/turbine-archetypes
diff --git a/src/main/resources/archetype-resources/pom.xml b/src/main/resources/archetype-resources/pom.xml
index 2d2bf81..68f298d 100644
--- a/src/main/resources/archetype-resources/pom.xml
+++ b/src/main/resources/archetype-resources/pom.xml
@@ -72,14 +72,17 @@
</testResources>
<plugins>
<!-- test will not fail in turbine 4.0.1 -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.20.1</version>
- <configuration>
- <skipTests>#var("skipTests")</skipTests>
- </configuration>
- </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>3.0.0-M2</version>
+ <configuration>
+ <skipTests>#var("skipTests")</skipTests>
+ <!--default setting is forkCount=1/reuseForks=true -->
+ <reuseForks>false</reuseForks>
+ <forkCount>1</forkCount>
+ </configuration>
+ </plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
@@ -240,6 +243,8 @@
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
+ <!-- latest one that seems to be working,
+ v20181111 and v20181114 coming up not found on maven central -->
<version>9.4.12.v20180830</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
@@ -320,7 +325,7 @@
<dependency>
<groupId>org.apache.fulcrum</groupId>
<artifactId>fulcrum-yaafi</artifactId>
- <version>1.0.8-SNAPSHOT</version>
+ <version>1.0.8</version>
</dependency>
<!-- if using intake -->
<dependency>
@@ -336,11 +341,6 @@
<artifactId>fulcrum-cache</artifactId>
<version>1.1.0</version>
</dependency>
- <dependency>
- <groupId>org.apache.fulcrum</groupId>
- <artifactId>fulcrum-upload</artifactId>
- <version>1.0.6-SNAPSHOT</version>
- </dependency>
<dependency>
<groupId>org.apache.fulcrum</groupId>
<artifactId>fulcrum-security-memory</artifactId>
@@ -396,7 +396,7 @@
<dependency>
<groupId>org.apache.fulcrum</groupId>
<artifactId>fulcrum-testcontainer</artifactId>
- <version>1.0.8-SNAPSHOT</version>
+ <version>1.0.8</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -407,8 +407,8 @@
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
<log4j2.version>2.11.1</log4j2.version>
<torque.version>4.0</torque.version>
- <fulcrum.json>2.0.0-SNAPSHOT</fulcrum.json>
- <fulcrum.intake>2.0.0-SNAPSHOT</fulcrum.intake>
+ <fulcrum.json>2.0.0</fulcrum.json>
+ <fulcrum.intake>2.0.0</fulcrum.intake>
<fulcrum.security>1.1.3-SNAPSHOT</fulcrum.security>
<turbine.core>5.0-SNAPSHOT</turbine.core>
<skipTests>true</skipTests>
diff --git a/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/FluxAction.java b/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/FluxAction.java
index 3ba889e..a95fbb3 100644
--- a/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/FluxAction.java
+++ b/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/FluxAction.java
@@ -1,7 +1,7 @@
package ${package}.flux.modules.actions;
/*
- * Copyright 2001-2017 The Apache Software Foundation.
+ * Copyright 2001-2019 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
@@ -53,9 +53,11 @@
* flux.admin.role which you should define
*/
@Override
- protected boolean isAuthorized(PipelineData data) throws Exception {
+ protected boolean isAuthorized(PipelineData pipelineData) throws Exception {
boolean isAuthorized = false;
+ RunData data = (RunData) pipelineData;
+
/*
* Grab the Flux Admin role listed in the Flux.properties file that is included
* in the the standard TurbineResources.properties file.
@@ -63,15 +65,15 @@
String fluxAdminRole = Turbine.getConfiguration().getString("flux.admin.role");
// Get the Turbine ACL implementation
- TurbineAccessControlList acl = getRunData(data).getACL();
+ TurbineAccessControlList acl = data.getACL();
if (acl == null || !(acl.hasRole(fluxAdminRole))) {
String msg = localizationService.getString(localizationService.getDefaultBundleName(),
localizationService.getLocale(((RunData) data).getRequest()), "no_permission");
- getRunData(data).setMessage(msg);
+ data.setMessage(msg);
- getRunData(data).setScreenTemplate("Login.vm");
+ data.setScreenTemplate("Login.vm");
isAuthorized = false;
} else if (acl.hasRole(fluxAdminRole)) {
isAuthorized = true;
@@ -90,8 +92,9 @@
* @exception Exception,
* a generic exception.
*/
- public void doPerform(PipelineData data, Context context) throws Exception {
- User user = getRunData(data).getUser();
+ public void doPerform(PipelineData pipelineData, Context context) throws Exception {
+ RunData data = (RunData) pipelineData;
+ User user = data.getUser();
context.put("user", user);
}
}
diff --git a/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/FluxLogin.java b/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/FluxLogin.java
index 198d398..2482041 100644
--- a/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/FluxLogin.java
+++ b/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/FluxLogin.java
@@ -1,7 +1,7 @@
package ${package}.flux.modules.actions;
/*
- * Copyright 2001-2017 The Apache Software Foundation.
+ * Copyright 2001-2019 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
@@ -66,7 +66,7 @@
@Override
public void doPerform(PipelineData pipelineData) throws FulcrumSecurityException {
- RunData data = getRunData(pipelineData);
+ RunData data = (RunData)pipelineData;
String username = data.getParameters().getString(FluxLogin.CGI_USERNAME, "");
if (StringUtils.isEmpty(username)) {
diff --git a/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/FluxLogout.java b/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/FluxLogout.java
index 60972d0..a254d72 100644
--- a/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/FluxLogout.java
+++ b/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/FluxLogout.java
@@ -1,7 +1,7 @@
package ${package}.flux.modules.actions;
/*
- * Copyright 2001-2017 The Apache Software Foundation.
+ * Copyright 2001-2019 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
@@ -32,7 +32,7 @@
* specified in the resources file
*
*/
-public class FluxLogout extends Action {
+public class FluxLogout implements Action {
/** Injected service instance */
@TurbineService
@@ -59,10 +59,9 @@
* @exception FulcrumSecurityException
* a problem occurred in the security service.
*/
- @Override
- public void doPerform(PipelineData pipelineData) throws FulcrumSecurityException {
-
- RunData data = getRunData(pipelineData);
+ public void doPerform(PipelineData pipelineData) throws FulcrumSecurityException
+ {
+ RunData data = (RunData) pipelineData;
// Session validator did not run, so RunData is not populated
User user = data.getUserFromSession();
diff --git a/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/SecureAction.java b/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/SecureAction.java
index 8020f35..3a73b30 100644
--- a/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/SecureAction.java
+++ b/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/SecureAction.java
@@ -1,7 +1,7 @@
package ${package}.flux.modules.actions;
/*
- * Copyright 2001-2017 The Apache Software Foundation.
+ * Copyright 2001-2019 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
@@ -64,9 +64,8 @@
@Override
protected boolean isAuthorized(PipelineData pipelineData) throws Exception {
- RunData data = getRunData(pipelineData);
-
boolean isAuthorized = false;
+ RunData data = (RunData) pipelineData;
/*
* Grab the Flux Admin role listed in the Flux.properties file that is included
@@ -109,8 +108,10 @@
* @exception Exception,
* a generic exception.
*/
- public void doPerform(PipelineData data, Context context) throws Exception {
- User user = getRunData(data).getUser();
+ public void doPerform(PipelineData pipelineData, Context context) throws Exception
+ {
+ RunData data = (RunData) pipelineData;
+ User user = data.getUser();
context.put("user", user);
}
}
diff --git a/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/group/FluxGroupAction.java b/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/group/FluxGroupAction.java
index deeb355..24dc6c0 100644
--- a/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/group/FluxGroupAction.java
+++ b/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/group/FluxGroupAction.java
@@ -1,7 +1,7 @@
package ${package}.flux.modules.actions.group;
/*
- * Copyright 2001-2017 The Apache Software Foundation.
+ * Copyright 2001-2019 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
@@ -61,7 +61,7 @@
* a generic exception.
*/
public void doInsert(PipelineData pipelineData, Context context) throws Exception {
- RunData data = getRunData(pipelineData);
+ RunData data = (RunData) pipelineData;
String name = data.getParameters().getString(GROUP_ID);
if (!StringUtils.isEmpty(name)) {
@@ -101,7 +101,7 @@
* a generic exception.
*/
public void doUpdate(PipelineData pipelineData, Context context) throws Exception {
- RunData data = getRunData(pipelineData);
+ RunData data = (RunData) pipelineData;
String groupName = data.getParameters().getString("oldName");
if (!StringUtils.isEmpty(groupName)) {
Group group = security.getGroupByName(groupName);
@@ -135,7 +135,7 @@
*/
public void doDelete(PipelineData pipelineData, Context context) throws Exception {
- RunData data = getRunData(pipelineData);
+ RunData data = (RunData) pipelineData;
try {
Group group = security.getGroupByName(data.getParameters().getString(GROUP_ID));
@@ -164,7 +164,7 @@
* a generic exception.
*/
public void doPerform(PipelineData pipelineData, Context context) throws Exception {
- RunData data = getRunData(pipelineData);
+ RunData data = (RunData) pipelineData;
log.info("Running do perform!");
data.setMessage("Can't find the requested action!");
}
diff --git a/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/permission/FluxPermissionAction.java b/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/permission/FluxPermissionAction.java
index c92c914..bb9385d 100644
--- a/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/permission/FluxPermissionAction.java
+++ b/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/permission/FluxPermissionAction.java
@@ -1,7 +1,7 @@
package ${package}.flux.modules.actions.permission;
/*
- * Copyright 2001-2017 The Apache Software Foundation.
+ * Copyright 2001-2019 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
@@ -65,7 +65,7 @@
*/
public void doInsert(PipelineData pipelineData, Context context) throws Exception {
- RunData data = getRunData(pipelineData);
+ RunData data = (RunData) pipelineData;
String name = data.getParameters().getString(PERM_ID);
if (!StringUtils.isEmpty(name)) {
// create the permission
@@ -93,7 +93,7 @@
* a generic exception.
*/
public void doUpdate(PipelineData pipelineData, Context context) throws Exception {
- RunData data = getRunData(pipelineData);
+ RunData data = (RunData) pipelineData;
String old_name = data.getParameters().getString("oldName");
String name = data.getParameters().getString(PERM_ID);
@@ -130,7 +130,7 @@
* a generic exception.
*/
public void doDelete(PipelineData pipelineData, Context context) throws Exception {
- RunData data = getRunData(pipelineData);
+ RunData data = (RunData) pipelineData;
try {
String permName = data.getParameters().getString(PERM_ID);
@@ -168,7 +168,7 @@
* a generic exception.
*/
public void doPerform(PipelineData pipelineData, Context context) throws Exception {
- RunData data = getRunData(pipelineData);
+ RunData data = (RunData) pipelineData;
log.info("Running do perform!");
data.setMessage("Can't find the requested action!");
}
diff --git a/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/role/FluxRoleAction.java b/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/role/FluxRoleAction.java
index 3e94e9e..0d4f657 100644
--- a/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/role/FluxRoleAction.java
+++ b/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/role/FluxRoleAction.java
@@ -1,7 +1,7 @@
package ${package}.flux.modules.actions.role;
/*
- * Copyright 2001-2017 The Apache Software Foundation.
+ * Copyright 2001-2019 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
@@ -19,7 +19,6 @@
import java.util.Iterator;
import org.apache.commons.configuration2.Configuration;
-import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.fulcrum.security.entity.Permission;
@@ -29,6 +28,7 @@
import org.apache.fulcrum.security.util.EntityExistsException;
import org.apache.fulcrum.security.util.PermissionSet;
import org.apache.fulcrum.security.util.UnknownEntityException;
+import org.apache.commons.lang3.StringUtils;
import org.apache.torque.criteria.Criteria;
import org.apache.turbine.annotation.TurbineConfiguration;
import org.apache.turbine.annotation.TurbineService;
@@ -39,6 +39,7 @@
import ${package}.flux.modules.actions.FluxAction;
+
/**
* Action to manager roles in Turbine.
*
@@ -57,7 +58,7 @@
private Configuration conf;
public void doInsert(PipelineData pipelineData, Context context) throws Exception {
- RunData data = getRunData(pipelineData);
+ RunData data = (RunData) pipelineData;
Role role = security.getRoleInstance();
data.getParameters().setProperties(role);
@@ -91,7 +92,7 @@
* a generic exception.
*/
public void doUpdate(PipelineData pipelineData, Context context) throws Exception {
- RunData data = getRunData(pipelineData);
+ RunData data = (RunData) pipelineData;
Role role = security.getRoleByName(data.getParameters().getString("oldName"));
String name = data.getParameters().getString(ROLE_ID);
if (role != null && !StringUtils.isEmpty(name)) {
@@ -117,7 +118,7 @@
* a generic exception.
*/
public void doDelete(PipelineData pipelineData, Context context) throws Exception {
- RunData data = getRunData(pipelineData);
+ RunData data = (RunData) pipelineData;
try {
// find the role
@@ -158,7 +159,7 @@
*/
public void doPermissions(PipelineData pipelineData, Context context) throws Exception {
- RunData data = getRunData(pipelineData);
+ RunData data = (RunData) pipelineData;
/*
* Grab the role we are trying to update. Always not null
*/
@@ -215,7 +216,7 @@
*/
public void doPerform(PipelineData pipelineData, Context context) throws Exception {
log.info("Running do perform!");
- getRunData(pipelineData).setMessage("Can't find the requested action!");
+ ( (RunData) pipelineData).setMessage("Can't find the requested action!");
}
/**
diff --git a/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/user/FluxUserAction.java b/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/user/FluxUserAction.java
index d41db9a..074e2e2 100644
--- a/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/user/FluxUserAction.java
+++ b/src/main/resources/archetype-resources/src/main/java/flux/modules/actions/user/FluxUserAction.java
@@ -1,7 +1,7 @@
package ${package}.flux.modules.actions.user;
/*
- * Copyright 2001-2017 The Apache Software Foundation.
+ * Copyright 2001-2019 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
@@ -49,7 +49,7 @@
* system.
*/
public void doInsert(PipelineData pipelineData, Context context) throws Exception {
- RunData data = getRunData(pipelineData);
+ RunData data = (RunData) pipelineData;
/*
* Grab the username entered in the form.
@@ -110,7 +110,7 @@
* before allowing the user info to be update in the database.
*/
public void doUpdate(PipelineData pipelineData, Context context) throws Exception {
- RunData data = getRunData(pipelineData);
+ RunData data = (RunData) pipelineData;
String username = data.getParameters().getString("username");
if (!StringUtils.isEmpty(username)) {
if (security.accountExists(username)) {
@@ -155,13 +155,18 @@
public void doDelete(PipelineData pipelineData, Context context) throws Exception {
try {
- RunData data = getRunData(pipelineData);
+ RunData data = (RunData) pipelineData;
String username = data.getParameters().getString("username");
if (!StringUtils.isEmpty(username)) {
if (security.accountExists(username)) {
// find the user object and remove using security mgr
User user = security.getUser(username);
+
+ // get the turbine user id
+ int id = (int) user.getId();
+
+ // remove the turbine user
security.removeUser(user);
} else {
@@ -178,7 +183,7 @@
* Update the roles that are to assigned to a user for a project.
*/
public void doRoles(PipelineData pipelineData, Context context) throws Exception {
- RunData data = getRunData(pipelineData);
+ RunData data = (RunData) pipelineData;
try {
/*
@@ -255,7 +260,7 @@
*/
public void doPerform(PipelineData pipelineData, Context context) throws Exception {
log.info("Running do perform!");
- getRunData(pipelineData).setMessage("Can't find the requested action!");
+ ( (RunData) pipelineData).setMessage("Can't find the requested action!");
}
}
diff --git a/src/main/resources/archetype-resources/src/main/java/flux/modules/screens/FluxError.java b/src/main/resources/archetype-resources/src/main/java/flux/modules/screens/FluxError.java
index dca782d..72123bf 100644
--- a/src/main/resources/archetype-resources/src/main/java/flux/modules/screens/FluxError.java
+++ b/src/main/resources/archetype-resources/src/main/java/flux/modules/screens/FluxError.java
@@ -1,7 +1,7 @@
package ${package}.flux.modules.screens;
/*
- * Copyright 2001-2017 The Apache Software Foundation.
+ * Copyright 2001-2019 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
diff --git a/src/main/resources/archetype-resources/src/main/java/flux/modules/screens/FluxIndex.java b/src/main/resources/archetype-resources/src/main/java/flux/modules/screens/FluxIndex.java
index 115252c..0836b25 100644
--- a/src/main/resources/archetype-resources/src/main/java/flux/modules/screens/FluxIndex.java
+++ b/src/main/resources/archetype-resources/src/main/java/flux/modules/screens/FluxIndex.java
@@ -1,7 +1,7 @@
package ${package}.flux.modules.screens;
/*
- * Copyright 2001-2017 The Apache Software Foundation.
+ * Copyright 2001-2019 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
@@ -61,9 +61,8 @@
@Override
protected boolean isAuthorized(PipelineData pipelineData) throws Exception {
- RunData data = getRunData(pipelineData);
-
boolean isAuthorized = false;
+ RunData data = (RunData) pipelineData;
/*
* Grab the Flux Admin role listed in the Flux.properties file that is included
diff --git a/src/main/resources/archetype-resources/src/main/java/flux/modules/screens/FluxScreen.java b/src/main/resources/archetype-resources/src/main/java/flux/modules/screens/FluxScreen.java
index 772eaeb..bf58332 100644
--- a/src/main/resources/archetype-resources/src/main/java/flux/modules/screens/FluxScreen.java
+++ b/src/main/resources/archetype-resources/src/main/java/flux/modules/screens/FluxScreen.java
@@ -1,7 +1,7 @@
package ${package}.flux.modules.screens;
/*
- * Copyright 2001-2017 The Apache Software Foundation.
+ * Copyright 2001-2019 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@
import org.apache.turbine.modules.screens.VelocitySecureScreen;
import org.apache.turbine.pipeline.PipelineData;
import org.apache.turbine.services.security.SecurityService;
+import org.apache.turbine.util.RunData;
import org.apache.velocity.context.Context;
/**
@@ -65,9 +66,10 @@
}
@Override
- protected boolean isAuthorized(PipelineData data) throws Exception {
+ protected boolean isAuthorized(PipelineData pipelineData) throws Exception {
boolean isAuthorized = false;
-
+ RunData data = (RunData) pipelineData;
+
/*
* Grab the Flux Admin role listed in the Flux.properties file that is included
* in the the standard TurbineResources.properties file.
@@ -75,18 +77,18 @@
String fluxAdminRole = Turbine.getConfiguration().getString("flux.admin.role");
// Get the Turbine ACL implementation
- TurbineAccessControlList acl = getRunData(data).getACL();
+ TurbineAccessControlList acl = data.getACL();
if (acl == null) {
// commons configuration getProperty: prefix removed, the key for the value ..
// is an empty string, the result an object
- getRunData(data).setScreenTemplate((String) templateLogin.getProperty(""));
+ data.setScreenTemplate((String) templateLogin.getProperty(""));
isAuthorized = false;
} else if (acl.hasRole(fluxAdminRole)) {
isAuthorized = true;
} else {
- getRunData(data).setScreenTemplate((String) templateHomepage.getProperty(""));
- getRunData(data).setMessage("You do not have access to this part of the site.");
+ data.setScreenTemplate((String) templateHomepage.getProperty(""));
+ data.setMessage("You do not have access to this part of the site.");
isAuthorized = false;
}
return isAuthorized;
diff --git a/src/main/resources/archetype-resources/src/main/java/flux/modules/screens/group/Default.java b/src/main/resources/archetype-resources/src/main/java/flux/modules/screens/group/Default.java
index 5360e93..beb2dcb 100644
--- a/src/main/resources/archetype-resources/src/main/java/flux/modules/screens/group/Default.java
+++ b/src/main/resources/archetype-resources/src/main/java/flux/modules/screens/group/Default.java
@@ -1,7 +1,7 @@
package ${package}.flux.modules.screens.group;
/*
- * Copyright 2001-2017 The Apache Software Foundation.
+ * Copyright 2001-2019 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
diff --git a/src/main/resources/archetype-resources/src/main/java/flux/modules/screens/permission/Default.java b/src/main/resources/archetype-resources/src/main/java/flux/modules/screens/permission/Default.java
index 4d27c70..7a2878b 100644
--- a/src/main/resources/archetype-resources/src/main/java/flux/modules/screens/permission/Default.java
+++ b/src/main/resources/archetype-resources/src/main/java/flux/modules/screens/permission/Default.java
@@ -1,7 +1,7 @@
package ${package}.flux.modules.screens.permission;
/*
- * Copyright 2001-2017 The Apache Software Foundation.
+ * Copyright 2001-2019 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
diff --git a/src/main/resources/archetype-resources/src/main/java/flux/modules/screens/role/Default.java b/src/main/resources/archetype-resources/src/main/java/flux/modules/screens/role/Default.java
index d4d8962..f22b6a5 100644
--- a/src/main/resources/archetype-resources/src/main/java/flux/modules/screens/role/Default.java
+++ b/src/main/resources/archetype-resources/src/main/java/flux/modules/screens/role/Default.java
@@ -1,7 +1,7 @@
package ${package}.flux.modules.screens.role;
/*
- * Copyright 2001-2017 The Apache Software Foundation.
+ * Copyright 2001-2019 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
diff --git a/src/main/resources/archetype-resources/src/main/java/flux/modules/screens/user/Default.java b/src/main/resources/archetype-resources/src/main/java/flux/modules/screens/user/Default.java
index 436ff17..eb711dc 100644
--- a/src/main/resources/archetype-resources/src/main/java/flux/modules/screens/user/Default.java
+++ b/src/main/resources/archetype-resources/src/main/java/flux/modules/screens/user/Default.java
@@ -1,7 +1,7 @@
package ${package}.flux.modules.screens.user;
/*
- * Copyright 2001-2017 The Apache Software Foundation.
+ * Copyright 2001-2019 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
diff --git a/src/main/resources/archetype-resources/src/main/java/flux/tools/FluxTool.java b/src/main/resources/archetype-resources/src/main/java/flux/tools/FluxTool.java
index 1bb6b70..1bf49f5 100644
--- a/src/main/resources/archetype-resources/src/main/java/flux/tools/FluxTool.java
+++ b/src/main/resources/archetype-resources/src/main/java/flux/tools/FluxTool.java
@@ -40,7 +40,6 @@
import org.apache.turbine.services.pull.ApplicationTool;
import org.apache.turbine.services.security.SecurityService;
import org.apache.turbine.util.RunData;
-import org.apache.turbine.util.template.SelectorBox;
/**
* The pull api for flux templates
@@ -207,22 +206,29 @@
/**
*/
- public SelectorBox getFieldList() throws Exception {
- Object[] names = { "username", "firstname", "middlename", "lastname" };
- Object[] values = { "Username", "First Name", "Middle Name", "Last Name" };
- return new SelectorBox("fieldList", names, values);
+ public String getFieldList() throws Exception {
+ StringBuilder selectorBox = new StringBuilder();
+ selectorBox.append("<select name=\"fieldList\">");
+ selectorBox.append("<option value=\"username\">Username</option>");
+ selectorBox.append("<option value=\"firstname\">First Name</option>");
+ selectorBox.append("<option value=\"middlename\">Middle Name</option>");
+ selectorBox.append("<option value=\"lastname\">Last Name</option>");
+ selectorBox.append("</select>");
+ return selectorBox.toString();
}
/**
* This is a tie to the DB implementation something should be added the
* pluggable pieces to allow decent parameterized searching.
*/
- public SelectorBox getUserFieldList() throws Exception {
-
- Object[] names = { TurbineUserPeer.LOGIN_NAME, TurbineUserPeer.FIRST_NAME, TurbineUserPeer.LAST_NAME };
- Object[] values = { "User Name", "First Name", "Last Name" };
-
- return new SelectorBox("fieldList", names, values);
+ public String getUserFieldList() throws Exception {
+ StringBuilder selectorBox = new StringBuilder();
+ selectorBox.append("<select name=\"fieldList\">");
+ selectorBox.append("<option value=\"" + TurbineUserPeer.LOGIN_NAME + "\">User Name</option>");
+ selectorBox.append("<option value=\"" + TurbineUserPeer.FIRST_NAME + "\">First Name</option>");
+ selectorBox.append("<option value=\"" + TurbineUserPeer.LAST_NAME + "\">Last Name</option>");
+ selectorBox.append("</select>");
+ return selectorBox.toString();
}
/**
diff --git a/src/main/resources/archetype-resources/src/main/java/modules/actions/ChangePasswordAction.java b/src/main/resources/archetype-resources/src/main/java/modules/actions/ChangePasswordAction.java
index ca7255b..46c4673 100644
--- a/src/main/resources/archetype-resources/src/main/java/modules/actions/ChangePasswordAction.java
+++ b/src/main/resources/archetype-resources/src/main/java/modules/actions/ChangePasswordAction.java
@@ -19,7 +19,6 @@
* under the License.
*#
-
import org.apache.fulcrum.security.util.PasswordMismatchException;
import org.apache.turbine.annotation.TurbineService;
import org.apache.turbine.om.security.User;
@@ -32,64 +31,50 @@
* Change Password action.
*
*/
-public class ChangePasswordAction extends SecureAction
-
+public class ChangePasswordAction extends SecureAction
{
- /** Injected service instance */
- @TurbineService
- private SecurityService security;
+ /** Injected service instance */
+ @TurbineService
+ private SecurityService security;
+ /**
+ * Implement this to add information to the context.
+ *
+ * @param data Turbine information.
+ * @param context Context for web pages.
+ * @exception Exception, a generic exception.
+ */
+ @Override
+ public void doPerform(PipelineData pipelineData) throws Exception
+ {
+ RunData data = (RunData) pipelineData;
+ User user = data.getUser();
- /**
- * Implement this to add information to the context.
- *
- * @param data
- * Turbine information.
- * @param context
- * Context for web pages.
- * @exception Exception,
- * a generic exception.
- */
- @Override
- public void doPerform(PipelineData data)
- throws Exception
- {
+ String oldPassword = data.getParameters().getString("oldpassword", "");
+ String newPassword = data.getParameters().getString("newpassword", "");
- User user = getRunData(data).getUser();
-
- RunData rundata = getRunData(data);
- String oldPassword = rundata.getParameters().getString("oldpassword", "");
- String newPassword = rundata.getParameters().getString("newpassword", "");
-
- try {
- security.changePassword(user, oldPassword, newPassword);
- rundata.setMessage("Password changed!");
- }
- catch (PasswordMismatchException e)
- {
- rundata.setMessage(e.getMessage());
- rundata.setScreenTemplate("Password.vm");
- }
-
-
- }
-
- /**
- * Implement this to add information to the context.
- *
- * @param data
- * Turbine information.
- * @param context
- * Context for web pages.
- * @exception Exception,
- * a generic exception.
- */
- @Override
- public void doPerform(PipelineData data, Context context) throws Exception
- {
+ try {
+ security.changePassword(user, oldPassword, newPassword);
+ data.setMessage("Password changed!");
+ } catch (PasswordMismatchException e) {
+ data.setMessage(e.getMessage());
+ data.setScreenTemplate("Password.vm");
+ }
- context.put("success", "Password changed!!");
- }
+ }
+
+ /**
+ * Implement this to add information to the context.
+ *
+ * @param data Turbine information.
+ * @param context Context for web pages.
+ * @exception Exception, a generic exception.
+ */
+ @Override
+ public void doPerform(PipelineData data, Context context) throws Exception
+ {
+ context.put("success", "Password changed!!");
+ }
}
diff --git a/src/main/resources/archetype-resources/src/main/java/modules/actions/LoginUser.java b/src/main/resources/archetype-resources/src/main/java/modules/actions/LoginUser.java
index 52736d4..c700fc3 100644
--- a/src/main/resources/archetype-resources/src/main/java/modules/actions/LoginUser.java
+++ b/src/main/resources/archetype-resources/src/main/java/modules/actions/LoginUser.java
@@ -72,7 +72,7 @@
public void doPerform(PipelineData pipelineData)
throws FulcrumSecurityException
{
- RunData data = getRunData(pipelineData);
+ RunData data = (RunData) pipelineData;
String username = data.getParameters().getString(LoginUser.CGI_USERNAME, "");
if (StringUtils.isEmpty(username))
diff --git a/src/main/resources/archetype-resources/src/main/java/modules/actions/LoginUserIntake.java b/src/main/resources/archetype-resources/src/main/java/modules/actions/LoginUserIntake.java
index 85dda64..7106114 100644
--- a/src/main/resources/archetype-resources/src/main/java/modules/actions/LoginUserIntake.java
+++ b/src/main/resources/archetype-resources/src/main/java/modules/actions/LoginUserIntake.java
@@ -19,7 +19,6 @@
* under the License.
*#
-
import org.apache.commons.configuration2.Configuration;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
@@ -42,9 +41,9 @@
import org.apache.turbine.util.RunData;
/**
- * This is where we authenticate the user logging into the system
- * against a user in the database. If the user exists in the database
- * that users last login time will be updated.
+ * This is where we authenticate the user logging into the system against a user
+ * in the database. If the user exists in the database that users last login
+ * time will be updated.
*
* @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
* @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
@@ -52,135 +51,117 @@
* @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a>
* @version $Id$
*/
-public class LoginUserIntake
- extends org.apache.turbine.modules.actions.LoginUser
-{
+public class LoginUserIntake extends org.apache.turbine.modules.actions.LoginUser {
- /** Logging */
- private static Log log = LogFactory.getLog(LoginUserIntake.class);
+ /** Logging */
+ private static Log log = LogFactory.getLog(LoginUserIntake.class);
- /** Injected service instance */
- @TurbineService
- private SecurityService security;
-
- /** Injected configuration instance */
- @TurbineConfiguration
- private Configuration conf;
+ /** Injected service instance */
+ @TurbineService
+ private SecurityService security;
+ /** Injected configuration instance */
+ @TurbineConfiguration
+ private Configuration conf;
+ /**
+ * Checks for anonymous user, else calls parent method.
+ *
+ * @param pipelineData Turbine information.
+ * @exception FulcrumSecurityException could not get instance of the anonymous
+ * user
+ */
+ @Override
+ public void doPerform(PipelineData pipelineData) throws FulcrumSecurityException
+ {
+ RunData data = (RunData) pipelineData;
- /**
- * Checks for anonymous user, else calls parent method.
- *
- * @param pipelineData Turbine information.
- * @exception FulcrumSecurityException could not get instance of the
- * anonymous user
- */
- @Override
- public void doPerform(PipelineData pipelineData)
- throws FulcrumSecurityException
- {
- RunData data = getRunData(pipelineData);
-
- try
- {
- // Get intake group
- // context only available after ExecutePageValve, could not invoke (IntakeTool)context.get("intake") using pook service instead
- PoolService poolService = (PoolService)TurbineServices.getInstance().getService(PoolService.ROLE);
- IntakeTool intake = (IntakeTool) poolService.getInstance(IntakeTool.class);
-
- intake.init(data);
- Group group = intake.get("Login", IntakeTool.DEFAULT_KEY);
- String username = (String)group.get("Username").getValue();
- if (StringUtils.isEmpty(username))
- {
- return;
- }
+ try
+ {
+ // Get intake group
+ // context only available after ExecutePageValve, could not invoke
+ // (IntakeTool)context.get("intake") using pook service instead
+ PoolService poolService = (PoolService) TurbineServices.getInstance().getService(PoolService.ROLE);
+ IntakeTool intake = (IntakeTool) poolService.getInstance(IntakeTool.class);
- if (username.equals(security.getAnonymousUser().getName()))
- {
- data.setMessage("Anonymous user cannot login");
- reset(data);
- return;
- }
-
- if (username.equals(security.getAnonymousUser().getName()))
- {
- throw new Exception("Anonymous user cannot login");
- }
-
- String password = (String)group.get("Password").getValue();
- // Authenticate the user and get the object.
- User user = security.getAuthenticatedUser(username, password);
+ intake.init(data);
+ Group group = intake.get("Login", IntakeTool.DEFAULT_KEY);
+ String username = (String) group.get("Username").getValue();
+ if (StringUtils.isEmpty(username))
+ {
+ return;
+ }
- // Store the user object.
- data.setUser(user);
+ if (username.equals(security.getAnonymousUser().getName()))
+ {
+ data.setMessage("Anonymous user cannot login");
+ reset(data);
+ return;
+ }
- // Mark the user as being logged in.
- user.setHasLoggedIn(Boolean.TRUE);
+ if (username.equals(security.getAnonymousUser().getName()))
+ {
+ throw new Exception("Anonymous user cannot login");
+ }
- // Set the last_login date in the database.
- user.updateLastLogin();
+ String password = (String) group.get("Password").getValue();
+
+ // Authenticate the user and get the object.
+ User user = security.getAuthenticatedUser(username, password);
- // This only happens if the user is valid; otherwise, we
- // will get a valueBound in the User object when we don't
- // want to because the username is not set yet. Save the
- // User object into the session.
- data.save();
+ // Store the user object.
+ data.setUser(user);
- /*
- * If the setPage("template.vm") method has not
- * been used in the template to authenticate the
- * user (usually Login.vm), then the user will
- * be forwarded to the template that is specified
- * by the "template.home" property as listed in
- * TR.props for the webapp.
- */
+ // Mark the user as being logged in.
+ user.setHasLoggedIn(Boolean.TRUE);
- }
- catch (Exception e)
- {
- if (e instanceof DataBackendException || e instanceof IntakeException)
- {
- log.error(e);
- }
+ // Set the last_login date in the database.
+ user.updateLastLogin();
- // Set Error Message and clean out the user.
- data.setMessage(conf.getString(TurbineConstants.LOGIN_ERROR, ""));
- User anonymousUser = security.getAnonymousUser();
- data.setUser(anonymousUser);
-
- String loginTemplate = conf.getString(
- TurbineConstants.TEMPLATE_LOGIN);
+ // This only happens if the user is valid; otherwise, we
+ // will get a valueBound in the User object when we don't
+ // want to because the username is not set yet. Save the
+ // User object into the session.
+ data.save();
- if (StringUtils.isNotEmpty(loginTemplate))
- {
- // We're running in a templating solution
- data.setScreenTemplate(loginTemplate);
- }
- else
- {
- data.setScreen(conf.getString(TurbineConstants.SCREEN_LOGIN));
- }
- }
- }
+ /*
+ * If the setPage("template.vm") method has not been used in the template to
+ * authenticate the user (usually Login.vm), then the user will be forwarded to
+ * the template that is specified by the "template.home" property as listed in
+ * TR.props for the webapp.
+ */
- private void reset(RunData data) throws UnknownEntityException {
- User anonymousUser = security.getAnonymousUser();
- data.setUser(anonymousUser);
+ } catch (Exception e) {
+ if (e instanceof DataBackendException || e instanceof IntakeException) {
+ log.error(e);
+ }
- if (StringUtils.isNotEmpty(conf.getString(TurbineConstants.TEMPLATE_LOGIN,"")))
- {
- // We're running in a templating solution
- data.setScreenTemplate(
- conf.getString(TurbineConstants.TEMPLATE_LOGIN));
- }
- else
- {
- data.setScreen(
- conf.getString(TurbineConstants.SCREEN_LOGIN));
- }
- }
+ // Set Error Message and clean out the user.
+ data.setMessage(conf.getString(TurbineConstants.LOGIN_ERROR, ""));
+ User anonymousUser = security.getAnonymousUser();
+ data.setUser(anonymousUser);
+
+ String loginTemplate = conf.getString(TurbineConstants.TEMPLATE_LOGIN);
+
+ if (StringUtils.isNotEmpty(loginTemplate)) {
+ // We're running in a templating solution
+ data.setScreenTemplate(loginTemplate);
+ } else {
+ data.setScreen(conf.getString(TurbineConstants.SCREEN_LOGIN));
+ }
+ }
+ }
+
+ private void reset(RunData data) throws UnknownEntityException {
+ User anonymousUser = security.getAnonymousUser();
+ data.setUser(anonymousUser);
+
+ if (StringUtils.isNotEmpty(conf.getString(TurbineConstants.TEMPLATE_LOGIN, ""))) {
+ // We're running in a templating solution
+ data.setScreenTemplate(conf.getString(TurbineConstants.TEMPLATE_LOGIN));
+ } else {
+ data.setScreen(conf.getString(TurbineConstants.SCREEN_LOGIN));
+ }
+ }
}
-
diff --git a/src/main/resources/archetype-resources/src/main/java/modules/actions/LogoutUser.java b/src/main/resources/archetype-resources/src/main/java/modules/actions/LogoutUser.java
index 50a9d98..5f696c9 100644
--- a/src/main/resources/archetype-resources/src/main/java/modules/actions/LogoutUser.java
+++ b/src/main/resources/archetype-resources/src/main/java/modules/actions/LogoutUser.java
@@ -39,8 +39,7 @@
* @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a>
* @version $Id: LogoutUser.java 1706239 2015-10-01 13:18:35Z tv $
*/
-public class LogoutUser
- extends Action
+public class LogoutUser implements Action
{
/** Injected service instance */
@TurbineService
@@ -72,7 +71,7 @@
public void doPerform(PipelineData pipelineData)
throws FulcrumSecurityException
{
- RunData data = getRunData(pipelineData);
+ RunData data = (RunData) pipelineData;
// Session validator did not run, so RunData is not populated
User user = data.getUserFromSession();
@@ -88,7 +87,7 @@
security.saveUser(user);
}
- data.setMessage(conf.getString(TurbineConstants.LOGOUT_MESSAGE));
+ ((RunData) data).setMessage(conf.getString(TurbineConstants.LOGOUT_MESSAGE));
// This will cause the acl to be removed from the session in
// the Turbine servlet code.
diff --git a/src/main/resources/archetype-resources/src/main/java/modules/actions/SecureAction.java b/src/main/resources/archetype-resources/src/main/java/modules/actions/SecureAction.java
index c25fae5..85757e0 100644
--- a/src/main/resources/archetype-resources/src/main/java/modules/actions/SecureAction.java
+++ b/src/main/resources/archetype-resources/src/main/java/modules/actions/SecureAction.java
@@ -1,23 +1,20 @@
package ${package}.modules.actions;
-#*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*#
+/*
+ * Copyright 2001-2019 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import org.apache.fulcrum.localization.LocalizationService;
import org.apache.fulcrum.security.model.turbine.TurbineAccessControlList;
@@ -34,65 +31,60 @@
* Always performs a Security Check that you've defined before executing the
* doPerform().
*/
-public class SecureAction extends VelocitySecureAction
-{
-
- @TurbineService
- private LocalizationService localizationService;
- /**
- * This currently only checks to make sure that user is allowed to view the
- * storage area. If you create an action that requires more security then
- * override this method.
- *
- * @param data
- * Turbine information.
- * @return True if the user is authorized to access the screen.
- * @exception Exception,
- * a generic exception.
- */
- @Override
- protected boolean isAuthorized(PipelineData data) throws Exception
- {
- boolean isAuthorized = false;
-
- // Who is our current user?
- User user = getRunData(data).getUser();
-
- // Get the Turbine ACL implementation
- TurbineAccessControlList acl = getRunData(data).getACL();
-
- if (acl == null || ! ( acl.hasRole("turbineuser") || acl.hasRole("turbineadmin") ) )
- {
- String msg = localizationService.getString(localizationService.getDefaultBundleName(),
- localizationService.getLocale( ((RunData) data).getRequest()), "no_permission");
-
- getRunData(data).setMessage(msg);
-
- log.debug( "call not permitted for template: " + getRunData(data).getScreenTemplate() + " and action " + getRunData(data).getAction() );
- getRunData(data).setScreenTemplate( "Login.vm" );
- isAuthorized = false;
- }
- else if ( acl.hasRole("turbineuser") || acl.hasRole("turbineadmin") )
- {
- isAuthorized = true;
- }
-
- return isAuthorized;
- }
+public class SecureAction extends VelocitySecureAction {
- /**
- * Implement this to add information to the context.
- *
- * @param data
- * Turbine information.
- * @param context
- * Context for web pages.
- * @exception Exception,
- * a generic exception.
- */
- public void doPerform(PipelineData data, Context context) throws Exception
- {
- User user = getRunData(data).getUser();
- context.put("user",user);
+ @TurbineService
+ private LocalizationService localizationService;
+
+ /**
+ * This currently only checks to make sure that user is allowed to view the
+ * storage area. If you create an action that requires more security then
+ * override this method.
+ *
+ * @param data Turbine information.
+ * @return True if the user is authorized to access the screen.
+ * @exception Exception, a generic exception.
+ */
+ @Override
+ protected boolean isAuthorized(PipelineData pipelineData) throws Exception
+ {
+ boolean isAuthorized = false;
+ RunData data = (RunData) pipelineData;
+
+ // Who is our current user?
+ User user = data.getUser();
+
+ // Get the Turbine ACL implementation
+ TurbineAccessControlList acl = data.getACL();
+
+ if (acl == null || !(acl.hasRole("turbineuser") || acl.hasRole("turbineadmin"))) {
+ String msg = localizationService.getString(localizationService.getDefaultBundleName(),
+ localizationService.getLocale(((RunData) data).getRequest()), "no_permission");
+
+ data.setMessage(msg);
+
+ log.debug(
+ "call not permitted for template: " + data.getScreenTemplate() + " and action " + data.getAction());
+ data.setScreenTemplate("Login.vm");
+ isAuthorized = false;
+ } else if (acl.hasRole("turbineuser") || acl.hasRole("turbineadmin")) {
+ isAuthorized = true;
+ }
+
+ return isAuthorized;
+ }
+
+ /**
+ * Implement this to add information to the context.
+ *
+ * @param data Turbine information.
+ * @param context Context for web pages.
+ * @exception Exception, a generic exception.
+ */
+ public void doPerform(PipelineData pipelineData, Context context) throws Exception
+ {
+ RunData data = (RunData) pipelineData;
+ User user = data.getUser();
+ context.put("user", user);
}
}
diff --git a/src/main/resources/archetype-resources/src/main/java/modules/actions/ShowRecords.java b/src/main/resources/archetype-resources/src/main/java/modules/actions/ShowRecords.java
index 0ec8a8f..bb0cc47 100644
--- a/src/main/resources/archetype-resources/src/main/java/modules/actions/ShowRecords.java
+++ b/src/main/resources/archetype-resources/src/main/java/modules/actions/ShowRecords.java
@@ -39,7 +39,7 @@
super.doPerform( pipelineData, context );
List<Author> authors = AuthorPeer.doSelect( new Criteria() );//all
context.put( "authors", authors );
- RunData data = getRunData(pipelineData);
+ RunData data = (RunData) pipelineData;
data.setScreenTemplate(Character.toLowerCase(getClass().getSimpleName().charAt(0)) +
getClass().getSimpleName().substring(1) + ".vm"
);
diff --git a/src/main/resources/archetype-resources/src/main/java/modules/screens/Index.java b/src/main/resources/archetype-resources/src/main/java/modules/screens/Index.java
index de2a756..b7af8c5 100644
--- a/src/main/resources/archetype-resources/src/main/java/modules/screens/Index.java
+++ b/src/main/resources/archetype-resources/src/main/java/modules/screens/Index.java
@@ -58,7 +58,7 @@
* return always <code>true</code>true, to show this screen as default
*/
@Override
- protected boolean isAuthorized(PipelineData data) throws Exception
+ protected boolean isAuthorized(PipelineData pipelineData) throws Exception
{
// use data.getACL()
return true;
diff --git a/src/main/resources/archetype-resources/src/main/java/modules/screens/SecureScreen.java b/src/main/resources/archetype-resources/src/main/java/modules/screens/SecureScreen.java
index f4ca0f2..0a77890 100644
--- a/src/main/resources/archetype-resources/src/main/java/modules/screens/SecureScreen.java
+++ b/src/main/resources/archetype-resources/src/main/java/modules/screens/SecureScreen.java
@@ -1,4 +1,5 @@
package ${package}.modules.screens;
+
#*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,7 +19,6 @@
* under the License.
*#
-
import org.apache.fulcrum.security.model.turbine.TurbineAccessControlList;
import org.apache.turbine.Turbine;
import org.apache.turbine.TurbineConstants;
@@ -28,66 +28,58 @@
import org.apache.turbine.om.security.User;
import org.apache.turbine.pipeline.PipelineData;
import org.apache.turbine.services.security.SecurityService;
+import org.apache.turbine.util.RunData;
import org.apache.velocity.context.Context;
import org.apache.commons.configuration2.Configuration;
/**
* This class provides a sample implementation for creating a secured screen
*/
-public class SecureScreen extends VelocitySecureScreen
-{
- @TurbineService
- protected SecurityService securityService;
-
- @TurbineConfiguration( TurbineConstants.TEMPLATE_LOGIN )
- private Configuration templateLogin;
-
- @TurbineConfiguration( TurbineConstants.TEMPLATE_HOMEPAGE )
- private Configuration templateHomepage;
-
- @Override
- protected boolean isAuthorized(PipelineData data) throws Exception
- {
- boolean isAuthorized = false;
-
- // Who is our current user?
- User user = getRunData(data).getUser();
-
- // Get the Turbine ACL implementation
- TurbineAccessControlList acl = getRunData(data).getACL();
-
- if (acl == null)
- {
- // commons configuration getProperty: prefix removed, the key for the value .. is an empty string, the result an object
- getRunData(data).setScreenTemplate( (String) templateLogin.getProperty("") );
- isAuthorized = false;
- }
- else if (acl.hasRole("turbineuser") || acl.hasRole("turbineadmin"))
- {
- isAuthorized = true;
- }
- else
- {
- getRunData(data).setScreenTemplate( (String) templateHomepage.getProperty("") );
- getRunData(data).setMessage("You do not have access to this part of the site.");
- isAuthorized = false;
- }
- return isAuthorized;
- }
+public class SecureScreen extends VelocitySecureScreen {
+ @TurbineService
+ protected SecurityService securityService;
- /**
- * Implement this to add information to the context.
- *
- * @param data
- * Turbine information.
- * @param context
- * Context for web pages.
- * @exception Exception,
- * a generic exception.
- */
- @Override
- protected void doBuildTemplate(PipelineData data, Context context) throws Exception
- {
-
- }
+ @TurbineConfiguration(TurbineConstants.TEMPLATE_LOGIN)
+ private Configuration templateLogin;
+
+ @TurbineConfiguration(TurbineConstants.TEMPLATE_HOMEPAGE)
+ private Configuration templateHomepage;
+
+ @Override
+ protected boolean isAuthorized(PipelineData pipelineData) throws Exception {
+ boolean isAuthorized = false;
+ RunData data = (RunData) pipelineData;
+
+ // Who is our current user?
+ User user = data.getUser();
+
+ // Get the Turbine ACL implementation
+ TurbineAccessControlList acl = data.getACL();
+
+ if (acl == null) {
+ // commons configuration getProperty: prefix removed, the key for the value ..
+ // is an empty string, the result an object
+ data.setScreenTemplate((String) templateLogin.getProperty(""));
+ isAuthorized = false;
+ } else if (acl.hasRole("turbineuser") || acl.hasRole("turbineadmin")) {
+ isAuthorized = true;
+ } else {
+ data.setScreenTemplate((String) templateHomepage.getProperty(""));
+ data.setMessage("You do not have access to this part of the site.");
+ isAuthorized = false;
+ }
+ return isAuthorized;
+ }
+
+ /**
+ * Implement this to add information to the context.
+ *
+ * @param data Turbine information.
+ * @param context Context for web pages.
+ * @exception Exception, a generic exception.
+ */
+ @Override
+ protected void doBuildTemplate(PipelineData data, Context context) throws Exception {
+
+ }
}
diff --git a/src/main/resources/archetype-resources/src/main/java/wrapper/TurbineUserWrapper.java b/src/main/resources/archetype-resources/src/main/java/wrapper/TurbineUserWrapper.java
index 44088e4..f430de4 100644
--- a/src/main/resources/archetype-resources/src/main/java/wrapper/TurbineUserWrapper.java
+++ b/src/main/resources/archetype-resources/src/main/java/wrapper/TurbineUserWrapper.java
@@ -1,7 +1,7 @@
package ${package}.wrapper;
/*
- * Copyright 2001-2017 The Apache Software Foundation.
+ * Copyright 2001-2019 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
diff --git a/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/roleConfiguration.xml b/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/roleConfiguration.xml
index a21b16a..3911005 100644
--- a/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/roleConfiguration.xml
+++ b/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/roleConfiguration.xml
@@ -61,11 +61,6 @@
default-class="org.apache.fulcrum.pool.DefaultPoolService"/>
<role
- name="org.apache.fulcrum.upload.UploadService"
- shorthand="upload"
- default-class="org.apache.fulcrum.upload.DefaultUploadService"/>
-
- <role
name="org.apache.fulcrum.parser.ParserService"
shorthand="parser"
default-class="org.apache.fulcrum.parser.DefaultParserService"/>
@@ -137,4 +132,4 @@
<!-- Add your services here -->
-</role-list>
\ No newline at end of file
+</role-list>