Author: painter Date: Mon Oct 24 20:07:26 2016 New Revision: 1766437 URL: http://svn.apache.org/viewvc?rev=1766437&view=rev Log: Updates to make out of box experience a little more pleasant. LoginUser action does not seem to work
Added: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/README.txt (with props) turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/sample-mysql-data/ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/sample-mysql-data/application-data.sql turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/sample-mysql-data/turbine-security-data.sql turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/SecureAction.java (with props) turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/SecureScreen.java (with props) turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/TestSecure.java (with props) turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/macros/ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/macros/applicationMacros.vm turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/navigations/Menu.vm turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/TestSecure.vm Modified: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/META-INF/maven/archetype-metadata.xml turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/pom.xml turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/Index.java turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/application-schema.xml turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/id-table-schema.xml turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/torque-security-schema.xml turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/Torque.properties turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/TurbineResources.properties turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/componentConfiguration.xml turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/log4j.properties turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/roleConfiguration.xml turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/layouts/Default.vm turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/Index.vm turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/Login.vm Modified: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/META-INF/maven/archetype-metadata.xml URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/META-INF/maven/archetype-metadata.xml?rev=1766437&r1=1766436&r2=1766437&view=diff ============================================================================== --- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/META-INF/maven/archetype-metadata.xml (original) +++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/META-INF/maven/archetype-metadata.xml Mon Oct 24 20:07:26 2016 @@ -39,8 +39,19 @@ <requiredProperty key="turbine_database_jndipath"> <defaultValue>java:comp/env/jdbc/Turbine</defaultValue> </requiredProperty> + <requiredProperty key="turbine_database_driver"> + <defaultValue>com.mysql.jdbc.Driver</defaultValue> + </requiredProperty> + <requiredProperty key="turbine_database_url"> + <defaultValue>jdbc:mysql://localhost:3306/</defaultValue> + </requiredProperty> + <requiredProperty key="turbine_database_user"> + <defaultValue>db_user</defaultValue> + </requiredProperty> + <requiredProperty key="turbine_database_password"> + <defaultValue>db_password</defaultValue> + </requiredProperty> </requiredProperties> - <fileSets> <fileSet filtered="true" packaged="true" encoding="UTF-8"> <directory>src/main/java</directory> @@ -49,6 +60,13 @@ <include>**/*.properties</include> </includes> </fileSet> + <fileSet filtered="false" packaged="false" encoding="UTF-8"> + <directory>docs</directory> + <includes> + <include>**/*.txt</include> + <include>**/*.sql</include> + </includes> + </fileSet> <fileSet filtered="true" packaged="false" encoding="UTF-8"> <directory>src/main/torque-schema</directory> <includes> Added: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/README.txt URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/README.txt?rev=1766437&view=auto ============================================================================== --- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/README.txt (added) +++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/README.txt Mon Oct 24 20:07:26 2016 @@ -0,0 +1,86 @@ +#* +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. +*# + + +Quick Guide to using the new Turbine 4.0-M2 maven archetype +for skeleton application generation + +You should have a local database installed and configured prior to +beginning the application setup below. + + +You can invoke the Maven archetype for turbine-webapp-4.0 from +the command line as shown below - please update values starting +with 'groupId' as appropriate. + +mvn archetype:generate \ + -DarchetypeGroupId=org.apache.turbine \ + -DarchetypeArtifactId=turbine-webapp-4.0 \ + -DarchetypeVersion=1.0.1-SNAPSHOT \ + -DgroupId=com.mycompany.webapp \ + -DartifactId=helloWorld \ + -Dversion=1.0 \ + -Dturbine_app_name=HelloWorld \ + -Dturbine_database_adapter=mysql \ + -Dturbine_database_user=db_username \ + -Dturbine_database_password=db_password \ + -Dturbine_database_name=helloWorld + + +Note that the database URL will be appended with your database name +in the final pom.xml, so you do not need to specify that in +the configuration. + +Next, you need to create the database in MySQL + + mysql -u <user> -p + mysql> create database helloWorld; + mysql> \q + + +cd helloWorld + +mvn generate-sources ## This will generate the OM layer and SQL + ## code for creating the corresponding + ## database tables + +mvn sql:execute ## This executes the SQL code to create + ## the application schema defined + ## in src/main/torque-schema + +You should now insert the sample data file provided as Torque 4.0 +has disabled the datasql task. + +mvn jetty:run ## Now you can launch your new Turbine application + +Open a web browser to http://localhost:8081/app + +To enable application development in Eclipse, run the following command +and then import the project into Eclipse. + +mvn eclipse:eclipse + +Once imported, update your project to be managed by Maven + -> Right click on the proejct name + -> Configure + -> Convert to Maven project + +To test the application can be deployed by Eclipse, select the run +configuration "Run On Server" if you have a container configured with +your eclipse environment. Propchange: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/README.txt ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/sample-mysql-data/application-data.sql URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/sample-mysql-data/application-data.sql?rev=1766437&view=auto ============================================================================== --- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/sample-mysql-data/application-data.sql (added) +++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/sample-mysql-data/application-data.sql Mon Oct 24 20:07:26 2016 @@ -0,0 +1,15 @@ + +## +## application-data.sql +## +## Torque will not autogenerate these files anymore - please run +## this SQL code maually to get your application up and running +## + +INSERT INTO AUTHOR (AUTH_ID, FIRST_NAME, LAST_NAME) values (1, 'Donald', 'Knuth'); +INSERT INTO AUTHOR (AUTH_ID, FIRST_NAME, LAST_NAME) values (2, 'Mickey', 'Mouse' ); +INSERT INTO AUTHOR (AUTH_ID, FIRST_NAME, LAST_NAME) values (3, 'Bill', 'Bryson' ); + +INSERT INTO BOOK ( BOOK_ID, AUTH_ID, TITLE, SUBJECT ) values ( 1, 1, 'The Art of Computer Programming', 'Computer Science'); +INSERT INTO BOOK ( BOOK_ID, AUTH_ID, TITLE, SUBJECT ) values ( 2, 2, 'Disney: Behind the Scenes', 'Fiction' ); +INSERT INTO BOOK ( BOOK_ID, AUTH_ID, TITLE, SUBJECT ) values ( 3, 3, 'A Walk in the Woods', 'Fiction'); \ No newline at end of file Added: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/sample-mysql-data/turbine-security-data.sql URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/sample-mysql-data/turbine-security-data.sql?rev=1766437&view=auto ============================================================================== --- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/sample-mysql-data/turbine-security-data.sql (added) +++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/sample-mysql-data/turbine-security-data.sql Mon Oct 24 20:07:26 2016 @@ -0,0 +1,43 @@ +## +## turbine-security-data.sql +## +## Torque will not autogenerate these files anymore - please run +## this SQL code maually to get your application up and running +## + +INSERT INTO TURBINE_USER (USER_ID,LOGIN_NAME,PASSWORD_VALUE,FIRST_NAME,LAST_NAME) + VALUES (1,'admin','password','','Admin'); + +INSERT INTO TURBINE_USER (USER_ID,LOGIN_NAME,PASSWORD_VALUE,FIRST_NAME,LAST_NAME) + VALUES (2,'user','password','','User'); + +INSERT INTO TURBINE_PERMISSION (PERMISSION_ID,PERMISSION_NAME) + VALUES (1,'TurbineAdmin'); + +INSERT INTO TURBINE_PERMISSION (PERMISSION_ID,PERMISSION_NAME) + VALUES (2,'Turbine'); + +INSERT INTO TURBINE_ROLE (ROLE_ID,ROLE_NAME) + VALUES (1,'TurbineAdmin'); + +INSERT INTO TURBINE_ROLE (ROLE_ID,ROLE_NAME) + VALUES (2,'TurbineUser'); + +INSERT INTO TURBINE_GROUP (GROUP_ID,GROUP_NAME) + VALUES (1,'global'); + +INSERT INTO TURBINE_GROUP (GROUP_ID,GROUP_NAME) + VALUES (2,'Turbine'); + +INSERT INTO TURBINE_ROLE_PERMISSION (ROLE_ID,PERMISSION_ID) + VALUES (1,1); + +INSERT INTO TURBINE_ROLE_PERMISSION (ROLE_ID,PERMISSION_ID) + VALUES (2,2); + +INSERT INTO TURBINE_USER_GROUP_ROLE (USER_ID,GROUP_ID,ROLE_ID) + VALUES (1,2,1); + +INSERT INTO TURBINE_USER_GROUP_ROLE (USER_ID,GROUP_ID,ROLE_ID) + VALUES (2,2,2); + Modified: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/pom.xml URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/pom.xml?rev=1766437&r1=1766436&r2=1766437&view=diff ============================================================================== --- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/pom.xml (original) +++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/pom.xml Mon Oct 24 20:07:26 2016 @@ -69,53 +69,53 @@ under the License. <targetDatabase>mysql</targetDatabase> </configuration> <executions> - <execution> - <id>torque-om</id> - <phase>generate-sources</phase> - <goals> - <goal>generate</goal> - </goals> - <configuration> - <packaging>classpath</packaging> - <configPackage>org.apache.torque.templates.om</configPackage> - <sourceDir>#var("basedir")/src/main/torque-schema</sourceDir> - <loglevel>error</loglevel> - <options> - <torque.database>mysql</torque.database> - <torque.om.package>${package}.om</torque.om.package> - <torque.om.addGetByNameMethods>false</torque.om.addGetByNameMethods> - <torque.om.save.saveException>TorqueException</torque.om.save.saveException> - <torque.om.useIsForBooleanGetters>true</torque.om.useIsForBooleanGetters> - <torque.om.useManagers>false</torque.om.useManagers> - <torque.om.addTimeStamp>true</torque.om.addTimeStamp> - <torque.om.objectIsCaching>true</torque.om.objectIsCaching> - <torque.om.save.addSaveMethods>true</torque.om.save.addSaveMethods> - <torque.om.addGetByNameMethods>true</torque.om.addGetByNameMethods> - <torque.om.complexObjectModel>true</torque.om.complexObjectModel> - </options> - <outputDirMap> - <modifiable>#var("project.build.sourceDirectory")</modifiable> - </outputDirMap> - </configuration> - </execution> - <execution> - <id>torque-sql-${turbine_database_adapter}</id> - <phase>package</phase> - <goals> - <goal>generate</goal> - </goals> - <configuration> - <packaging>classpath</packaging> - <configPackage>org.apache.torque.templates.sql</configPackage> - <sourceDir>#var("basedir")/src/main/torque-schema</sourceDir> - <defaultOutputDir>#var("project.build.directory")/generated-sql/torque/${turbine_database_adapter}</defaultOutputDir> - <defaultOutputDirUsage>none</defaultOutputDirUsage> - <loglevel>error</loglevel> - <options> - <torque.database>${turbine_database_adapter}</torque.database> - </options> - </configuration> - </execution> + <execution> + <id>torque-om</id> + <phase>generate-sources</phase> + <goals> + <goal>generate</goal> + </goals> + <configuration> + <packaging>classpath</packaging> + <configPackage>org.apache.torque.templates.om</configPackage> + <sourceDir>#var("basedir")/src/main/torque-schema</sourceDir> + <loglevel>error</loglevel> + <options> + <torque.database>${turbine_database_adapter}</torque.database> + <torque.om.package>${package}.om</torque.om.package> + <torque.om.addGetByNameMethods>false</torque.om.addGetByNameMethods> + <torque.om.save.saveException>TorqueException</torque.om.save.saveException> + <torque.om.useIsForBooleanGetters>true</torque.om.useIsForBooleanGetters> + <torque.om.useManagers>false</torque.om.useManagers> + <torque.om.addTimeStamp>true</torque.om.addTimeStamp> + <torque.om.objectIsCaching>true</torque.om.objectIsCaching> + <torque.om.save.addSaveMethods>true</torque.om.save.addSaveMethods> + <torque.om.addGetByNameMethods>true</torque.om.addGetByNameMethods> + <torque.om.complexObjectModel>true</torque.om.complexObjectModel> + </options> + <outputDirMap> + <modifiable>#var("project.build.sourceDirectory")</modifiable> + </outputDirMap> + </configuration> + </execution> + <execution> + <id>torque-sql-${turbine_database_adapter}</id> + <phase>generate-sources</phase> + <goals> + <goal>generate</goal> + </goals> + <configuration> + <packaging>classpath</packaging> + <configPackage>org.apache.torque.templates.sql</configPackage> + <sourceDir>#var("basedir")/src/main/torque-schema</sourceDir> + <defaultOutputDir>#var("project.build.directory")/generated-sql/torque/${turbine_database_adapter}</defaultOutputDir> + <defaultOutputDirUsage>none</defaultOutputDirUsage> + <loglevel>error</loglevel> + <options> + <torque.database>${turbine_database_adapter}</torque.database> + </options> + </configuration> + </execution> </executions> <dependencies> <dependency> @@ -139,6 +139,41 @@ under the License. <!-- containerConfigXML>WEB-INF/build/context.xml</containerConfigXML --> </configuration> </plugin> + + + <!-- Required to execute torque database build --> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>sql-maven-plugin</artifactId> + <version>1.5</version> + <configuration> + + <!-- Please update with your database configuration --> + <driver>${turbine_database_driver}</driver> + <url>${turbine_database_url}${turbine_database_name}</url> + <username>${turbine_database_user}</username> + <password>${turbine_database_password}</password> + <onError>continue</onError> + <autocommit>true</autocommit> + <fileset> + <basedir>${project.build.directory}/generated-sql/torque/${turbine_database_adapter}</basedir> + <!-- basedir>${basedir}/target/generated-sql</basedir --> + <includes> + <include>*.sql</include> + </includes> + </fileset> + </configuration> + + <!-- update with your database driver dependency --> + <dependencies> + <dependency> + <artifactId>mysql-connector-java</artifactId> + <groupId>mysql</groupId> + <version>5.1.40</version> + </dependency> + </dependencies> + </plugin> + <!-- jetty:run checks deployed war http://localhost:8081/app/ @@ -165,6 +200,13 @@ under the License. </build> <dependencies> + + <!-- update with the database driver of your choice --> + <dependency> + <artifactId>mysql-connector-java</artifactId> + <groupId>mysql</groupId> + <version>5.1.40</version> + </dependency> <dependency> <groupId>javax.activation</groupId> <artifactId>activation</artifactId> Added: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/SecureAction.java URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/SecureAction.java?rev=1766437&view=auto ============================================================================== --- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/SecureAction.java (added) +++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/SecureAction.java Mon Oct 24 20:07:26 2016 @@ -0,0 +1,84 @@ +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. +*# + +import org.apache.fulcrum.security.SecurityService; +import org.apache.fulcrum.security.model.turbine.TurbineAccessControlListImpl; +import org.apache.turbine.modules.actions.VelocitySecureAction; +import org.apache.turbine.om.security.User; +import org.apache.turbine.pipeline.PipelineData; +import org.apache.velocity.context.Context; + +/** + * Velocity Secure action. + * + * Always performs a Security Check that you've defined before executing the + * doBuildtemplate(). + */ +public class SecureAction extends VelocitySecureAction { + + protected SecurityService securityService; + + /** + * 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 + TurbineAccessControlListImpl acl = (TurbineAccessControlListImpl) getRunData(data).getACL(); + + if (acl == null || !acl.hasRole("TurbineAdmin")) { + getRunData(data).setMessage("You do not have permission to access this action"); + isAuthorized = false; + } else if (acl.hasRole("admin")) { + 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 data, Context context) throws Exception { + + } +} Propchange: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/SecureAction.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/Index.java URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/Index.java?rev=1766437&r1=1766436&r2=1766437&view=diff ============================================================================== --- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/Index.java (original) +++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/Index.java Mon Oct 24 20:07:26 2016 @@ -20,7 +20,6 @@ package ${package}.modules.screens; import org.apache.turbine.pipeline.PipelineData; import org.apache.velocity.context.Context; - import org.apache.turbine.modules.screens.VelocitySecureScreen; /** Added: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/SecureScreen.java URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/SecureScreen.java?rev=1766437&view=auto ============================================================================== --- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/SecureScreen.java (added) +++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/SecureScreen.java Mon Oct 24 20:07:26 2016 @@ -0,0 +1,76 @@ +package ${package}.modules.screens; +#* +* 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. +*# + + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.turbine.Turbine; +import org.apache.turbine.modules.screens.VelocitySecureScreen; +import org.apache.turbine.om.security.User; +import org.apache.turbine.pipeline.PipelineData; +import org.apache.turbine.services.TurbineServices; +import org.apache.turbine.services.security.SecurityService; +import org.apache.turbine.services.security.TurbineSecurity; +import org.apache.fulcrum.security.acl.AccessControlList; +import org.apache.fulcrum.security.model.turbine.TurbineAccessControlListImpl; +import org.apache.velocity.context.Context; + +/** + * This class provides a sample implementation for creating a secured screen + */ +public class SecureScreen extends VelocitySecureScreen { + // create an instance of the logging facility + private static Log log = LogFactory.getLog(SecureScreen.class); + + protected SecurityService securityService; + + @Override + protected boolean isAuthorized(PipelineData data) throws Exception { + boolean isAuthorized = false; + + // Load the security service + securityService = (SecurityService) TurbineServices.getInstance().getService(SecurityService.SERVICE_NAME); + + // Who is our current user? + User user = getRunData(data).getUser(); + + // Get the Turbine ACL implementation + TurbineAccessControlListImpl acl = (TurbineAccessControlListImpl) getRunData(data).getACL(); + + if (acl == null) { + getRunData(data).setScreenTemplate(Turbine.getConfiguration().getString("template.login")); + isAuthorized = false; + } else if (acl.hasRole("TurbineAdmin")) { + isAuthorized = true; + } else { + getRunData(data).setScreenTemplate(Turbine.getConfiguration().getString("template.home")); + getRunData(data).setMessage("You do not have access to this part of the site."); + isAuthorized = false; + } + return isAuthorized; + } + + @Override + protected void doBuildTemplate(PipelineData data, Context context) throws Exception { + // TODO Auto-generated method stub + + } + +} Propchange: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/SecureScreen.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/TestSecure.java URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/TestSecure.java?rev=1766437&view=auto ============================================================================== --- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/TestSecure.java (added) +++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/TestSecure.java Mon Oct 24 20:07:26 2016 @@ -0,0 +1,48 @@ +package ${package}.modules.screens; +#* +* 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. +*# + +import java.util.ArrayList; +import java.util.List; +import org.apache.torque.criteria.Criteria; +import org.apache.turbine.pipeline.PipelineData; +import org.apache.velocity.context.Context; + +/** + * This class provides the data required for displaying content in the + * Velocity page. + */ +public class TestSecure extends SecureScreen +{ + /** + * This method is called by the Turbine framework when the + * associated Velocity template, Index.vm is requested + * + * @param data the Turbine request data + * @param context the Velocity context + * @throws Exception a generic Exception + */ + @Override + protected void doBuildTemplate(PipelineData data, Context context) + throws Exception + { + context.put("success", "Congratulations, it worked!"); + } + +} Propchange: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/TestSecure.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/application-schema.xml URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/application-schema.xml?rev=1766437&r1=1766436&r2=1766437&view=diff ============================================================================== --- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/application-schema.xml (original) +++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/application-schema.xml Mon Oct 24 20:07:26 2016 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" standalone="no" ?> -#* +<!-- 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 @@ -16,21 +16,38 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -*# -<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database_3_3.dtd"> +--> <!-- ============================================================================== --> <!-- --> <!-- Database Definition for the Application --> <!-- --> -<!-- @version $Id: application-schema.xml 615328 2008-01-25 20:25:05Z tv $ --> +<!-- @version $Id: application-schema.xml --> <!-- --> <!-- ============================================================================== --> -<database name="${turbine_database_name}"> - <table name="table1" idMethod="idbroker"> - <column name="test_col1" type="INTEGER" /> - <column name="test_col2" type="VARCHAR" size="10" /> - <!-- Add your database schema here --> - </table> +<database xmlns="http://db.apache.org/torque/4.0/templates/database" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://db.apache.org/torque/4.0/templates/database + http://db.apache.org/torque/4.0/templates/database-strict.xsd" + name="${turbine_database_name}" + defaultIdMethod="native"> + + + <!-- Simple author/book database example --> + <table name="AUTHOR" idMethod="idbroker"> + <column name="AUTH_ID" required="true" primaryKey="true" type="INTEGER" /> + <column name="FIRST_NAME" required="true" size="64" type="VARCHAR" /> + <column name="LAST_NAME" required="true" size="64" type="VARCHAR" /> + </table> + + <table name="BOOK" idMethod="idbroker"> + <column name="BOOK_ID" required="true" primaryKey="true" type="INTEGER" /> + <column name="AUTH_ID" required="true" type="INTEGER" /> + <column name="TITLE" required="true" size="64" type="VARCHAR" /> + <column name="SUBJECT" required="true" size="64" type="VARCHAR" /> + <foreign-key foreignTable="AUTHOR"> + <reference local="AUTH_ID" foreign="AUTH_ID"></reference> + </foreign-key> + </table> </database> Modified: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/id-table-schema.xml URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/id-table-schema.xml?rev=1766437&r1=1766436&r2=1766437&view=diff ============================================================================== --- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/id-table-schema.xml (original) +++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/id-table-schema.xml Mon Oct 24 20:07:26 2016 @@ -17,7 +17,6 @@ specific language governing permissions and limitations under the License. --> -<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database_3_3.dtd"> <!-- ========================================================================= --> <!-- --> @@ -27,11 +26,13 @@ <!-- --> <!-- ========================================================================= --> -<database name="@DATABASE_DEFAULT@" - defaultIdMethod="idbroker" - defaultJavaType="primitive" - defaultJavaNamingMethod="underscore" - package="@DATABASE_PACKAGE@"> +<database xmlns="http://db.apache.org/torque/4.0/templates/database" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://db.apache.org/torque/4.0/templates/database + http://db.apache.org/torque/4.0/templates/database-strict.xsd" + name="${turbine_database_name}" + defaultIdMethod="native"> + <table name="ID_TABLE" idMethod="idbroker"> <column name="ID_TABLE_ID" required="true" primaryKey="true" type="INTEGER" javaName="IdTableId"/> <column name="TABLE_NAME" required="true" size="255" type="VARCHAR" javaName="TableName"/> Modified: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/torque-security-schema.xml URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/torque-security-schema.xml?rev=1766437&r1=1766436&r2=1766437&view=diff ============================================================================== --- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/torque-security-schema.xml (original) +++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/torque-security-schema.xml Mon Oct 24 20:07:26 2016 @@ -17,7 +17,7 @@ specific language governing permissions and limitations under the License. --> -<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database_3_3.dtd"> + <!-- ======================================================================== --> <!-- --> @@ -27,7 +27,13 @@ <!-- --> <!-- ======================================================================== --> -<database name="${turbine_database_name}"> +<database xmlns="http://db.apache.org/torque/4.0/templates/database" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://db.apache.org/torque/4.0/templates/database + http://db.apache.org/torque/4.0/templates/database-strict.xsd" + name="${turbine_database_name}" + defaultIdMethod="native"> + <table name="TURBINE_PERMISSION" idMethod="idbroker"> <column name="PERMISSION_ID" required="true" primaryKey="true" type="INTEGER"/> @@ -80,7 +86,7 @@ <column name="LAST_NAME" required="true" size="64" type="VARCHAR"/> <column name="EMAIL" size="64" type="VARCHAR"/> <column name="CONFIRM_VALUE" size="16" type="VARCHAR" javaName="Confirmed"/> - <column name="MODIFIEDDATE" type="TIMESTAMP" javaName="ModifiedDate"/> + <column name="MODIFIED_DATE" type="TIMESTAMP" javaName="ModifiedDate"/> <column name="CREATED" type="TIMESTAMP" javaName="CreateDate"/> <column name="LAST_LOGIN" type="TIMESTAMP"/> <column name="OBJECTDATA" type="VARBINARY"/> Modified: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/Torque.properties URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/Torque.properties?rev=1766437&r1=1766436&r2=1766437&view=diff ============================================================================== --- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/Torque.properties (original) +++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/Torque.properties Mon Oct 24 20:07:26 2016 @@ -35,14 +35,40 @@ # configure these properly. # ------------------------------------------------------------------- -torque.database.default=${turbine_database_name} -torque.database.turbine.adapter=${turbine_database_adapter} - -# Using JNDI +# +# For JNDI configuration please see: https://db.apache.org/torque/torque-4.0/documentation/orm-reference/initialisation-configuration.html +# +# torque.dsfactory.${turbine_database_name}.factory=org.apache.torque.dsfactory.JndiDataSourceFactory torque.dsfactory.${turbine_database_name}.jndi.path=${turbine_database_jndipath} torque.dsfactory.${turbine_database_name}.jndi.ttl=300000 +# ------------------------------------------------------------------- +# +# Shared Pool Data Source Factory +# +# ------------------------------------------------------------------- +#torque.database.default=${turbine_database_name} +#torque.database.${turbine_database_name}.adapter=${turbine_database_adapter} +#torque.database.${turbine_database_name}.user=${turbine_database_user} +#torque.database.${turbine_database_name}.password=${turbine_database_password} +# +#torque.defaults.pool.maxActive = 30 +#torque.defaults.pool.testOnBorrow = true +#torque.defaults.pool.validationQuery = SELECT 1 +# +#torque.defaults.connection.driver = ${turbine_database_driver} +#torque.defaults.connection.url = ${turbine_database_url}${turbine_database_name} +#torque.defaults.connection.user = ${turbine_database_user} +#torque.defaults.connection.password = ${turbine_database_password} +# +#torque.dsfactory.${turbine_database_name}.connection.driver = ${turbine_database_driver} +#torque.dsfactory.${turbine_database_name}.connection.url = ${turbine_database_url}${turbine_database_name} +#torque.dsfactory.${turbine_database_name}.connection.user = ${turbine_database_user} +#torque.dsfactory.${turbine_database_name}.connection.password = ${turbine_database_password} +#torque.dsfactory.${turbine_database_name}.factory=org.apache.torque.dsfactory.SharedPoolDataSourceFactory +# ------------------------------------------------------------------- + # Determines if the quantity column of the IDBroker's id_table should # be increased automatically if requests for ids reaches a high # volume. @@ -51,5 +77,47 @@ torque.idbroker.cleverquantity=true # Determines whether the managers cache instances of the business objects. # And also whether the MethodResultCache will really cache results. - torque.manager.useCache = true + +# Determines if IDBroker should prefetch IDs or not. If set to false +# this property has the effect of shutting off the housekeeping thread +# that attempts to prefetch the id's. It also sets the # of id's grabbed +# per request to 1 regardless of the settings in the database. +# Default: true +torque.idbroker.prefetch = true + +# Controls the starting id of table entries when creating SQL for +# the id-table. If you have two projects that use the same id-table +# in the same database with different tables, make sure that they have +# different initialID settings and the ranges (initialID is incremented +# for every new table) don't overlap. +torque.idbroker.initialId = 101 + +# The start value of the ID broker for supplying IDs to Torque. This value +# is incremented every time Torque requests ID keys from the broker. If you +# pre-load your table straight from SQL, make sure that you don't accidentially +# overlap with this setting, because Torque doesn't keep record of what IDs are +# already taken in the database. If you overlap, inserting new objects will fail +# because the ID assigned by Torque is already taken. +torque.idBroker.initialIdValue = 100 + +# For performance reasons, the ID Broker does not request a single ID at a time +# but fetches a whole range and increments the current next ID Value in the ID +# Table by this step. If you have to do lots of inserts straight in a row, increment +# this value to get slightly better performance. +torque.idbroker.initialIdStep = 500 + +# IDBroker can grab its own connection from the pool to use when retrieving +# more id's to minimize the amount of time ID_TABLE will be locked. +# Some usage of IDBroker or assumptions made by connection pools or jdbc +# drivers may disallow this optimization in which case the property +# should be set to false. +torque.idbroker.usenewconnection = true + +# Uncomment if using shared data source factory +#torque.database.default=${turbine_database_name} + + + + + Modified: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/TurbineResources.properties URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/TurbineResources.properties?rev=1766437&r1=1766436&r2=1766437&view=diff ============================================================================== --- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/TurbineResources.properties (original) +++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/TurbineResources.properties Mon Oct 24 20:07:26 2016 @@ -566,7 +566,7 @@ services.VelocityService.input.encoding= # # Class Path Loader, Turbine jar -services.VelocityService.velocimacro.library = macros/TurbineMacros.vm +services.VelocityService.velocimacro.library = macros/TurbineMacros.vm,macros/applicationMacros.vm # Set the following line to true to cause velocity to automatically reload # library macro files if they change. This is useful for debugging. Modified: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/componentConfiguration.xml URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/componentConfiguration.xml?rev=1766437&r1=1766436&r2=1766437&view=diff ============================================================================== --- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/componentConfiguration.xml (original) +++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/componentConfiguration.xml Mon Oct 24 20:07:26 2016 @@ -37,6 +37,7 @@ <bundle>${package}.L10N</bundle> </bundles> </localization> + <!-- Disable if you experience startup problems with Java8 --> <intake> <serialDataPath>WEB-INF/appData.ser</serialDataPath> <xmlPaths> Modified: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/log4j.properties URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/log4j.properties?rev=1766437&r1=1766436&r2=1766437&view=diff ============================================================================== --- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/log4j.properties (original) +++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/log4j.properties Mon Oct 24 20:07:26 2016 @@ -79,7 +79,7 @@ log4j.additivity.velocity = false log4j.appender.app = org.apache.log4j.RollingFileAppender log4j.appender.app.MaxFileSize=5MB log4j.appender.app.MaxBackupIndex=5 -log4j.appender.app.file = #var("catalina.base")/logs/application.log +log4j.appender.app.file = ${applicationRoot}/logs/application.log log4j.appender.app.layout = org.apache.log4j.PatternLayout log4j.appender.app.layout.conversionPattern = %d [%t] %-5p %c - %m%n log4j.appender.app.append = false @@ -90,7 +90,7 @@ log4j.appender.app.append = false log4j.appender.turbine = org.apache.log4j.RollingFileAppender log4j.appender.turbine.MaxFileSize=5MB log4j.appender.turbine.MaxBackupIndex=5 -log4j.appender.turbine.file = #var("catalina.base")/logs/turbine.log +log4j.appender.turbine.file = ${applicationRoot}/logs/turbine.log log4j.appender.turbine.layout = org.apache.log4j.PatternLayout log4j.appender.turbine.layout.conversionPattern = %d [%t] %-5p %c - %m%n log4j.appender.turbine.append = false @@ -99,7 +99,7 @@ log4j.appender.turbine.append = false # sql.log # log4j.appender.sql = org.apache.log4j.RollingFileAppender -log4j.appender.sql.file = #var("catalina.base")/logs/sql.log +log4j.appender.sql.file = ${applicationRoot}/logs/sql.log log4j.appender.sql.MaxFileSize=5MB log4j.appender.sql.MaxBackupIndex=5 log4j.appender.sql.layout = org.apache.log4j.PatternLayout @@ -119,7 +119,7 @@ log4j.appender.console.layout.conversion log4j.appender.torque = org.apache.log4j.RollingFileAppender log4j.appender.torque.MaxFileSize=5MB log4j.appender.torque.MaxBackupIndex=5 -log4j.appender.torque.file = #var("catalina.base")/logs/torque.log +log4j.appender.torque.file = ${applicationRoot}/logs/torque.log log4j.appender.torque.layout = org.apache.log4j.PatternLayout log4j.appender.torque.layout.conversionPattern = %d [%t] %-5p %c - %m%n log4j.appender.torque.append = false @@ -131,7 +131,7 @@ log4j.appender.torque.append = false log4j.appender.velocity = org.apache.log4j.RollingFileAppender log4j.appender.velocity.MaxFileSize=5MB log4j.appender.velocity.MaxBackupIndex=5 -log4j.appender.velocity.file = #var("catalina.base")/logs/velocity.log +log4j.appender.velocity.file = ${applicationRoot}/logs/velocity.log log4j.appender.velocity.layout = org.apache.log4j.PatternLayout log4j.appender.velocity.layout.conversionPattern = %d [%t] %-5p %c - %m%n log4j.appender.velocity.append = false Modified: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/roleConfiguration.xml URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/roleConfiguration.xml?rev=1766437&r1=1766436&r2=1766437&view=diff ============================================================================== --- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/roleConfiguration.xml (original) +++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/roleConfiguration.xml Mon Oct 24 20:07:26 2016 @@ -44,6 +44,7 @@ shorthand="localization" default-class="org.apache.fulcrum.localization.DefaultLocalizationService"/> + <!-- Disable if you experience startup problems with Java8 --> <role name="org.apache.fulcrum.intake.IntakeService" shorthand="intake" Modified: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/layouts/Default.vm URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/layouts/Default.vm?rev=1766437&r1=1766436&r2=1766437&view=diff ============================================================================== --- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/layouts/Default.vm (original) +++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/layouts/Default.vm Mon Oct 24 20:07:26 2016 @@ -14,16 +14,44 @@ ## KIND, either express or implied. See the License for the ## specific language governing permissions and limitations ## under the License. + +$page.addStyleSheet("http://www.w3schools.com/lib/w3.css") +$page.addStyleSheet("http://www.w3schools.com/lib/w3-theme-blue-grey.css") +$page.setTitle("Sample Apache Turbine Application") + + <html> + #TurbineHtmlHead() -<body #TurbineHtmlBodyAttributes() > - <table bgcolor="$ui.bgcolor" width="100%"> - <tr> - <td> </td> - <td align="right"><img src="$ui.image('turbine-project.png')"/></td> - </tr> - </table> -$screen_placeholder - <img src="$ui.image('powered-by-logo.gif')"/> + +<body #TurbineHtmlBodyAttributes() class="w3-theme-l4"> + + <div class="w3-wrapper"> + + <!-- Header --> + <header class="w3-container w3-center w3-padding-32 w3-theme"> + <img class="w3-right" src="$ui.image('turbine-project.png')" /> + #if ( $data.getUser().hasLoggedIn() ) + #set ( $u = $data.getUser() ) + <div class="w3-right"> + <h5>Hello $!u.FirstName</h5> + </div> + #end + </header> + + <!-- Default Menu --> + $navigation.setTemplate("/Menu.vm") + + <!-- Content --> + <div class="w3-left w3-padding" id="content"> + $screen_placeholder + </div> + + <!-- Footer --> + <footer class="w3-bottom"> + <p>Powered by <img src="$ui.image('powered-by-logo.gif')"/></p> + </footer> + </div> + </body> </html> Added: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/macros/applicationMacros.vm URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/macros/applicationMacros.vm?rev=1766437&view=auto ============================================================================== --- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/macros/applicationMacros.vm (added) +++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/macros/applicationMacros.vm Mon Oct 24 20:07:26 2016 @@ -0,0 +1,151 @@ +## 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. + +## +## $Id: TurbineMacros.vm 222027 2016-10-20 16:11:37Z painter $ +## +## Put your Application macros in this file. +## + +#* ------------------------------------------------------------------ +# Global Macros +*# ------------------------------------------------------------------ + +#* ------------------------------------------------------------------ +# Drop down select option for yes/no questions +*# ------------------------------------------------------------------ +#macro (selectYesNo $label $selection) + <select name="$label"> + #if ( $selection == "true" ) + <option value="1" selected>Yes</option> + <option value="0">No</option> + #else + <option value="1">Yes</option> + <option value="0" selected>No</option> + #end + </select> +#end + + +#* ------------------------------------------------------------------ +# Standard action form controls - Using w3.css styling +*# ------------------------------------------------------------------ + +#macro (insert) + <input type="submit" name="eventSubmit_doInsert" value="Insert"/> +#end + +#macro (save) + <input type="submit" name="eventSubmit_doUpdate" value="Update"/> +#end + +#macro (remove) + <input type="submit" name="eventSubmit_doDelete" value="Remove"/> +#end + + +#macro (warning $msg) +<div class="w3-panel w3-orange w3-card-8"> + $msg +</div> +#end + +#macro (error $msg) +<div class="w3-panel w3-red w3-card-8"> + $msg +</div> +#end + +#macro(info $msg) +<div class="w3-panel w3-blue w3-card-8"> + $msg +</div> +#end + + +#* ------------------------------------------------------------------ +# +# Macros that are used for displaying input forms. Using w3.css styling +# +*# ------------------------------------------------------------------ + +#macro (formLabel $label) + <label>$!label</label> +#end + +#macro (fileUpload $label $name) + <label>$!label</label> + <input class="w3-input" type="file" name="$!name"> +#end + +#macro (formCheckBox $label $name $checked) + #formLabel( $label ) + #checkBox( $name $checked ) +#end + +#macro (checkBox $name $checked) + <input id="$!name" class="w3-check" type="checkbox" checked="$!checked"> +#end + +#macro (formLabelRequired $label) + <label class="w3-label w3-validate">$!label</label> +#end + +#macro (formTextField $name $value) + <input class="w3-input" type="text" name="$!name" value="$!value"> +#end + +#macro (smallFormTextField $name $value) + <input class="w3-input" type="text" name="$!name" value="$!value"> +#end + +#macro (textField $name $value) + <input class="w3-input" type="text" name="$!name" value="$!value"> +#end + +#macro (textareaField $label $name $value) + <p> + <label class="w3-label">$label</label> + <textarea class="w3-input" style="width:90%" rows="6" name="$name" required>$!value</textarea> + </p> + +#end + +#macro (formPasswordCell $label $name $value) + <p> + #formLabel( $label ) + <input class="w3-input" type="password" name="$!name" value="$!value"> + </p> +#end + +#macro (formCellRequired $label $name $value) + <p> + #formLabelRequired($label) + #formTextField($name $value) + </p> +#end + +#macro (formCell $label $name $value) + #formLabel($label) + #formTextField($name $value) +#end + +#macro (smallFormCell $label $name $value) + #formLabel($label) + #smallFormTextField($name $value) +#end + Added: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/navigations/Menu.vm URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/navigations/Menu.vm?rev=1766437&view=auto ============================================================================== --- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/navigations/Menu.vm (added) +++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/navigations/Menu.vm Mon Oct 24 20:07:26 2016 @@ -0,0 +1,44 @@ +## 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. + + +#if ( $data.getUser().hasLoggedIn() ) +<nav class="w3-navbar w3-theme"> + <li><a href="$link.setPage("Index.vm")">Home</a></li> + <li class="w3-dropdown-hover"> + <a href="#">Administration <i class="fa fa-caret-down"></i></a> + <div class="w3-dropdown-content w3-white w3-card-4"> + ## every user can change their password + <a href="$link.setPage("user,Password.vm")">Update Password <i class="fa fa-unlock"></i></a> + + #if ( $data.getACL().hasRole("admin") ) + <a href="$link.setPage("user,FluxUserList.vm")">User List <div class="w3-right"><i class="fa fa-users"></i></div></a> + <a href="$link.setPage("role,FluxRoleList.vm")">User Roles <div class="w3-right"><i class="fa fa-user-plus"></i></div></a> + <a href="$link.setPage("user,FluxUserForm.vm")?mode=insert">Add User <div class="w3-right"><i class="fa fa-user"></i></div></a> + #end + </div> + </li> + + <li class="w3-right"><a href="$link.setAction("LogoutUser")">Logout</a></li> +</nav> +#else +<nav class="w3-navbar w3-theme"> + <li><a href="$link.setPage("Index.vm")">Home</a></li> + <li class="w3-right"><a href="$link.setPage("Login.vm")">Login</a></li> +</nav> + +#end Modified: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/Index.vm URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/Index.vm?rev=1766437&r1=1766436&r2=1766437&view=diff ============================================================================== --- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/Index.vm (original) +++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/Index.vm Mon Oct 24 20:07:26 2016 @@ -15,27 +15,25 @@ ## specific language governing permissions and limitations ## under the License. -<div align="center"><h1>$success</h1></div> -You're now successfully running a <a -href="http://turbine.apache.org/">Turbine</a> based -application, deployed to <font color="red">$data.ServerData.ContextPath</a></font> on -your web container.<p/> - -You can (and should!) change or remove this page at any time. It is -intended to give you immediate feedback if you just deployed an newly -setup Turbine application.</p> - -Login here - -<form method="post" enctype="application/x-www-form-urlencoded" name="loginForm" id="loginForm"> - <fieldset> - <legend>Login</legend> - <input name="action" type="hidden" value="LoginUser"> - <label for="username">Username</label> - <input type="text" id="username" name="username" value="" tabindex="1" autocomplete="off" autofocus=""> - <label for="password">Password</label> - <input type="password" id="password" name="password" value="" tabindex="2" autocomplete="off"> - <input type="submit" id="submitLogin" value="Login" tabindex="3"> - </fieldset> -</form> + + +#if ( $data.getMessage() ) + #info( $data.getMessage() ) +#end + + <div align="center"><h1>$success</h1></div> + + <p> + You're now successfully running a <a href="http://turbine.apache.org/">Turbine</a> based + application, deployed to <font color="red">$data.ServerData.ContextPath</a></font> on + your web container. + </p> + + <p> + You can (and should!) change or remove this page at any time. It is + intended to give you immediate feedback if you just deployed an newly + setup Turbine application. + </p> + + <a href="$link.setPage("TestSecure.vm")">Test a secure access page</a> Modified: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/Login.vm URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/Login.vm?rev=1766437&r1=1766436&r2=1766437&view=diff ============================================================================== --- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/Login.vm (original) +++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/Login.vm Mon Oct 24 20:07:26 2016 @@ -15,14 +15,55 @@ ## specific language governing permissions and limitations ## under the License. -<div align="center"><h1>Welcome </h1></div> -User created : $data.user.createDate -User lastLogin : $data.user.lastLogin -<form method="post" name="logoutForm" id="logoutForm"> - <fieldset> - <legend>Logout</legend> - <input name="action" type="hidden" value="LogoutUser"> - <input type="submit" id="submitLogout" value="Logout" tabindex="1"> - </fieldset> -</form> +## +## If you want to use intake to process the data, uncomment below +## +## #set ( $loginGroup = $intake.Login.Default ) +## +## #if (!$loginGroup.Username.isValid() ) +## #info( "$loginGroup.Username.Message" ) +## #end +## +## #if ( !$loginGroup.Password.isValid() ) +## #info("$loginGroup.Password.Message" ) +## #end + +<p/> + + + <div class="w3-display-middle w3-card-8 w3-center w3-light-grey" style="max-width: 500px"> + + <form class="w3-container w3-light-grey" name="login" method="post" action="$link.setAction("LoginUser").setPage("TestSecure.vm")"> + <div class="w3-section"> + + <p> + <!-- input class="w3-input w3-border" style="margin: auto; width: 200px;" placeholder="Username" type="text" name="$loginGroup.Username.Key" value="$!loginGroup.Username" --> + <input class="w3-input w3-border" style="margin: auto; width: 200px;" placeholder="Username" type="text" name="username" value="" tabindex="1" autocomplete="off" autofocus=""> + </p> + + <p> + <input class="w3-input w3-border" style="margin: auto; width: 200px;" placeholder="Password" type="password" name="password" value="" tabindex="2" autocomplete="off"> + </p> + + <button type="submit" name="submit" id="submit" value="eventSubmit_doPerform" class="w3-ripple">Sign in</button> + + <p/> + + + </div> + </form> + + <div class="w3-container w3-border-top w3-padding-16 w3-light-grey"> + <span class="w3-right w3-padding w3-hide-small">Forgot <a href="#">password?</a></span> + </div> + + ## Display System messages here if there are any + #if($data.getMessage()) + #info( $data.getMessage() ) <br/> + #end + + </div> + + +## $intake.declareGroups() Added: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/TestSecure.vm URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/TestSecure.vm?rev=1766437&view=auto ============================================================================== --- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/TestSecure.vm (added) +++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/TestSecure.vm Mon Oct 24 20:07:26 2016 @@ -0,0 +1,5 @@ +#if ( $data.getMessage() ) + #info( $data.getMessage() ) +#end + +<h1> Secured Access Page </h1>