net.sf.springlayout.web.security
Class AbstractPageAccessResolver

java.lang.Object
  extended by net.sf.springlayout.web.security.AbstractPageAccessResolver
All Implemented Interfaces:
PageAccessResolver

public abstract class AbstractPageAccessResolver
extends java.lang.Object
implements PageAccessResolver


Constructor Summary
AbstractPageAccessResolver()
           
 
Method Summary
protected  java.util.List defineReadOnlyFields(javax.servlet.http.HttpServletRequest request, java.lang.Object object)
          Default implementation that defines no fields as readonly.
protected abstract  AccessLevel getPageAccessLevel(javax.servlet.http.HttpServletRequest request, java.lang.Object object)
          Implement method to get the page access level for the current page
protected abstract  PageFunctionStateMap getPageFunctionPermissions(javax.servlet.http.HttpServletRequest request, java.lang.Object object, boolean editMode)
          Implement this method to return a map of PageFunctionStates for the current page with the following structure: String functionName:PageFunctionState.
 PageFunctionState getPageFunctionState(java.lang.String functionName)
          Looks up the pageFunction map from the request and queries it for the function name requested returning a page function state.
 void initialisePageAccess(javax.servlet.http.HttpServletRequest request, java.lang.Object object)
          Firstly determines the maximum access allowed for the current user in the current context, by calling getPageAccessLevel, downgrading the access where necessary.
protected  boolean isFormSubmission(javax.servlet.http.HttpServletRequest request)
          Tests if a post or a get
 boolean isRunOnFormSubmission()
           
 void setPageFunctionState(java.lang.String functionName, PageFunctionState pageFunctionState)
          set the page function state
 void setRunOnFormSubmission(boolean runOnFormSubmission)
          Set whether the pageAccessResolver should run on formSubmission.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractPageAccessResolver

public AbstractPageAccessResolver()
Method Detail

setRunOnFormSubmission

public void setRunOnFormSubmission(boolean runOnFormSubmission)
Set whether the pageAccessResolver should run on formSubmission. Default is false.

Parameters:
runOnFormSubmission - the runOnFormSubmission to set

isRunOnFormSubmission

public boolean isRunOnFormSubmission()
Specified by:
isRunOnFormSubmission in interface PageAccessResolver
Returns:
should this pageAccessResolver be run on form submission

initialisePageAccess

public void initialisePageAccess(javax.servlet.http.HttpServletRequest request,
                                 java.lang.Object object)
Firstly determines the maximum access allowed for the current user in the current context, by calling getPageAccessLevel, downgrading the access where necessary. Secondly based on the outcome of this, initialises a page function map by calling getPageFunctionPermissions and stores functions against PageFunctionStates in the request for later reference via the getPageFunctionState method.

Specified by:
initialisePageAccess in interface PageAccessResolver
Parameters:
request - the current request
object - the current command object
See Also:
net.sf.springlayout.web.security.PageAccessResolver#initialisePageFunctions(javax.servlet.http.HttpServletRequest, java.lang.Object)

getPageFunctionPermissions

protected abstract PageFunctionStateMap getPageFunctionPermissions(javax.servlet.http.HttpServletRequest request,
                                                                   java.lang.Object object,
                                                                   boolean editMode)
Implement this method to return a map of PageFunctionStates for the current page with the following structure: String functionName:PageFunctionState.

Parameters:
request - the current request
object - the current command object
editMode - are we opening in edit mode
Returns:
map of function states

getPageFunctionState

public PageFunctionState getPageFunctionState(java.lang.String functionName)
Looks up the pageFunction map from the request and queries it for the function name requested returning a page function state.

Specified by:
getPageFunctionState in interface PageAccessResolver
Parameters:
fucntionName - the name of the function to get a state for
Returns:
See Also:
net.sf.springlayout.web.security.PageAccessResolver#getPageFunctionState(javax.servlet.http.HttpServletRequest, java.lang.String)

setPageFunctionState

public void setPageFunctionState(java.lang.String functionName,
                                 PageFunctionState pageFunctionState)
set the page function state

Parameters:
functionName -
pageFunctionState -

defineReadOnlyFields

protected java.util.List defineReadOnlyFields(javax.servlet.http.HttpServletRequest request,
                                              java.lang.Object object)
Default implementation that defines no fields as readonly. Override to return a list of Strings for field paths to disable.

Parameters:
request -
object -
Returns:

getPageAccessLevel

protected abstract AccessLevel getPageAccessLevel(javax.servlet.http.HttpServletRequest request,
                                                  java.lang.Object object)
Implement method to get the page access level for the current page

Parameters:
the - current request
object - the current command object
Returns:

isFormSubmission

protected boolean isFormSubmission(javax.servlet.http.HttpServletRequest request)
Tests if a post or a get

Parameters:
request -
Returns:


Copyright © 2005-2007 Spring Layout Team. All Rights Reserved.