org.apache.lenya.cms.ac.usecases
Class AccessControl

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.lenya.cms.usecase.AbstractUsecase
          extended by org.apache.lenya.cms.ac.usecases.AccessControlUsecase
              extended by org.apache.lenya.cms.ac.usecases.AccessControl
All Implemented Interfaces:
org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, org.apache.lenya.cms.usecase.Usecase

public class AccessControl
extends org.apache.lenya.cms.ac.usecases.AccessControlUsecase

Usecase to display the AccessControl tab in the site area for a document. This is a mix-in class that ideally would inherit both from AccessControlUsecase and DocumentUsecase. FIXME i just took the appropriate code from DocumentUsecase, maybe its possible to have a saner inheritance?

Version:
$Id: AccessControl.java 408702 2006-05-22 16:03:49Z andreas $

Field Summary
protected static java.lang.String AC_AREA
           
protected static java.lang.String ADD
           
protected static java.lang.String ANCESTOR_SSL
           
protected static java.lang.String DELETE
           
protected static java.lang.String DOCUMENT
           
protected static java.lang.String DOWN
           
protected static java.lang.String GROUP
           
protected static java.lang.String IPRANGE
           
protected static java.lang.String PARENT_CREDENTIALS
           
protected static java.lang.String ROLE
           
protected static java.lang.String SSL
           
protected static java.lang.String SUB_CREDENTIALS
           
protected static java.lang.String SUB_GROUP
           
protected static java.lang.String SUB_IPRANGE
           
protected static java.lang.String SUB_USER
           
protected static java.lang.String UP
           
protected static java.lang.String USER
           
protected static java.lang.String WORLD
           
 
Fields inherited from class org.apache.lenya.cms.usecase.AbstractUsecase
ATTRIBUTE_NAME, ATTRIBUTE_POLICY, ATTRIBUTE_USECASE, ATTRIBUTE_VALUE, context, ELEMENT_EXIT, ELEMENT_PARAMETER, ELEMENT_TRANSACTION, ELEMENT_VIEW, ERROR_OBJECTS_CHECKED_OUT, EVENT_CHECK_EXECUTION_CONDITIONS, EVENT_CHECK_POSTCONDITIONS, EVENT_CHECK_PRECONDITIONS, EVENT_EXECUTE, manager, MODEL, PARAMETER_CHECKOUT_RESTRICTED_TO_SESSION, PARAMETER_FACTORY, PARAMETER_SESSION, PARAMETER_STATE_MACHINE, PARAMETERS_INITIALIZED, SOURCE_URL, TRANSITIONS, VALUE_OPTIMISTIC, VALUE_PESSIMISTIC
 
Constructor Summary
AccessControl()
           
 
Method Summary
protected  boolean containsCredential(org.apache.lenya.ac.ModifiablePolicy policy, org.apache.lenya.ac.Accreditable accreditable, org.apache.lenya.ac.Role role)
           
protected  void doCheckExecutionConditions()
           
protected  void doCheckPreconditions()
           
 void doExecute()
           
protected  org.apache.lenya.ac.Accreditable getAccreditable(java.lang.String type, java.lang.String id)
           
protected  org.apache.lenya.ac.AccreditableManager getAccreditableManager()
           
 CredentialWrapper[] getCredentials(boolean inherit)
          Returns the credentials of the policy of the selected URL.
 CredentialWrapper[] getParentCredentials()
          Returns the credential wrappers for the parent URI of the URL belonging to the request of this object model.
protected  org.apache.lenya.ac.ModifiablePolicy[] getPolicies(boolean inherit)
          Returns the policies for a certain URL.
protected  org.apache.lenya.ac.ModifiablePolicy getPolicy()
           
protected  org.apache.lenya.ac.InheritingPolicyManager getPolicyManager()
           
protected  java.lang.String getPolicyURL()
           
 CredentialWrapper[] getSubtreeCredentials()
          Returns the credential wrappers for the request of this object model.
protected  void initParameters()
           
protected  boolean isAncestorSSLProtected()
          Returns if one of the ancestors of this URL is SSL protected.
protected  boolean isSSLProtected()
          Returns if one of the ancestors of this URL is SSL protected.
