com.pow2.acl.struts.action
Class ACLDispatcherAction

java.lang.Object
  extended byorg.apache.struts.action.Action
      extended bycom.pow2.struts.action.BaseAction
          extended bycom.pow2.struts.action.DispatcherAction
              extended bycom.pow2.acl.struts.action.ACLDispatcherAction
Direct Known Subclasses:
ACLRoleAction

public abstract class ACLDispatcherAction
extends com.pow2.struts.action.DispatcherAction

Abstract class that extends com.pow2.struts.actions.DispatcherAction.
Override the validateSession method, checking for a valid com.pow2.user.User object into the session scope.
Add the validatePermission hook method to check the user permissions for a given resource. This default implementation always returns true; subclass this class and make your own implementation.

Author:
Luca Fossato

Field Summary
 
Fields inherited from class com.pow2.struts.action.BaseAction
cat, FWD_CANCEL, FWD_FAILURE, FWD_INVALID_SESSION, FWD_LOGIN
 
Fields inherited from class org.apache.struts.action.Action
DATA_SOURCE_KEY, defaultLocale, ERROR_KEY, EXCEPTION_KEY, FORM_BEANS_KEY, FORWARDS_KEY, LOCALE_KEY, MAPPING_KEY, MAPPINGS_KEY, MESSAGES_KEY, MULTIPART_KEY, servlet, SERVLET_KEY, TRANSACTION_TOKEN_KEY
 
Constructor Summary
ACLDispatcherAction()
           
 
Method Summary
protected  org.apache.struts.action.ActionForward failureForward(HttpServletRequest request, org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionErrors errors, String errorKey)
          Get the ActionForward object related to the "failure" forward, and store the new error identified by the errorKey string into the input ActionErrors object.
protected  org.apache.struts.action.ActionForward invalidSessionForward(HttpServletRequest request, org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionErrors errors)
          Get the ActionForward object related to the "invalidSession" forward.
protected  org.apache.struts.action.ActionForward noPermissionsForward(HttpServletRequest request, org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionErrors errors)
          Get the ActionForward object related to the "insufficientPermissions" forward.
 boolean validatePermissions(com.pow2.user.User user, ACLDAO acl, org.apache.struts.action.ActionMapping mapping, HttpServletRequest request, org.apache.struts.action.ActionErrors errors)
          Validate user permissions.
protected  boolean validateSession(HttpServletRequest request)
          Check if the current session have a valid reference to an User object.
 
Methods inherited from class com.pow2.struts.action.DispatcherAction
perform
 
Methods inherited from class com.pow2.struts.action.BaseAction
getForward, isFailureForward, loginForward, loginForward
 
Methods inherited from class org.apache.struts.action.Action
generateToken, getLocale, getResources, getServlet, isCancelled, isTokenValid, perform, perform, perform, resetToken, saveErrors, saveToken, setLocale, setServlet, toHex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ACLDispatcherAction

public ACLDispatcherAction()
Method Detail

failureForward

protected org.apache.struts.action.ActionForward failureForward(HttpServletRequest request,
                                                                org.apache.struts.action.ActionMapping mapping,
                                                                org.apache.struts.action.ActionErrors errors,
                                                                String errorKey)
Get the ActionForward object related to the "failure" forward, and store the new error identified by the errorKey string into the input ActionErrors object.

Parameters:
request - the HttpServletRequest object
mapping - the ActionMapping object
errors - the ActionErrors object
errorKey - a string key identifying a resource properties error string
Returns:
Description of the Return Value

invalidSessionForward

protected org.apache.struts.action.ActionForward invalidSessionForward(HttpServletRequest request,
                                                                       org.apache.struts.action.ActionMapping mapping,
                                                                       org.apache.struts.action.ActionErrors errors)
Get the ActionForward object related to the "invalidSession" forward.

Parameters:
request - the HttpServletRequest object
mapping - the ActionMapping object
errors - the ActionErrors object
Returns:
Description of the Return Value

noPermissionsForward

protected org.apache.struts.action.ActionForward noPermissionsForward(HttpServletRequest request,
                                                                      org.apache.struts.action.ActionMapping mapping,
                                                                      org.apache.struts.action.ActionErrors errors)
Get the ActionForward object related to the "insufficientPermissions" forward.

Parameters:
request - the HttpServletRequest object
mapping - the ActionMapping object
errors - the ActionErrors object
Returns:
Description of the Return Value

validateSession

protected boolean validateSession(HttpServletRequest request)
Check if the current session have a valid reference to an User object.

Parameters:
request - the input HttpServletRequest object
Returns:
true if the current session is valid; false otherwise

validatePermissions

public boolean validatePermissions(com.pow2.user.User user,
                                   ACLDAO acl,
                                   org.apache.struts.action.ActionMapping mapping,
                                   HttpServletRequest request,
                                   org.apache.struts.action.ActionErrors errors)
Validate user permissions.
This is an hook method; this default implementation always returns true.
Subclass this class and make your own implementation.

Parameters:
user - the current User object
acl - the data access object for ACL validation
mapping - the ActionMapping object of the current action
errors - the ActionError list to fill with possible errors
request - Description of the Parameter
Returns:
true if user has permissions for execute this action, false otherwise


Copyright © 2002-2003 Power Of Two S.R.L. All Rights Reserved.