Author: gk
Date: Tue Aug 8 14:46:03 2017
New Revision: 1804430
URL: http://svn.apache.org/viewvc?rev=1804430&view=rev
Log:
- added showcase Turbine localization, wrapper (JSON), css and Torque model
reading
- updated Turbine images
Added:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/ShowRecords.java
(with props)
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/wrapper/
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/wrapper/TurbineUserWrapper.java
(with props)
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/images/pb-turbine100px.png
(with props)
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/images/turbine4-project.png
(with props)
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/page.css
(with props)
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/page.js
(with props)
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/showRecords.vm
(with props)
Removed:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/images/powered-by-logo.gif
Modified:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N.properties
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N_de_DE.properties
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N_en_US.properties
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/SecureAction.java
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/java/modules/screens/Password.java
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/SecureScreen.java
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/TestSecure.java
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/services/pull/RelatedTool.java
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/templates/layouts/Default.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/Index.vm
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/Login.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/archetype-resources/src/main/java/L10N.properties
URL:
http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N.properties?rev=1804430&r1=1804429&r2=1804430&view=diff
==============================================================================
---
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N.properties
(original)
+++
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N.properties
Tue Aug 8 14:46:03 2017
@@ -1,4 +1,4 @@
-#*
+#
# 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
@@ -15,9 +15,10 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-*#
+
l10nkey=Default value
username_required_msg=Please enter an email address as user name
username_min_length_msg=Please enter at least {0} characters
username_mask_msg=Please enter a valid email address as user name
-password_msg=Please enter a password
\ No newline at end of file
+password_msg=Please enter a password
+no_permission=You do not have permission, login required.
\ No newline at end of file
Modified:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N_de_DE.properties
URL:
http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N_de_DE.properties?rev=1804430&r1=1804429&r2=1804430&view=diff
==============================================================================
---
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N_de_DE.properties
(original)
+++
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N_de_DE.properties
Tue Aug 8 14:46:03 2017
@@ -1,5 +1,5 @@
#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)
-#*
+#
# 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
@@ -26,3 +26,5 @@ username_mask_msg = Geben Sie als Benutz
username_min_length_msg = Es m\u00FCssen {0} Zeichen eingegeben werden
username_required_msg = Bitte einen Benutzernamen eingeben
+
+no_permission=Unautorisierte Aktion erfordert Login.
Modified:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N_en_US.properties
URL:
http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N_en_US.properties?rev=1804430&r1=1804429&r2=1804430&view=diff
==============================================================================
---
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N_en_US.properties
(original)
+++
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N_en_US.properties
Tue Aug 8 14:46:03 2017
@@ -15,7 +15,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-*#
+#
l10nkey=US-English value
username_required_msg=Please enter an email address as user name
username_min_length_msg=Please enter at least {0} characters
Modified:
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=1804430&r1=1804429&r2=1804430&view=diff
==============================================================================
---
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/SecureAction.java
(original)
+++
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/SecureAction.java
Tue Aug 8 14:46:03 2017
@@ -19,10 +19,13 @@ package ${package}.modules.actions;
* under the License.
*#
+import org.apache.fulcrum.localization.LocalizationService;
import org.apache.fulcrum.security.model.turbine.TurbineAccessControlList;
+import org.apache.turbine.annotation.TurbineService;
import org.apache.turbine.modules.actions.VelocitySecureAction;
import org.apache.turbine.om.security.User;
import org.apache.turbine.pipeline.PipelineData;
+import org.apache.turbine.util.RunData;
import org.apache.velocity.context.Context;
/**
@@ -33,6 +36,9 @@ import org.apache.velocity.context.Conte
*/
public class SecureAction extends VelocitySecureAction
{
+
+ @TurbineService
+ private LocalizationService localizationService;
/**
* This currently only checks to make sure that user is allowed to view the
* storage area. If you create an action that requires more security then
@@ -44,30 +50,36 @@ public class SecureAction extends Veloci
* @exception Exception,
* a generic exception.
*/
- @Override
- protected boolean isAuthorized(PipelineData data) throws Exception
- {
- boolean isAuthorized = false;
-
- // Who is our current user?
- User user = getRunData(data).getUser();
-
- // Get the Turbine ACL implementation
- TurbineAccessControlList acl = getRunData(data).getACL();
-
- if (acl == null || ! ( acl.hasRole("turbineuser") ||
acl.hasRole("turbineadmin") ) )
+ @Override
+ protected boolean isAuthorized(PipelineData data) throws Exception
{
- getRunData(data).setMessage("You do not have permission to access this
action");
- isAuthorized = false;
- }
- else if ( acl.hasRole("turbineuser") || acl.hasRole("turbineadmin") )
- {
- isAuthorized = true;
+ boolean isAuthorized = false;
+
+ // Who is our current user?
+ User user = getRunData(data).getUser();
+
+ // Get the Turbine ACL implementation
+ TurbineAccessControlList acl = getRunData(data).getACL();
+
+ if (acl == null || ! ( acl.hasRole("turbineuser") ||
acl.hasRole("turbineadmin") ) )
+ {
+ String msg =
localizationService.getString(localizationService.getDefaultBundleName(),
+ localizationService.getLocale(
((RunData) data).getRequest()), "no_permission");
+
+ getRunData(data).setMessage(msg);
+
+ log.debug( "call not permitted for template: " +
getRunData(data).getScreenTemplate() + " and action " +
getRunData(data).getAction() );
+ getRunData(data).setScreenTemplate( "Login.vm" );
+ isAuthorized = false;
+ }
+ else if ( acl.hasRole("turbineuser") || acl.hasRole("turbineadmin") )
+ {
+ isAuthorized = true;
+ }
+
+ return isAuthorized;
}
- return isAuthorized;
- }
-
/**
* Implement this to add information to the context.
*
Added:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/ShowRecords.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/ShowRecords.java?rev=1804430&view=auto
==============================================================================
---
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/ShowRecords.java
(added)
+++
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/ShowRecords.java
Tue Aug 8 14:46:03 2017
@@ -0,0 +1,48 @@
+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 java.util.List;
+
+import org.apache.torque.criteria.Criteria;
+import org.apache.turbine.pipeline.PipelineData;
+import org.apache.turbine.util.RunData;
+import org.apache.velocity.context.Context;
+
+import ${package}.om.Author;
+import ${package}.om.AuthorPeer;
+
+public class ShowRecords extends SecureAction
+{
+
+ @Override
+ public void doPerform( PipelineData pipelineData, Context context )
+ throws Exception
+ {
+ super.doPerform( pipelineData, context );
+ List<Author> authors = AuthorPeer.doSelect( new Criteria() );//all
+ context.put( "authors", authors );
+ RunData data = getRunData(pipelineData);
+
data.setScreenTemplate(Character.toLowerCase(getClass().getSimpleName().charAt(0))
+
+ getClass().getSimpleName().substring(1) + ".vm"
+ );
+
+ }
+}
Propchange:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/ShowRecords.java
------------------------------------------------------------------------------
svn:eol-style = native
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=1804430&r1=1804429&r2=1804430&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
Tue Aug 8 14:46:03 2017
@@ -31,38 +31,36 @@ import org.apache.turbine.modules.screen
*/
public class Index extends VelocitySecureScreen
{
-
- JsonService jsonService =
(JsonService)TurbineServices.getInstance().getService(JsonService.ROLE);
- /**
- * 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!");
- }
-
- /**
- * This method is called bythe Turbine framework to determine if
- * the current user is allowed to use this screen. If this method
- * returns false, the doBuildTemplate() method will not be called.
- * If a redirect to some "access denied" page is required, do the
- * necessary redirect here.
- *
- * @param data the Turbine request data
- * @return true if this screen may be accessed
- * @throws Exception a generic Exception
- */
- @Override
- protected boolean isAuthorized(PipelineData data) throws Exception
- {
- // use data.getACL()
- return true;
- }
+
+ JsonService jsonService =
(JsonService)TurbineServices.getInstance().getService(JsonService.ROLE);
+ /**
+ * 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!");
+ }
+
+ /**
+ * This method is called bythe Turbine framework to determine if
+ * the current user is allowed to use this screen. If this method
+ * returns false, the doBuildTemplate() method will not be called.
+ * If a redirect to some "access denied" page is required, do the
+ * necessary redirect here.
+ *
+ * return always <code>true</code>true, to show this screen as default
+ */
+ @Override
+ protected boolean isAuthorized(PipelineData data) throws Exception
+ {
+ // use data.getACL()
+ return true;
+ }
}
Modified:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/Password.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/Password.java?rev=1804430&r1=1804429&r2=1804430&view=diff
==============================================================================
---
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/Password.java
(original)
+++
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/Password.java
Tue Aug 8 14:46:03 2017
@@ -36,19 +36,18 @@ import org.apache.commons.configuration.
*/
public class Password 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
- {
-
- }
+ /**
+ * 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
+ {
+
+ }
}
Modified:
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=1804430&r1=1804429&r2=1804430&view=diff
==============================================================================
---
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/SecureScreen.java
(original)
+++
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/SecureScreen.java
Tue Aug 8 14:46:03 2017
@@ -36,44 +36,44 @@ import org.apache.commons.configuration.
*/
public class SecureScreen extends VelocitySecureScreen
{
- @TurbineService
- protected SecurityService securityService;
-
- @TurbineConfiguration( TurbineConstants.TEMPLATE_LOGIN )
- private Configuration templateLogin;
-
- @TurbineConfiguration( TurbineConstants.TEMPLATE_HOMEPAGE )
- private Configuration templateHomepage;
-
- @Override
- protected boolean isAuthorized(PipelineData data) throws Exception
- {
- boolean isAuthorized = false;
-
- // Who is our current user?
- User user = getRunData(data).getUser();
-
- // Get the Turbine ACL implementation
- TurbineAccessControlList acl = getRunData(data).getACL();
-
- if (acl == null)
- {
- // commons configuration getProperty: prefix removed, the key for the
value .. is an empty string, the result an object
- getRunData(data).setScreenTemplate( (String)
templateLogin.getProperty("") );
- isAuthorized = false;
- }
- else if (acl.hasRole("turbineuser") ||
acl.hasRole("turbineadmin"))
- {
- isAuthorized = true;
- }
- else
- {
- getRunData(data).setScreenTemplate( (String)
templateHomepage.getProperty("") );
- getRunData(data).setMessage("You do not have access to
this part of the site.");
- isAuthorized = false;
- }
- return isAuthorized;
- }
+ @TurbineService
+ protected SecurityService securityService;
+
+ @TurbineConfiguration( TurbineConstants.TEMPLATE_LOGIN )
+ private Configuration templateLogin;
+
+ @TurbineConfiguration( TurbineConstants.TEMPLATE_HOMEPAGE )
+ private Configuration templateHomepage;
+
+ @Override
+ protected boolean isAuthorized(PipelineData data) throws Exception
+ {
+ boolean isAuthorized = false;
+
+ // Who is our current user?
+ User user = getRunData(data).getUser();
+
+ // Get the Turbine ACL implementation
+ TurbineAccessControlList acl = getRunData(data).getACL();
+
+ if (acl == null)
+ {
+ // commons configuration getProperty: prefix removed, the key for
the value .. is an empty string, the result an object
+ getRunData(data).setScreenTemplate( (String)
templateLogin.getProperty("") );
+ isAuthorized = false;
+ }
+ else if (acl.hasRole("turbineuser") || acl.hasRole("turbineadmin"))
+ {
+ isAuthorized = true;
+ }
+ else
+ {
+ getRunData(data).setScreenTemplate( (String)
templateHomepage.getProperty("") );
+ getRunData(data).setMessage("You do not have access to this part
of the site.");
+ isAuthorized = false;
+ }
+ return isAuthorized;
+ }
/**
* Implement this to add information to the context.
@@ -85,9 +85,9 @@ public class SecureScreen extends Veloci
* @exception Exception,
* a generic exception.
*/
- @Override
- protected void doBuildTemplate(PipelineData data, Context context)
throws Exception
- {
-
- }
+ @Override
+ protected void doBuildTemplate(PipelineData data, Context context) throws
Exception
+ {
+
+ }
}
Modified:
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=1804430&r1=1804429&r2=1804430&view=diff
==============================================================================
---
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/TestSecure.java
(original)
+++
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/TestSecure.java
Tue Aug 8 14:46:03 2017
@@ -30,19 +30,18 @@ import org.apache.velocity.context.Conte
*/
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!");
- }
-
+ /**
+ * 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 here too!");
+ }
}
Modified:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/services/pull/RelatedTool.java
URL:
http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/services/pull/RelatedTool.java?rev=1804430&r1=1804429&r2=1804430&view=diff
==============================================================================
---
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/services/pull/RelatedTool.java
(original)
+++
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/services/pull/RelatedTool.java
Tue Aug 8 14:46:03 2017
@@ -92,14 +92,13 @@ public class RelatedTool implements RunD
log.info( "refresh is:"+ refresh );
log.info( "jsonService:"+ jsonService );
log.info( "source class is:"+ className );
+ log.info( "target object is:"+ src );
Class clazz = Class.forName(className);
-
if (props != null) {
log.info( "props length:"+ props.length);
for ( int i = 0; i < props.length; i++ )
{
log.debug( "props:"+ props[i]);
-
}
}
if (mixinCN != null ) {
@@ -111,7 +110,6 @@ public class RelatedTool implements RunD
jsonService.addAdapter( mixinCN, clazz, mixin );
}
}
-
String serialized = jsonService.serializeOnlyFilter( src, clazz,
refresh, props );
log.debug( "serialized:"+serialized );
return serialized;
@@ -121,7 +119,7 @@ public class RelatedTool implements RunD
log.error(e.getMessage(),e );
result = e.getMessage();
}
- return result;
+ return result;
}
}
Added:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/wrapper/TurbineUserWrapper.java
URL:
http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/wrapper/TurbineUserWrapper.java?rev=1804430&view=auto
==============================================================================
---
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/wrapper/TurbineUserWrapper.java
(added)
+++
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/wrapper/TurbineUserWrapper.java
Tue Aug 8 14:46:03 2017
@@ -0,0 +1,20 @@
+package ${package}.wrapper;
+
+import org.apache.fulcrum.security.model.turbine.entity.TurbineUser;
+import org.apache.turbine.om.security.DefaultUserImpl;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+/**
+ * Custom Wrapper instead fo default Turbine wrapper class {@link
DefaultUserImpl} to allow for annotations,
+ * - th single requirment for wrappers is to implement a constructor with
parameter {@link TurbineUser}
+ *
+ */
+ @JsonIgnoreProperties( {"permStorage", "type","objectdata" } )
+public class TurbineUserWrapper
+ extends DefaultUserImpl
+{
+ public TurbineUserWrapper(TurbineUser user) {
+ super(user);
+ }
+}
Propchange:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/wrapper/TurbineUserWrapper.java
------------------------------------------------------------------------------
svn:eol-style = native
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=1804430&r1=1804429&r2=1804430&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
Tue Aug 8 14:46:03 2017
@@ -507,7 +507,7 @@ tool.global.ui=org.apache.turbine.servic
# tool.ui.dir.image=/images
# Default CSS file for a skin
-# tool.ui.css=skin.css
+tool.ui.css=page.css
# Default skin name
# tool.ui.skin=default
@@ -618,7 +618,8 @@ services.SecurityService.classname=org.a
services.SecurityService.user.manager =
org.apache.turbine.services.security.DefaultUserManager
services.SecurityService.user.class=org.apache.fulcrum.security.model.turbine.entity.impl.TurbineUserImpl
-
+# define custom wrapper
+services.SecurityService.wrapper.class = ${package}.wrapper.TurbineUserWrapper
# -------------------------------------------------------------------
Added:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/images/pb-turbine100px.png
URL:
http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/images/pb-turbine100px.png?rev=1804430&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/images/pb-turbine100px.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/images/turbine4-project.png
URL:
http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/images/turbine4-project.png?rev=1804430&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/images/turbine4-project.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/page.css
URL:
http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/page.css?rev=1804430&view=auto
==============================================================================
---
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/page.css
(added)
+++
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/page.css
Tue Aug 8 14:46:03 2017
@@ -0,0 +1,121 @@
+/*
+# 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.
+*/
+
+book {
+ display: flex;
+ flex-direction: column;
+}
+
+@supports(display: grid) {
+ book {
+ width: auto;
+ }
+}
+
+book:nth-of-type(2) {
+ grid-column: 2;
+ grid-row: 2 / span 2;
+}
+
+h3 {
+ order: 0;
+}
+
+footer {
+ background-color: #9E2064;
+ text-align: right;
+ padding-right: 20px;
+}
+
+section {
+ background-color: #dfe5e8;
+ display: grid;
+ grid-template: [header-left] "head head" 30px [header-right]
+ [main-left] "nav main" 1fr [main-right]
+ [gridfooter-left] "nav foot" 30px [gridfooter-right];
+ grid-gap: 0.5em;
+ width: 100%;
+ height: 250px;
+}
+
+section:after {
+ clear: both;
+ content: "";
+ display: table;
+}
+
+header {
+ background-color: #F69923;
+ grid-area: head;
+}
+
+nav {
+ background-color: #F79A23;
+ grid-area: nav;
+}
+
+main {
+ background-color: #E97826;
+ grid-area: main;
+}
+
+gridfooter {
+ background-color: #9E2064;
+ text-align: center;
+ grid-column: foot;
+}
+
+.tabs-nav-container {
+ display: flex;
+ flex-direction: column;
+ list-style: none;
+ margin: 0;
+ padding: 0;
+}
+
+.tabs-nav {
+ text-align: center;
+}
+
+.tabs-nav:hover {
+ color: #6d6d6d;
+}
+
+.tabs-nav.is-active {
+ color: white;
+ background-color: #C92037;
+ min-width: 400px;
+}
+
+.tabs-nav span {
+ display: none;
+}
+
+.tab {
+ display: none;
+ background-color: #dfe5e8;
+}
+
+.tab.is-active {
+ display: block;
+}
+
+.tab-content {
+ padding: 0.5em;
+}
\ No newline at end of file
Propchange:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/page.css
------------------------------------------------------------------------------
svn:eol-style = native
Added:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/page.js
URL:
http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/page.js?rev=1804430&view=auto
==============================================================================
---
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/page.js
(added)
+++
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/page.js
Tue Aug 8 14:46:03 2017
@@ -0,0 +1,21 @@
+/*
+# 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.
+*/
+(function() {
+ //TODO
+})();
\ No newline at end of file
Propchange:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/page.js
------------------------------------------------------------------------------
svn:eol-style = native
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=1804430&r1=1804429&r2=1804430&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
Tue Aug 8 14:46:03 2017
@@ -18,26 +18,27 @@
$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")
-
-
+$page.addScript($ui.getScript("page.js"))
<html>
#TurbineHtmlHead()
+<link href="$ui.getStylecss()" rel="stylesheet" type="text/css" />
+
<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>
+ <!-- Header -->
+ <header class="w3-container w3-center w3-padding-32 w3-theme">
+ <img class="w3-right" src="$ui.image('turbine4-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")
@@ -49,7 +50,7 @@ $page.setTitle("Sample Apache Turbine Ap
<!-- Footer -->
<footer class="w3-bottom">
- <p>Powered by <img
src="$ui.image('powered-by-logo.gif')"/></p>
+ <p>Powered by <img
src="$ui.image('pb-turbine100px.png')"/></p>
</footer>
</div>
Modified:
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=1804430&r1=1804429&r2=1804430&view=diff
==============================================================================
---
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/navigations/Menu.vm
(original)
+++
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/navigations/Menu.vm
Tue Aug 8 14:46:03 2017
@@ -23,8 +23,7 @@
<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("Password.vm")">Update Password <i class="fa
fa-unlock"></i></a>
-
+ <a href="$link.setPage("Password.vm")">Update Password <i
class="fa fa-unlock"></i></a>
#if ( $data.getACL().hasRole("turbineadmin") )
<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>
@@ -32,7 +31,15 @@
#end
</div>
</li>
-
+ #if ( $data.getACL().hasRole("turbineuser") )
+ <li class="w3-dropdown-hover">
+ <a href="#">Records <i class="fa fa-caret-down"></i></a>
+ <div class="w3-dropdown-content w3-white w3-card-4">
+ <a href="$link.setAction("ShowRecords")">Show Records <i
class="fa fa-unlock"></i></a>
+ </div>
+ </li>
+ #end
+
<li class="w3-right"><a
href="$link.setAction("LogoutUser")">Logout</a></li>
</nav>
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=1804430&r1=1804429&r2=1804430&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
Tue Aug 8 14:46:03 2017
@@ -17,23 +17,29 @@
-
#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>
+#if ($!success) <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>
+#end
+
+ ## including a secured does not trigger the security check, as it is just
handled by velocity, not turbine
+ #parse("/screens/TestSecure.vm")
+
+ ## trigger the security check, but without all context
+ ## <a href="$link.setPage("TestSecure.vm")">Test a secure access without
context</a>
+ ## trigger the security check
+ <a
href="$link.setPage("TestSecure.vm").addPathInfo("action","SecureAction")">Test
a secure access with context</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=1804430&r1=1804429&r2=1804430&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
Tue Aug 8 14:46:03 2017
@@ -93,9 +93,12 @@
## Display System messages here if there are any
#if($data.getMessage())
#info( $data.getMessage() ) <br/>
- #end
+ #end
+
</div>
- #end
+ #else
+ #parse("/screens/Index.vm")
+ #end
## $intake.declareGroups()
Modified:
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=1804430&r1=1804429&r2=1804430&view=diff
==============================================================================
---
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/TestSecure.vm
(original)
+++
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/TestSecure.vm
Tue Aug 8 14:46:03 2017
@@ -2,13 +2,26 @@
#info( $data.getMessage() )
#end
-<h1> Secured Access Page </h1>
-
-
- <p>
- Role: $related.getUserrole()
-
- #if ($user)
- $related.getJson($user,"org.apache.turbine.om.security.User", null,
true,"lastLogin")
+## its null for anon
+#if ( $!related.getUserrole() )
+<h1> Secured #if ($!user) User#else Role #end Access Page </h1>
+ #if ($!user && $!success)<div align="center"><h1>$success</h1></div>#end
+ <p>
+ #if ($user)
+ Hi "$user.firstName, $user.lastName"
+ #else
+ Role: $related.getUserrole()
+ #end
+ <script type="text/javascript">
+ var jsonObject;
+ #if ($user)
+ jsonObject =
$related.getJson($user,"org.apache.turbine.om.security.User", null,
true,"lastLogin", "permStorage");
+ if (jsonObject != undefined && jsonObject.permStorage == undefined)
{
+ alert("successfully read JSON:" + jsonObject.lastLogin);
+ } else {
+ alert("error json object not as expected" +
JSON.stringify(jsonObject));
+ }
#end
+ </script>
</p>
+#end
\ No newline at end of file
Added:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/showRecords.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/showRecords.vm?rev=1804430&view=auto
==============================================================================
---
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/showRecords.vm
(added)
+++
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/showRecords.vm
Tue Aug 8 14:46:03 2017
@@ -0,0 +1,51 @@
+## 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.
+ <div id="tabs" class="no-js">
+ #foreach ($author in $authors)
+ <div class="tabs-nav-container">
+ <a href="#" class="tabs-nav #if($velocityCount
==1)is-active#end">$author.firstName $author.lastName</a>
+ </div>
+ #end
+ #foreach ($author in $authors)
+ <div class="tab #if($velocityCount ==1)is-active#end">
+ <div class="tab-content">
+ <section>
+ <header>Author´s Book Record Box</header>
+ <nav>$author.firstName $author.lastName</nav>
+ #set($books = $author.books)
+ <main>
+ #foreach ($book in $books)
+ <book><a href="#">
+ $book.title
+ </a> (subject: $book.subject)
+ </book>
+ #end
+ </main>
+ <footer>$velocityCount</footer>
+ </section>
+ </div>
+ </div>
+ #end
+
+ </div>
+
+ <p>Authors: $authors.size()</p>
+
+ <script>
+ /*
+ */
+</script>
Propchange:
turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/showRecords.vm
------------------------------------------------------------------------------
svn:eol-style = native