protected  void manipulateCredential(org.apache.lenya.ac.Accreditable accreditable, org.apache.lenya.ac.Role role, java.lang.String operation, java.lang.String method)
          Changes a credential by adding or deleting an item for a role.
protected  void setSSLProtected(boolean ssl)
          Sets if this URL is SSL protected.
 
Methods inherited from class org.apache.lenya.cms.ac.usecases.AccessControlUsecase
getAccessController, getGroupManager, getIpRangeManager, getRoleManager, getUserManager, initializeAccessController
 
Methods inherited from class org.apache.lenya.cms.usecase.AbstractUsecase
addErrorMessage, addErrorMessage, addErrorMessages, addInfoMessage, addInfoMessage, advance, advanceState, cancel, canCheckOut, checkEvent, checkExecutionConditions, checkoutRestrictedToSession, checkPostconditions, checkPreconditions, clearErrorMessages, clearInfoMessages, configure, contextualize, deleteParameter, doCheckPostconditions, doInitialize, dumpErrorMessages, execute, getBooleanCheckboxParameter, getContext, getDocumentFactory, getErrorMessages, getExitQueryString, getInfoMessages, getName, getNodesToLock, getParameter, getParameter, getParameterAsBoolean, getParameterAsInteger, getParameterAsString, getParameterAsString, getParameterNames, getParameters, getPart, getSession, getSourceURL, getStateMachine, getTargetURL, getView, hasErrors, hasInfoMessages, initialize, initializeParametersIfNotDone, isOptimistic, lockInvolvedObjects, lockInvolvedObjects, prepareView, service, setDefaultTargetURL, setExitParameter, setName, setParameter, setPart, setSession, setSourceURL, setTestSession, setView, startTransaction
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AC_AREA

protected static final java.lang.String AC_AREA
See Also:
Constant Field Values

ADD

protected static final java.lang.String ADD
See Also:
Constant Field Values

DELETE

protected static final java.lang.String DELETE
See Also:
Constant Field Values

UP

protected static final java.lang.String UP
See Also:
Constant Field Values

DOWN

protected static final java.lang.String DOWN
See Also:
Constant Field Values

USER

protected static final java.lang.String USER
See Also:
Constant Field Values

GROUP

protected static final java.lang.String GROUP
See Also:
Constant Field Values

IPRANGE

protected static final java.lang.String IPRANGE
See Also:
Constant Field Values

WORLD

protected static final java.lang.String WORLD
See Also:
Constant Field Values

ROLE

protected static final java.lang.String ROLE
See Also:
Constant Field Values

SUB_USER

protected static final java.lang.String SUB_USER
See Also:
Constant Field Values

SUB_GROUP

protected static final java.lang.String SUB_GROUP
See Also:
Constant Field Values

SUB_IPRANGE

protected static final java.lang.String SUB_IPRANGE
See Also:
Constant Field Values

SSL

protected static final java.lang.String SSL
See Also:
Constant Field Values

ANCESTOR_SSL

protected static final java.lang.String ANCESTOR_SSL
See Also:
Constant Field Values

DOCUMENT

protected static final java.lang.String DOCUMENT
See Also:
Constant Field Values

SUB_CREDENTIALS

protected static final java.lang.String SUB_CREDENTIALS
See Also:
Constant Field Values

PARENT_CREDENTIALS

protected static final java.lang.String PARENT_CREDENTIALS
See Also:
Constant Field Values
Constructor Detail

AccessControl

public AccessControl()
Method Detail

initParameters

protected void initParameters()
Overrides:
initParameters in class org.apache.lenya.cms.usecase.AbstractUsecase
See Also:
AbstractUsecase.initParameters()

doCheckPreconditions

protected void doCheckPreconditions()
                             throws java.lang.Exception
Overrides:
doCheckPreconditions in class org.apache.lenya.cms.usecase.AbstractUsecase
Throws:
java.lang.Exception
See Also:
AbstractUsecase.doCheckPreconditions()

doCheckExecutionConditions

protected void doCheckExecutionConditions()
                                   throws java.lang.Exception
