You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by mp...@apache.org on 2003/07/17 20:41:08 UTC
cvs commit: jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/actions/user FluxUserAction.java
mpoeschl 2003/07/17 11:41:08
Modified: . NOTES deps.list default.properties build.xml
src/java/org/apache/turbine/flux/modules/screens
FluxIndex.java FluxScreen.java
src/templates/screens/user FluxUserForm.vm
FluxUserRoleForm.vm FluxUserList.vm
src/java/org/apache/turbine/flux/tools FluxTool.java
src/java/org/apache/turbine/flux/modules/actions/group
FluxGroupAction.java
src/templates/screens/permission FluxPermissionForm.vm
src/java/org/apache/turbine/flux/modules/actions
FluxAction.java
src/java/org/apache/turbine/flux/modules/actions/permission
FluxPermissionAction.java
src/java/org/apache/turbine/flux/modules/screens/permission
Default.java
src/java/org/apache/turbine/flux/modules/screens/group
Default.java
src/java/org/apache/turbine/flux/modules/screens/role
Default.java
src/java/org/apache/turbine/flux/modules/screens/user
Default.java
src/java/org/apache/turbine/flux/modules/actions/role
FluxRoleAction.java
src/java/org/apache/turbine/flux/modules/actions/user
FluxUserAction.java
Added: . project.xml project.properties testing.txt
src/resources/ui/skins/default/images logo-green.jpg
line.gif logo-blue.jpg alert1.gif logo.jpg
src/java/org/apache/turbine/flux/modules/screens
FluxError.java
src/java/org/apache/turbine/flux/modules/actions
FluxLogout.java FluxLogin.java
src/resources/ui/skins/default skin.props
Log:
move code for turbine 2.3 to HEAD
the code for turbine-3 is now in the T_3_DEV_BRANCH
Revision Changes Path
1.3 +0 -17 jakarta-turbine-flux/NOTES
Index: NOTES
===================================================================
RCS file: /home/cvs/jakarta-turbine-flux/NOTES,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- NOTES 1 Aug 2001 15:19:15 -0000 1.2
+++ NOTES 17 Jul 2003 18:41:05 -0000 1.3
@@ -9,20 +9,3 @@
These should be JAR files that could be picked
up automatically. This will work now that velocity
can load templates off the classpath.
-
-----------------------------------------------------------------------
-T E S T I N G
-----------------------------------------------------------------------
-
-Testing performed manually that has to be automated.
-Going to try and use Cactus (J2EEUnit).
-
-- add/edit/remove user
-- add/remove group
-- add/remove role
-- add/remove permission
-- add role/apply to user
-- add permission/apply to role
-
-Everything looks good after the new security changes.
-15 Apr 2001 (jvz)
1.3 +3 -5 jakarta-turbine-flux/deps.list
Index: deps.list
===================================================================
RCS file: /home/cvs/jakarta-turbine-flux/deps.list,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- deps.list 12 Feb 2002 21:57:39 -0000 1.2
+++ deps.list 17 Jul 2003 18:41:05 -0000 1.3
@@ -1,8 +1,6 @@
<non-distributable>|activation.jar|http://java.sun.com/products/javabeans/glasgow/jaf.html
servlet-2.2.jar
-turbine-3.0-dev.jar
-fulcrum-1.0.jar
+turbine-2.2b1.jar
velocity-1.3-dev.jar
-torque-3.0-dev.jar
-commons-util-0.1-dev.jar
-stratum-0.1-dev.jar
+activation-1.0.1.jar
+ecs-1.4.1.jar
1.2 +9 -9 jakarta-turbine-flux/default.properties
Index: default.properties
===================================================================
RCS file: /home/cvs/jakarta-turbine-flux/default.properties,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- default.properties 9 Feb 2002 02:35:21 -0000 1.1
+++ default.properties 17 Jul 2003 18:41:05 -0000 1.2
@@ -1,5 +1,5 @@
name = flux
-version = 3.0-dev
+version = 2.2
project = flux
build.compiler = classic
build.dir = ./bin
@@ -9,16 +9,16 @@
template.src.dir = ./src/templates
resources.src.dir = ./src/resources
final.name = ${project}-${version}
+final.dir = ../${final.name}/
ant.home = .
debug = on
optimize = off
deprecation = off
-servlet.jar = ${lib.repo}/servlet-2.2.jar
-turbine.jar = ${lib.repo}/turbine-3.0-dev.jar
-fulcrum.jar = ${lib.repo}/fulcrum-1.0.jar
-velocity.jar = ${lib.repo}/velocity-1.2-dev.jar
-torque.jar = ${lib.repo}/torque-3.0-dev.jar
-commons-util.jar = ${lib.repo}/commons-util-0.1-dev.jar
-jaf.jar = ${lib.repo}/activation-1.0.1.jar
-stratum.jar = ${lib.repo}/stratum-0.1-dev.jar
+commons-lang.jar = ${lib.repo}/commons-lang-1.0-dev.jar
+servlet.jar = ${lib.repo}/servlet-2.2.jar
+turbine.jar = ${lib.repo}/turbine-2.2-b2-dev.jar
+torque.jar = ${lib.repo}/torque-3.0-b3-dev.jar
+velocity.jar = ${lib.repo}/velocity-1.3.jar
+jaf.jar = ${lib.repo}/activation-1.0.2.jar
+ecs.jar = ${lib.repo}/ecs-1.4.1.jar
1.9 +33 -53 jakarta-turbine-flux/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-turbine-flux/build.xml,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- build.xml 9 Feb 2002 02:35:21 -0000 1.8
+++ build.xml 17 Jul 2003 18:41:05 -0000 1.9
@@ -1,20 +1,18 @@
<?xml version="1.0"?>
-<project name="admin" default="jar" basedir=".">
-
+<project name="admin" default="compile" basedir=".">
+
<property file="${user.home}/build.properties" />
<property file="default.properties" />
<path id="classpath">
+ <pathelement location="${commons-lang.jar}"/>
+ <pathelement location="${ecs.jar}"/>
+ <pathelement location="${jaf.jar}"/>
<pathelement location="${servlet.jar}"/>
<pathelement location="${turbine.jar}"/>
- <pathelement location="${fulcrum.jar}"/>
- <pathelement location="${velocity.jar}"/>
<pathelement location="${torque.jar}"/>
- <pathelement location="${commons-util.jar}"/>
- <pathelement location="${commons-collections.jar}"/>
- <pathelement location="${jaf.jar}"/>
- <pathelement location="${stratum.jar}"/>
+ <pathelement location="${velocity.jar}"/>
</path>
<!-- ================================================================== -->
@@ -28,65 +26,43 @@
<target
name="update-jars">
-
- <taskdef
- name="httpget"
+
+ <taskdef
+ name="httpget"
className="org.apache.tdk.task.Get">
<classpath refid="update.classpath"/>
</taskdef>
-
+
<!-- If you need proxy support you'll have to manually add:
-
+
proxyHost="x"
proxyPort="y"
-
+
We'll clean this up but it worked for a user behind a proxy.
-->
-
+
<httpget
baseUrl="http://jakarta.apache.org/turbine/jars/"
dest="${lib.repo}"
dependencyFile="deps.list"
/>
- </target>
-
- <!-- ================================================================== -->
- <!-- Prints useful build environment values -->
- <!-- ================================================================== -->
-
- <target name="env">
- <echo message="java.home = ${java.home}"/>
- <echo message="user.home = ${user.home}"/>
- <echo message="lib.repo = ${lib.repo}"/>
-
- <echo message="servlet.jar = ${servlet.jar}"/>
- <echo message="turbine.jar = ${turbine.jar}"/>
- <echo message="fulcrum.jar = ${fulcrum.jar}"/>
- <echo message="velocity.jar = ${velocity.jar}"/>
- <echo message="torque.jar = ${torque.jar}"/>
- <echo message="commons-collections.jar = ${commons-collections.jar}"/>
- <echo message="commons-util.jar = ${commons-util.jar}"/>
- <echo message="jaf.jar = ${jaf.jar}"/>
</target>
<!-- ================================================================== -->
<!-- Prepares the build directory -->
<!-- ================================================================== -->
- <target
- name="prepare"
- depends="env">
-
- <mkdir dir="${build.dest}"/>
+ <target name="prepare">
+ <mkdir dir="${build.dest}"/>
</target>
<!-- =================================================================== -->
<!-- C O M P I L E F L U X -->
- <!-- =================================================================== -->
- <target name="compile"
+ <!-- =================================================================== -->
+ <target name="compile"
depends="prepare"
description="--> compiles the source code">
-
+
<javac srcdir="${java.src.dir}"
destdir="${build.dest}"
debug="${debug}"
@@ -99,23 +75,32 @@
<!-- ================================================================== -->
<!-- Compiles the source directory and creates a .jar file -->
<!-- ================================================================== -->
- <target name="jar"
- depends="compile"
+ <target name="jar"
+ depends="compile"
description="--> generates the .jar file">
-
<jar jarfile="${build.dir}/${final.name}.jar">
<fileset dir="${build.dest}"/>
<fileset dir="${src.dir}">
<exclude name="**/java/**"/>
+ <exclude name="**/templates/**"/>
</fileset>
+ <fileset dir="${src.dir}/templates"/>
</jar>
</target>
<!-- ================================================================== -->
+ <!-- Cleans up the build directory -->
+ <!-- ================================================================== -->
+ <target name="clean" description="--> cleans up the build directory">
+ <delete dir="${build.dir}"/>
+ </target>
+
+ <!-- ================================================================== -->
<!-- I N S T A L L J A R -->
<!-- ================================================================== -->
- <target name="install-jar" depends="jar"
- description="==> Installs .jar file in ${lib.repo}">
+
+ <target name="install-jar" depends="jar"
+ description="--> Installs .jar file in ${lib.repo}">
<copy todir="${lib.repo}" filtering="no">
<fileset dir="${build.dir}">
<include name="${final.name}.jar"/>
@@ -123,12 +108,7 @@
</copy>
</target>
- <!-- ================================================================== -->
- <!-- Cleans up the build directory -->
- <!-- ================================================================== -->
- <target name="clean" description="--> cleans up the build directory">
- <delete dir="${build.dir}"/>
- </target>
+
</project>
1.2 +136 -0 jakarta-turbine-flux/project.xml
1.2 +21 -0 jakarta-turbine-flux/project.properties
1.3 +0 -0 jakarta-turbine-flux/testing.txt
1.3 +0 -0 jakarta-turbine-flux/src/resources/ui/skins/default/images/logo-green.jpg
<<Binary file>>
1.3 +0 -0 jakarta-turbine-flux/src/resources/ui/skins/default/images/line.gif
<<Binary file>>
1.3 +0 -0 jakarta-turbine-flux/src/resources/ui/skins/default/images/logo-blue.jpg
<<Binary file>>
1.3 +0 -0 jakarta-turbine-flux/src/resources/ui/skins/default/images/alert1.gif
<<Binary file>>
1.3 +0 -0 jakarta-turbine-flux/src/resources/ui/skins/default/images/logo.jpg
<<Binary file>>
1.9 +23 -21 jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/screens/FluxIndex.java
Index: FluxIndex.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/screens/FluxIndex.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- FluxIndex.java 1 Aug 2001 15:19:17 -0000 1.8
+++ FluxIndex.java 17 Jul 2003 18:41:06 -0000 1.9
@@ -3,7 +3,7 @@
/* ====================================================================
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -54,28 +54,28 @@
* <http://www.apache.org/>.
*/
-import org.apache.turbine.RunData;
-import org.apache.turbine.Turbine;
-import org.apache.turbine.TemplateContext;
-import org.apache.turbine.TemplateScreen;
-import org.apache.fulcrum.security.util.AccessControlList;
+import org.apache.turbine.modules.screens.VelocityScreen;
+import org.apache.turbine.services.resources.TurbineResources;
+import org.apache.turbine.services.velocity.TurbineVelocity;
+import org.apache.turbine.util.RunData;
+import org.apache.turbine.util.security.AccessControlList;
+import org.apache.velocity.context.Context;
/**
* Base screen for secure web access to the storage side of Tambora.
*
* @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
*/
-public class FluxIndex
- extends TemplateScreen
+public class FluxIndex extends VelocityScreen
{
/**
* Overide this to add information to the context.
*
* @param data Turbine information.
- * @param TemplateContext context for web pages.
+ * @param context Context for web pages.
* @exception Exception, a generic exception.
*/
- protected void doBuildTemplate( RunData data, TemplateContext context )
+ protected void doBuildTemplate( RunData data, Context context )
throws Exception
{
}
@@ -91,7 +91,7 @@
{
if ( isAuthorized( data ) )
{
- doBuildTemplate( data, getTemplateContext( data ) );
+ doBuildTemplate( data, TurbineVelocity.getContext( data ) );
}
}
@@ -102,12 +102,11 @@
* @return True if the user is authorized to access the screen.
* @exception Exception, a generic exception.
*/
- protected boolean isAuthorized( RunData data )
- throws Exception
+ protected boolean isAuthorized( RunData data ) throws Exception
{
-
- String fluxAdminRole = Turbine.getConfiguration().getString("flux.admin.role");
-
+
+ String fluxAdminRole = TurbineResources.getString("flux.admin.role");
+
boolean isAuthorized = false;
//get acl and check security
@@ -115,7 +114,10 @@
if (acl==null || ! acl.hasRole(fluxAdminRole))
{
- data.setTarget(Turbine.getConfiguration().getString("template.login"));
+ data.getTemplateInfo().setScreenTemplate(
+ TurbineResources.getString("template.login"));
+
+ data.setScreen(TurbineResources.getString("screen.login"));
isAuthorized = false;
}
else if(acl.hasRole(fluxAdminRole))
1.8 +49 -27 jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/screens/FluxScreen.java
Index: FluxScreen.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/screens/FluxScreen.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- FluxScreen.java 1 Aug 2001 15:19:17 -0000 1.7
+++ FluxScreen.java 17 Jul 2003 18:41:06 -0000 1.8
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -54,30 +54,31 @@
* <http://www.apache.org/>.
*/
-import org.apache.turbine.RunData;
-import org.apache.turbine.Turbine;
-import org.apache.turbine.TemplateContext;
-import org.apache.turbine.TemplateScreen;
-import org.apache.fulcrum.security.util.AccessControlList;
+import org.apache.velocity.context.Context;
+
+import org.apache.turbine.modules.screens.VelocityScreen;
+import org.apache.turbine.services.resources.TurbineResources;
+import org.apache.turbine.services.velocity.TurbineVelocity;
+import org.apache.turbine.util.RunData;
+import org.apache.turbine.util.security.AccessControlList;
/**
* Base screen for secure web acces to the storage side of Tambora.
*
* @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
*/
-public abstract class FluxScreen
- extends TemplateScreen
+public abstract class FluxScreen extends VelocityScreen
{
private static final Boolean TRUE = new Boolean(true);
-
+
/**
* Overide this to add information to the context.
*
* @param data Turbine information.
- * @param TemplateTemplateContext context for web pages.
+ * @param context Context for web pages.
* @exception Exception, a generic exception.
*/
- protected void doBuildTemplate( RunData data, TemplateContext context )
+ protected void doBuildTemplate( RunData data, Context context )
throws Exception
{
}
@@ -89,24 +90,28 @@
* @param data Turbine information.
* @exception Exception, a generic exception.
*/
- protected void doBuildTemplate( RunData data )
- throws Exception
+ protected void doBuildTemplate( RunData data ) throws Exception
{
- TemplateContext context = getTemplateContext( data );
+ Context context = TurbineVelocity.getContext( data );
- // Check to see if the embedded menu should be
- // displayed in the templates.
- if (Turbine.getConfiguration().getBoolean("flux.embedded.show.menu", false))
+ /*
+ * Check to see if the embedded menu should be
+ * displayed in the templates.
+ */
+ if (TurbineResources.getBoolean("flux.embedded.show.menu", false))
{
context.put("showEmbeddedMenu", TRUE);
}
- // Check to see if we will display the finders
- // on the forms used in Flux.
- if (Turbine.getConfiguration().getBoolean("flux.ui.show.finder", false))
+ /*
+ * Check to see if we will display the finders
+ * on the forms used in Flux.
+ */
+ if (TurbineResources.getBoolean("flux.ui.show.finder", false))
{
context.put("showFinder", TRUE);
}
+
if ( isAuthorized( data ) )
{
@@ -121,25 +126,42 @@
* @return True if the user is authorized to access the screen.
* @exception Exception, a generic exception.
*/
- protected boolean isAuthorized( RunData data )
- throws Exception
+ protected boolean isAuthorized( RunData data ) throws Exception
{
boolean isAuthorized = false;
// Grab the Flux Admin role listed in the Flux.properties
// file that is included in the the standard
// TurbineResources.properties file.
- String fluxAdminRole = Turbine.getConfiguration().getString("flux.admin.role");
+ String fluxAdminRole = TurbineResources.getString("flux.admin.role");
AccessControlList acl = data.getACL();
if (acl==null || ! acl.hasRole(fluxAdminRole))
{
- data.setTarget(Turbine.getConfiguration().getString("template.login"));
+ data.setScreenTemplate(
+ TurbineResources.getString("template.login"));
+
isAuthorized = false;
}
else if(acl.hasRole(fluxAdminRole))
{
+ // Set the layout now that the user has
+ // gained access.
+ if (TurbineResources.getString("flux.mode").equalsIgnoreCase("embedded"))
+ {
+ data.setLayoutTemplate(
+ TurbineResources.getString("flux.embedded.layout"));
+ }
+ else
+ {
+ // This could probably be set to a default value
+ // because if running in stand-alone we know what
+ // layout template to use.
+ data.setLayoutTemplate(
+ TurbineResources.getString("flux.stand.alone.layout"));
+ }
+
isAuthorized = true;
}
1.3 +1 -17 jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/screens/FluxError.java
1.4 +2 -2 jakarta-turbine-flux/src/templates/screens/user/FluxUserForm.vm
Index: FluxUserForm.vm
===================================================================
RCS file: /home/cvs/jakarta-turbine-flux/src/templates/screens/user/FluxUserForm.vm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FluxUserForm.vm 22 May 2001 14:53:01 -0000 1.3
+++ FluxUserForm.vm 17 Jul 2003 18:41:06 -0000 1.4
@@ -36,7 +36,7 @@
#formCell ("Username" "username" $!user.UserName)
</tr>
<tr>
- #formCell ("Password" "password" $!user.Password)
+ #formPasswordCell ("Password" "password" "")
</tr>
<tr>
#formCell ("First Name" "firstname" $!user.FirstName)
1.3 +3 -11 jakarta-turbine-flux/src/templates/screens/user/FluxUserRoleForm.vm
Index: FluxUserRoleForm.vm
===================================================================
RCS file: /home/cvs/jakarta-turbine-flux/src/templates/screens/user/FluxUserRoleForm.vm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FluxUserRoleForm.vm 22 May 2001 14:53:13 -0000 1.2
+++ FluxUserRoleForm.vm 17 Jul 2003 18:41:06 -0000 1.3
@@ -24,11 +24,7 @@
</td>
#foreach ($role in $flux.Roles)
- <td bgcolor="$ui.labelColor">
- <font face="$ui.sansSerifFonts">
- <b>$role.Name</b>
- </font>
- </td>
+ #formLabel($role.Name)
#end
</tr>
@@ -37,11 +33,7 @@
#foreach ($group in $flux.Groups)
<tr>
- <td bgcolor="$ui.labelColor">
- <font face="$ui.sansSerifFonts">
- <b>$group.Name</b>
- </font>
- </td>
+ #formLabel($group.Name)
#foreach ($role in $flux.Roles)
#if ($acl.hasRole($role, $group))
1.3 +2 -3 jakarta-turbine-flux/src/templates/screens/user/FluxUserList.vm
Index: FluxUserList.vm
===================================================================
RCS file: /home/cvs/jakarta-turbine-flux/src/templates/screens/user/FluxUserList.vm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FluxUserList.vm 22 May 2001 14:53:08 -0000 1.2
+++ FluxUserList.vm 17 Jul 2003 18:41:06 -0000 1.3
@@ -8,7 +8,7 @@
$page.setTitle("User Administration")
$page.setBgColor($ui.bgcolor)
-#set ( $headings = ["Username","Password","First Name", "Last Name", "Email"] )
+#set ( $headings = ["Username","First Name", "Last Name", "Email"] )
<table>
@@ -48,7 +48,6 @@
#foreach ($user in $flux.Users)
<tr>
#entryCell ($!user.UserName)
- #entryCell ($!user.Password)
#entryCell ($!user.FirstName)
#entryCell ($!user.LastName)
#entryCell ("<a href=mailto:$!user.Email>$!user.Email</a>")
1.10 +52 -12 jakarta-turbine-flux/src/java/org/apache/turbine/flux/tools/FluxTool.java
Index: FluxTool.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-flux/src/java/org/apache/turbine/flux/tools/FluxTool.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- FluxTool.java 3 Sep 2001 22:16:36 -0000 1.9
+++ FluxTool.java 17 Jul 2003 18:41:06 -0000 1.10
@@ -3,7 +3,7 @@
/* ====================================================================
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -54,24 +54,24 @@
* <http://www.apache.org/>.
*/
-import java.util.Vector;
-import java.util.Iterator;
-import org.apache.fulcrum.security.entity.Group;
-import org.apache.fulcrum.security.entity.Role;
-import org.apache.fulcrum.security.entity.Permission;
-import org.apache.fulcrum.security.entity.User;
-import org.apache.fulcrum.security.util.AccessControlList;
-import org.apache.fulcrum.pool.Recyclable;
-import org.apache.fulcrum.security.TurbineSecurity;
import org.apache.torque.util.Criteria;
-import org.apache.turbine.RunData;
-import org.apache.turbine.Log;
+import org.apache.turbine.om.security.Group;
+import org.apache.turbine.om.security.Permission;
+import org.apache.turbine.om.security.Role;
+import org.apache.turbine.om.security.User;
+import org.apache.turbine.om.security.peer.TurbineUserPeer;
import org.apache.turbine.services.pull.ApplicationTool;
+import org.apache.turbine.services.security.TurbineSecurity;
+import org.apache.turbine.util.RunData;
+import org.apache.turbine.util.pool.Recyclable;
+import org.apache.turbine.util.security.AccessControlList;
+import org.apache.turbine.util.template.SelectorBox;
/**
* The pull api for flux templates
*
* @author <a href="mailto:jmcnally@apache.org">John D. McNally</a>
+ * @version $Id$
*/
public class FluxTool
implements Recyclable, ApplicationTool
@@ -227,6 +227,46 @@
throws Exception
{
return TurbineSecurity.getACL(getUser());
+ }
+
+
+
+ /**
+ */
+ 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 SelectorBox getUserFieldList()
+ throws Exception
+ {
+ /**
+ * This is a tie to the DB implementation
+ * something should be added the pluggable pieces
+ * to allow decent parameterized searching.
+ */
+
+ Object[] names =
+ {
+ TurbineUserPeer.USERNAME,
+ TurbineUserPeer.FIRST_NAME,
+ TurbineUserPeer.LAST_NAME
+ };
+
+ Object[] values =
+ {
+ "User Name" ,
+ "First Name",
+ "Last Name"
+ };
+
+ return new SelectorBox("fieldList", names, values);
}
/**
1.7 +21 -24 jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/actions/group/FluxGroupAction.java
Index: FluxGroupAction.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/actions/group/FluxGroupAction.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- FluxGroupAction.java 1 Aug 2001 15:19:17 -0000 1.6
+++ FluxGroupAction.java 17 Jul 2003 18:41:06 -0000 1.7
@@ -3,7 +3,7 @@
/* ====================================================================
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -54,29 +54,26 @@
* <http://www.apache.org/>.
*/
-
-import org.apache.turbine.RunData;
-import org.apache.turbine.TemplateContext;
-import org.apache.fulcrum.security.entity.Group;
-import org.apache.fulcrum.security.util.EntityExistsException;
-import org.apache.fulcrum.security.util.UnknownEntityException;
-import org.apache.fulcrum.security.util.GroupSet;
-import org.apache.fulcrum.security.TurbineSecurity;
import org.apache.turbine.flux.modules.actions.FluxAction;
+import org.apache.turbine.om.security.Group;
+import org.apache.turbine.services.security.TurbineSecurity;
+import org.apache.turbine.util.RunData;
+import org.apache.turbine.util.security.EntityExistsException;
+import org.apache.turbine.util.security.UnknownEntityException;
+import org.apache.velocity.context.Context;
/**
* Action to manage groups in Turbine.
- *
+ *
* @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
*/
-public class FluxGroupAction
- extends FluxAction
+public class FluxGroupAction extends FluxAction
{
/**
* ActionEvent responsible for inserting a new user
* into the Turbine security system.
*/
- public void doInsert(RunData data, TemplateContext context)
+ public void doInsert(RunData data, Context context)
throws Exception
{
// Group group = new Group();
@@ -99,7 +96,7 @@
* value alive.
*/
data.getParameters().add("mode", "insert");
- setTarget(data, "/admin/group/GroupForm.vm");
+ setTemplate(data, "/admin/group/GroupForm.vm");
}
}
@@ -109,14 +106,14 @@
* for integrity before allowing the user info
* to be update in the database.
*/
- public void doUpdate(RunData data, TemplateContext context)
+ public void doUpdate(RunData data, Context context)
throws Exception
{
Group group = TurbineSecurity.getGroup(
data.getParameters().getString("name"));
-
+
data.getParameters().setProperties(group);
-
+
try
{
TurbineSecurity.saveGroup(group);
@@ -135,7 +132,7 @@
* ActionEvent responsible for removing a user
* from the Tambora system.
*/
- public void doDelete(RunData data, TemplateContext context)
+ public void doDelete(RunData data, Context context)
throws Exception
{
Group group = TurbineSecurity.getGroup(
@@ -159,10 +156,10 @@
* Implement this to add information to the context.
*
* @param data Turbine information.
- * @param TemplateContext context for web pages.
+ * @param context Context for web pages.
* @exception Exception, a generic exception.
*/
- public void doPerform( RunData data,TemplateContext context )
+ public void doPerform( RunData data,Context context )
throws Exception
{
System.out.println("Running do perform!");
1.3 +2 -1 jakarta-turbine-flux/src/templates/screens/permission/FluxPermissionForm.vm
Index: FluxPermissionForm.vm
===================================================================
RCS file: /home/cvs/jakarta-turbine-flux/src/templates/screens/permission/FluxPermissionForm.vm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FluxPermissionForm.vm 22 May 2001 14:51:46 -0000 1.2
+++ FluxPermissionForm.vm 17 Jul 2003 18:41:06 -0000 1.3
@@ -43,6 +43,7 @@
<font face="$ui.sansSerifFonts">
#if ($flux.Mode == "modify")
+ <input type="hidden" name="oldname" value="$flux.Permission.Name"/>
<input type="submit" name="eventSubmit_doUpdate" value="Update Permission"/>
#elseif ($flux.Mode == "delete")
<input type="submit" name="eventSubmit_doDelete" value="Confirm Deletion"/>
1.6 +39 -22 jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/actions/FluxAction.java
Index: FluxAction.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/actions/FluxAction.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- FluxAction.java 1 Aug 2001 15:19:17 -0000 1.5
+++ FluxAction.java 17 Jul 2003 18:41:06 -0000 1.6
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -54,21 +54,35 @@
* <http://www.apache.org/>.
*/
-import org.apache.turbine.Turbine;
-import org.apache.turbine.RunData;
-import org.apache.turbine.TemplateAction;
-import org.apache.turbine.TemplateContext;
-import org.apache.fulcrum.security.util.AccessControlList;
+import org.apache.velocity.context.Context;
+
+import org.apache.turbine.modules.actions.VelocityAction;
+
+import org.apache.turbine.services.resources.TurbineResources;
+
+import org.apache.turbine.util.RunData;
+import org.apache.turbine.util.security.AccessControlList;
/**
* General Flux action.
- *
+ *
* @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
*/
-public class FluxAction
- extends TemplateAction
+public class FluxAction extends VelocityAction
{
/**
+ * 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( RunData data,Context context )
+ throws Exception
+ {
+ }
+
+ /**
* 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.
@@ -84,16 +98,19 @@
AccessControlList acl = (AccessControlList)
data.getSession().getValue(AccessControlList.SESSION_KEY);
- // Grab the Flux Admin role listed in the Flux.properties
- // file that is included in the the standard
- // TRP file.
- String fluxAdminRole =
- Turbine.getConfiguration().getString("flux.admin.role");
-
- // This should be taken from a config file, this
- // hard coding is no good for widespread use
- // of the admin app. I think a permissions file
- // would be better for the whole system.
+ /*
+ * Grab the Flux Admin role listed in the Flux.properties
+ * file that is included in the the standard
+ * TurbineResources.properties file.
+ */
+ String fluxAdminRole = TurbineResources.getString("flux.admin.role");
+
+ /*
+ * This should be taken from a config file, this
+ * hard coding is no good for widespread use
+ * of the admin app. I think a permissions file
+ * would be better for the whole system.
+ */
if (acl==null || ! acl.hasRole(fluxAdminRole))
{
isAuthorized = false;
1.5 +13 -13 jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/actions/FluxLogout.java
1.5 +28 -17 jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/actions/FluxLogin.java
1.7 +26 -28 jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/actions/permission/FluxPermissionAction.java
Index: FluxPermissionAction.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/actions/permission/FluxPermissionAction.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- FluxPermissionAction.java 1 Aug 2001 15:19:17 -0000 1.6
+++ FluxPermissionAction.java 17 Jul 2003 18:41:06 -0000 1.7
@@ -3,7 +3,7 @@
/* ====================================================================
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -54,28 +54,26 @@
* <http://www.apache.org/>.
*/
-import org.apache.turbine.RunData;
-import org.apache.turbine.TemplateContext;
-import org.apache.fulcrum.security.entity.Permission;
-import org.apache.fulcrum.security.util.EntityExistsException;
-import org.apache.fulcrum.security.util.UnknownEntityException;
-import org.apache.fulcrum.security.util.PermissionSet;
-import org.apache.fulcrum.security.TurbineSecurity;
import org.apache.turbine.flux.modules.actions.FluxAction;
+import org.apache.turbine.om.security.Permission;
+import org.apache.turbine.services.security.TurbineSecurity;
+import org.apache.turbine.util.RunData;
+import org.apache.turbine.util.security.EntityExistsException;
+import org.apache.turbine.util.security.UnknownEntityException;
+import org.apache.velocity.context.Context;
/**
* Action to manage permissions in Turbine.
- *
+ *
* @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
*/
-public class FluxPermissionAction
- extends FluxAction
+public class FluxPermissionAction extends FluxAction
{
/**
* ActionEvent responsible for inserting a new user
* into the Turbine security system.
*/
- public void doInsert(RunData data, TemplateContext context)
+ public void doInsert(RunData data, Context context)
throws Exception
{
//Permission permission = new Permission();
@@ -83,7 +81,7 @@
data.getParameters().setProperties(permission);
String name = data.getParameters().getString("name");
-
+
try
{
TurbineSecurity.addPermission(permission);
@@ -98,7 +96,7 @@
* value alive.
*/
data.getParameters().add("mode", "insert");
- setTarget(data, "/permission/FluxPermissionForm.vm");
+ setTemplate(data, "/permission/FluxPermissionForm.vm");
}
}
@@ -108,17 +106,15 @@
* for integrity before allowing the user info
* to be update in the database.
*/
- public void doUpdate(RunData data, TemplateContext context)
+ public void doUpdate(RunData data, Context context)
throws Exception
{
Permission permission = TurbineSecurity.getPermission(
- data.getParameters().getString("name"));
-
- data.getParameters().setProperties(permission);
-
+ data.getParameters().getString("oldname"));
try
{
- TurbineSecurity.savePermission(permission);
+ TurbineSecurity.renamePermission(permission,
+ data.getParameters().getString("name"));
}
catch (UnknownEntityException uee)
{
@@ -127,6 +123,7 @@
* think we should use the an id so that
* this can't happen.
*/
+ org.apache.turbine.util.Log.error(uee);
}
}
@@ -134,7 +131,7 @@
* ActionEvent responsible for removing a user
* from the Tambora system.
*/
- public void doDelete(RunData data, TemplateContext context)
+ public void doDelete(RunData data, Context context)
throws Exception
{
Permission permission = TurbineSecurity.getPermission(
@@ -151,17 +148,18 @@
* think we should use the an id so that
* this can't happen.
*/
+ org.apache.turbine.util.Log.error(uee);
}
}
-
+
/**
* Implement this to add information to the context.
*
* @param data Turbine information.
- * @param TemplateContext context for web pages.
+ * @param context Context for web pages.
* @exception Exception, a generic exception.
*/
- public void doPerform( RunData data,TemplateContext context )
+ public void doPerform( RunData data,Context context )
throws Exception
{
System.out.println("Running do perform!");
1.3 +4 -4 jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/screens/permission/Default.java
Index: Default.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/screens/permission/Default.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Default.java 10 Aug 2001 12:13:28 -0000 1.2
+++ Default.java 17 Jul 2003 18:41:07 -0000 1.3
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
1.3 +0 -0 jakarta-turbine-flux/src/resources/ui/skins/default/skin.props
1.3 +4 -4 jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/screens/group/Default.java
Index: Default.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/screens/group/Default.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Default.java 10 Aug 2001 12:13:28 -0000 1.2
+++ Default.java 17 Jul 2003 18:41:07 -0000 1.3
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
1.3 +4 -4 jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/screens/role/Default.java
Index: Default.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/screens/role/Default.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Default.java 10 Aug 2001 12:13:28 -0000 1.2
+++ Default.java 17 Jul 2003 18:41:07 -0000 1.3
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
1.3 +4 -4 jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/screens/user/Default.java
Index: Default.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/screens/user/Default.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Default.java 10 Aug 2001 12:13:28 -0000 1.2
+++ Default.java 17 Jul 2003 18:41:07 -0000 1.3
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
1.7 +31 -32 jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/actions/role/FluxRoleAction.java
Index: FluxRoleAction.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/actions/role/FluxRoleAction.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- FluxRoleAction.java 1 Aug 2001 15:19:17 -0000 1.6
+++ FluxRoleAction.java 17 Jul 2003 18:41:07 -0000 1.7
@@ -3,7 +3,7 @@
/* ====================================================================
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -54,25 +54,24 @@
* <http://www.apache.org/>.
*/
-import org.apache.turbine.RunData;
-import org.apache.turbine.TemplateContext;
-import org.apache.fulcrum.security.entity.Role;
-import org.apache.fulcrum.security.entity.Permission;
-import org.apache.fulcrum.security.util.EntityExistsException;
-import org.apache.fulcrum.security.util.UnknownEntityException;
-import org.apache.fulcrum.security.util.RoleSet;
-import org.apache.fulcrum.security.util.PermissionSet;
-import org.apache.fulcrum.security.TurbineSecurity;
import org.apache.turbine.flux.modules.actions.FluxAction;
+import org.apache.turbine.om.security.Permission;
+import org.apache.turbine.om.security.Role;
+import org.apache.turbine.services.security.TurbineSecurity;
+import org.apache.turbine.util.RunData;
+import org.apache.turbine.util.security.EntityExistsException;
+import org.apache.turbine.util.security.PermissionSet;
+import org.apache.turbine.util.security.UnknownEntityException;
+import org.apache.velocity.context.Context;
/**
* Action to manager roles in Turbine.
- *
+ *
* @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
*/
public class FluxRoleAction extends FluxAction
{
- public void doInsert(RunData data, TemplateContext context)
+ public void doInsert(RunData data, Context context)
throws Exception
{
//Role role = new Role();
@@ -95,7 +94,7 @@
* value alive.
*/
data.getParameters().add("mode", "insert");
- setTarget(data, "/role/FluxRoleForm.vm");
+ setTemplate(data, "/role/FluxRoleForm.vm");
}
}
@@ -105,14 +104,14 @@
* for integrity before allowing the user info
* to be update in the database.
*/
- public void doUpdate(RunData data, TemplateContext context)
+ public void doUpdate(RunData data, Context context)
throws Exception
{
Role role = TurbineSecurity.getRole(
data.getParameters().getString("name"));
-
+
data.getParameters().setProperties(role);
-
+
try
{
TurbineSecurity.saveRole(role);
@@ -131,7 +130,7 @@
* ActionEvent responsible for removing a user
* from the Tambora system.
*/
- public void doDelete(RunData data, TemplateContext context)
+ public void doDelete(RunData data, Context context)
throws Exception
{
Role role = TurbineSecurity.getRole(
@@ -155,7 +154,7 @@
* Update the roles that are to assigned to a user
* for a project.
*/
- public void doPermissions(RunData data, TemplateContext context)
+ public void doPermissions(RunData data, Context context)
throws Exception
{
/*
@@ -175,18 +174,18 @@
*/
Permission[] permissions = TurbineSecurity.getAllPermissions()
.getPermissionsArray();
-
+
String roleName = role.getName();
-
+
for (int i = 0; i < permissions.length; i++)
{
String permissionName = permissions[i].getName();
String rolePermission = roleName + permissionName;
-
+
String formRolePermission = data.getParameters().getString(rolePermission);
Permission permission = TurbineSecurity.getPermission(permissionName);
-
-
+
+
if (formRolePermission != null && !rolePermissions.contains(permission))
{
/*
@@ -194,8 +193,8 @@
* contain this permission. So assign the permission to
* the role.
*/
-
- System.out.println("adding " + permissionName + " to " + roleName);
+
+ System.out.println("adding " + permissionName + " to " + roleName);
role.grant(permission);
}
else if (formRolePermission == null && rolePermissions.contains(permission))
@@ -210,16 +209,16 @@
}
}
}
-
+
/**
* Implement this to add information to the context.
*
* @param data Turbine information.
- * @param TemplateContext context for web pages.
+ * @param context Context for web pages.
* @exception Exception, a generic exception.
*/
- public void doPerform( RunData data,TemplateContext context )
+ public void doPerform( RunData data,Context context )
throws Exception
{
System.out.println("Running do perform!");
1.6 +72 -61 jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/actions/user/FluxUserAction.java
Index: FluxUserAction.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/actions/user/FluxUserAction.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- FluxUserAction.java 1 Aug 2001 15:19:17 -0000 1.5
+++ FluxUserAction.java 17 Jul 2003 18:41:07 -0000 1.6
@@ -3,7 +3,7 @@
/* ====================================================================
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -55,73 +55,78 @@
*/
import java.util.Date;
-import org.apache.turbine.RunData;
-import org.apache.turbine.TemplateAction;
-import org.apache.turbine.TemplateContext;
-import org.apache.fulcrum.security.entity.User;
-import org.apache.fulcrum.security.entity.Group;
-import org.apache.fulcrum.security.entity.Role;
-import org.apache.fulcrum.security.util.EntityExistsException;
-import org.apache.fulcrum.security.util.UnknownEntityException;
-import org.apache.fulcrum.security.util.AccessControlList;
-import org.apache.fulcrum.security.TurbineSecurity;
+
import org.apache.turbine.flux.modules.actions.FluxAction;
+import org.apache.turbine.om.security.Group;
+import org.apache.turbine.om.security.Role;
+import org.apache.turbine.om.security.User;
+import org.apache.turbine.services.security.TurbineSecurity;
+import org.apache.turbine.util.RunData;
+import org.apache.turbine.util.security.AccessControlList;
+import org.apache.velocity.context.Context;
/**
* Action to manage users in Turbine.
- *
+ *
* @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
*/
-public class FluxUserAction
- extends FluxAction
+public class FluxUserAction extends FluxAction
{
/**
* ActionEvent responsible for inserting a new user
* into the Turbine security system.
*/
- public void doInsert(RunData data, TemplateContext context)
+ public void doInsert(RunData data, Context context)
throws Exception
{
- // Create a User object here, it will be
- // used even if there is an error. It will be
- // fed back into the context to give the user
- // the chance to correct any errors.
+ /*
+ * Create a TamboraUser object here, it will be
+ * used even if there is an error. It will be
+ * fed back into the context to give the user
+ * the chance to correct any errors.
+ */
User user = TurbineSecurity.getUserInstance();
data.getParameters().setProperties(user);
- // Grab the username entered in the form.
+ /*
+ * Grab the username entered in the form.
+ */
String username = data.getParameters().getString("username");
String password = data.getParameters().getString("password");
if (password == null)
- {
password = "";
- }
- // Make sure this account doesn't already exist.
- // If the account already exists then alert
- // the user and make them change the username.
+ /*
+ * Make sure this account doesn't already exist.
+ * If the account already exists then alert
+ * the user and make them change the username.
+ */
if (TurbineSecurity.accountExists(username))
{
context.put("username", username);
context.put("errorTemplate", "/screens/user/FluxUserAlreadyExists.vm");
context.put("user", user);
-
- // We are still in insert mode. So keep this
- // value alive.
+ /*
+ * We are still in insert mode. So keep this
+ * value alive.
+ */
data.getParameters().add("mode", "insert");
- setTarget(data, "/user/FluxUserForm.vm");
+ setTemplate(data, "/user/FluxUserForm.vm");
}
else
{
- // Set some default date properties, this needs
- // to be more rigourous.
+ /*
+ * Set some default date properties, this needs
+ * to be more rigourous.
+ */
+
Date now = new Date();
-
+
//user.setModifiedDate(now);
user.setCreateDate(now);
user.setLastLogin(new Date(0));
-
+
TurbineSecurity.addUser(user, password);
}
}
@@ -132,7 +137,7 @@
* for integrity before allowing the user info
* to be update in the database.
*/
- public void doUpdate(RunData data, TemplateContext context)
+ public void doUpdate(RunData data, Context context)
throws Exception
{
User user = TurbineSecurity.getUser(data.getParameters().getString("username"));
@@ -143,7 +148,7 @@
//user.setModifiedDate(now);
user.setCreateDate(now);
user.setLastLogin(new Date(0));
-
+
TurbineSecurity.saveUser(user);
}
@@ -151,12 +156,12 @@
* ActionEvent responsible for removing a user
* from the Tambora system.
*/
- public void doDelete(RunData data, TemplateContext context)
+ public void doDelete(RunData data, Context context)
throws Exception
{
User user = TurbineSecurity.getUser(
data.getParameters().getString("username"));
-
+
TurbineSecurity.removeUser(user);
}
@@ -164,47 +169,53 @@
* Update the roles that are to assigned to a user
* for a project.
*/
- public void doRoles(RunData data, TemplateContext context)
+ public void doRoles(RunData data, Context context)
throws Exception
{
- // Get the user we are trying to update. The username
- // has been hidden in the form so we will grab the
- // hidden username and use that to retrieve the
- // user.
+ /*
+ * Get the user we are trying to update. The username
+ * has been hidden in the form so we will grab the
+ * hidden username and use that to retrieve the
+ * user.
+ */
String username = data.getParameters().getString("username");
User user = TurbineSecurity.getUser(username);
AccessControlList acl = TurbineSecurity.getACL(user);
- // Grab all the Groups and Roles in the system.
+ /*
+ * Grab all the Groups and Roles in the system.
+ */
Group[] groups = TurbineSecurity.getAllGroups().getGroupsArray();
Role[] roles = TurbineSecurity.getAllRoles().getRolesArray();
-
+
for (int i = 0; i < groups.length; i++)
{
String groupName = groups[i].getName();
-
+
for (int j = 0; j < roles.length; j++)
{
- // In the UserRoleForm.vm we made a checkbox
- // for every possible Group/Role combination
- // so we will compare every possible combination
- // with the values that were checked off in
- // the form. If we have a match then we will
- // grant the user the role in the group.
+ /*
+ * In the UserRoleForm.vm we made a checkbox
+ * for every possible Group/Role combination
+ * so we will compare every possible combination
+ * with the values that were checked off in
+ * the form. If we have a match then we will
+ * grant the user the role in the group.
+ */
String roleName = roles[j].getName();
String groupRole = groupName + roleName;
-
+
String formGroupRole = data.getParameters().getString(groupRole);
-
+
if ( formGroupRole != null && !acl.hasRole(roles[j], groups[i]))
{
TurbineSecurity.grant(user, groups[i], roles[j]);
- }
+ }
else if (formGroupRole == null && acl.hasRole(roles[j], groups[i]))
{
TurbineSecurity.revoke(user, groups[i], roles[j]);
- }
+ }
}
}
}
@@ -213,10 +224,10 @@
* Implement this to add information to the context.
*
* @param data Turbine information.
- * @param TemplateContext context for web pages.
+ * @param context Context for web pages.
* @exception Exception, a generic exception.
*/
- public void doPerform( RunData data,TemplateContext context )
+ public void doPerform( RunData data,Context context )
throws Exception
{
System.out.println("Running do perform!");
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org