Overrides:
doCheckExecutionConditions in class org.apache.lenya.cms.usecase.AbstractUsecase
Throws:
java.lang.Exception

doExecute

public void doExecute()
               throws java.lang.Exception
Overrides:
doExecute in class org.apache.lenya.cms.usecase.AbstractUsecase
Throws:
java.lang.Exception
See Also:
AbstractUsecase.doExecute()

getAccreditable

protected org.apache.lenya.ac.Accreditable getAccreditable(java.lang.String type,
                                                           java.lang.String id)

isAncestorSSLProtected

protected boolean isAncestorSSLProtected()
                                  throws org.apache.cocoon.ProcessingException
Returns if one of the ancestors of this URL is SSL protected.

Returns:
A boolean value.
Throws:
org.apache.cocoon.ProcessingException - when something went wrong.

isSSLProtected

protected boolean isSSLProtected()
                          throws org.apache.cocoon.ProcessingException
Returns if one of the ancestors of this URL is SSL protected.

Returns:
A boolean value.
Throws:
org.apache.cocoon.ProcessingException - when something went wrong.

setSSLProtected

protected void setSSLProtected(boolean ssl)
                        throws org.apache.cocoon.ProcessingException
Sets if this URL is SSL protected.

Parameters:
ssl - A boolean value.
Throws:
org.apache.cocoon.ProcessingException - when something went wrong.

getPolicyManager

protected org.apache.lenya.ac.InheritingPolicyManager getPolicyManager()

getAccreditableManager

protected org.apache.lenya.ac.AccreditableManager getAccreditableManager()

manipulateCredential

protected void manipulateCredential(org.apache.lenya.ac.Accreditable accreditable,
                                    org.apache.lenya.ac.Role role,
                                    java.lang.String operation,
                                    java.lang.String method)
                             throws org.apache.cocoon.ProcessingException
Changes a credential by adding or deleting an item for a role.

Parameters:
accreditable - The accreditable to add or delete.
role - The role.
operation - The operation, either ADDor DELETE.
method -
Throws:
org.apache.cocoon.ProcessingException - when something went wrong.

getPolicy

protected org.apache.lenya.ac.ModifiablePolicy getPolicy()
                                                  throws org.apache.lenya.ac.AccessControlException
Throws:
org.apache.lenya.ac.AccessControlException

containsCredential

protected boolean containsCredential(org.apache.lenya.ac.ModifiablePolicy policy,
                                     org.apache.lenya.ac.Accreditable accreditable,
                                     org.apache.lenya.ac.Role role)
                              throws org.apache.lenya.ac.AccessControlException
Throws:
org.apache.lenya.ac.AccessControlException

getSubtreeCredentials

public CredentialWrapper[] getSubtreeCredentials()
                                          throws org.apache.cocoon.ProcessingException
Returns the credential wrappers for the request of this object model.

Returns:
An array of CredentialWrappers.
Throws:
org.apache.cocoon.ProcessingException - when something went wrong.

getParentCredentials

public CredentialWrapper[] getParentCredentials()
                                         throws org.apache.cocoon.ProcessingException
Returns the credential wrappers for the parent URI of the URL belonging to the request of this object model.

Returns:
An array of CredentialWrappers.
Throws:
org.apache.cocoon.ProcessingException - when something went wrong.

getCredentials

public CredentialWrapper[] getCredentials(boolean inherit)
                                   throws org.apache.cocoon.ProcessingException
Returns the credentials of the policy of the selected URL.

Returns:
An array of CredentialWrappers.
Throws:
org.apache.cocoon.ProcessingException - when something went wrong.

getPolicies

protected org.apache.lenya.ac.ModifiablePolicy[] getPolicies(boolean inherit)
                                                      throws org.apache.cocoon.ProcessingException
Returns the policies for a certain URL.

Parameters:
inherit - If true, all ancestor policies are returned. Otherwise, only the URL policies are returned.
Returns:
An array of DefaultPolicy objects.
Throws:
org.apache.cocoon.ProcessingException - when something went wrong.

getPolicyURL

protected java.lang.String getPolicyURL()


Copyright $ Apache Software Foundation. All Rights Reserved.