org.apache.lenya.cms.ac.usecase.impl
Class UsecaseAuthorizerImpl

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.lenya.cms.ac.usecase.impl.UsecaseAuthorizerImpl
All Implemented Interfaces:
org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.component.Component, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.parameters.Parameterizable, org.apache.avalon.framework.service.Serviceable, org.apache.lenya.ac.Authorizer, UsecaseAuthorizer

public class UsecaseAuthorizerImpl
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements UsecaseAuthorizer, org.apache.avalon.framework.service.Serviceable, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.parameters.Parameterizable

Authorizer for usecases.

Supported parameters via Parameterizable:

Version:
$Id: UsecaseAuthorizer.java 392449 2006-04-07 23:20:38Z michi $

Field Summary
protected static java.lang.String PARAMETER_CONFIGURATION
           
protected static java.lang.String TYPE
           
protected static java.lang.String USECASE_PARAMETER
           
static java.lang.String VISIT_USECASE
          The name of the pseudo-usecase that governs access to pages.
 
Fields inherited from interface org.apache.lenya.ac.Authorizer
ROLE
 
Constructor Summary
UsecaseAuthorizerImpl()
           
 
Method Summary
 boolean authorize(org.apache.cocoon.environment.Request request)
          This method will substitute VISIT_USECASE if no USECASE_PARAMETER is set, so that it can be used to authorize plain page access as well.
 boolean authorizeUsecase(java.lang.String usecase, org.apache.lenya.ac.Role[] roles, org.apache.lenya.cms.publication.Publication publication)
          Authorizes a usecase by considering all roles of the current identity
 void dispose()
           
protected  java.lang.String getConfigurationURI(org.apache.lenya.cms.publication.Publication publication)
          Returns the source URI of the usecase role configuration file for a certain publication.
protected  UsecaseRoles getUsecaseRoles(java.lang.String _configurationUri)
           
 boolean isPermitted(java.lang.String usecase, org.apache.lenya.cms.publication.Publication publication, org.apache.lenya.ac.Role role)
          Checks whether the specified role is permitted to invoke a given usecase
 void parameterize(org.apache.avalon.framework.parameters.Parameters parameters)
           
 void service(org.apache.avalon.framework.service.ServiceManager _manager)
           
 void setPermission(java.lang.String usecase, org.apache.lenya.cms.publication.Publication publication, org.apache.lenya.ac.Role role, boolean granted)
          Grants or denies a usecase to a role
 
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

VISIT_USECASE

public static final java.lang.String VISIT_USECASE
The name of the pseudo-usecase that governs access to pages.

See Also:
Constant Field Values

PARAMETER_CONFIGURATION

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

TYPE

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

USECASE_PARAMETER

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

UsecaseAuthorizerImpl

public UsecaseAuthorizerImpl()
Method Detail

authorizeUsecase

public boolean authorizeUsecase(java.lang.String usecase,
                                org.apache.lenya.ac.Role[] roles,
                                org.apache.lenya.cms.publication.Publication publication)
                         throws org.apache.lenya.ac.AccessControlException
Description copied from interface: UsecaseAuthorizer
Authorizes a usecase by considering all roles of the current identity

Specified by:
authorizeUsecase in interface UsecaseAuthorizer
Parameters:
usecase - The usecase ID.
roles - The roles of the current identity.
publication - The publication.
Returns:
A boolean value.
Throws:
org.apache.lenya.ac.AccessControlException - when something went wrong.
See Also:
UsecaseAuthorizer.authorizeUsecase(java.lang.String, org.apache.lenya.ac.Role[], org.apache.lenya.cms.publication.Publication)

isPermitted

public boolean isPermitted(java.lang.String usecase,
                           org.apache.lenya.cms.publication.Publication publication,
                           org.apache.lenya.ac.Role role)
                    throws org.apache.lenya.ac.AccessControlException
Description copied from interface: UsecaseAuthorizer
Checks whether the specified role is permitted to invoke a given usecase

Specified by:
isPermitted in interface UsecaseAuthorizer
Parameters:
usecase - The usecase.
publication - The publication.
role - The role.
Returns:
A boolean value.
Throws:
org.apache.lenya.ac.AccessControlException - if an error occurs.
See Also:
UsecaseAuthorizer.isPermitted(java.lang.String, org.apache.lenya.cms.publication.Publication, org.apache.lenya.ac.Role)

setPermission

public void setPermission(java.lang.String usecase,
                          org.apache.lenya.cms.publication.Publication publication,
                          org.apache.lenya.ac.Role role,
                          boolean granted)
                   throws org.apache.lenya.ac.AccessControlException
Description copied from interface: UsecaseAuthorizer
Grants or denies a usecase to a role

Specified by:
setPermission in interface UsecaseAuthorizer
Parameters:
usecase - The usecase.
publication - The publication.
role - The role.
granted - If the usecase shall be permitted.
Throws:
org.apache.lenya.ac.AccessControlException - if an error occurs.
See Also:
UsecaseAuthorizer.setPermission(java.lang.String, org.apache.lenya.cms.publication.Publication, org.apache.lenya.ac.Role, boolean)

authorize

public boolean authorize(org.apache.cocoon.environment.Request request)
                  throws org.apache.lenya.ac.AccessControlException
This method will substitute VISIT_USECASE if no USECASE_PARAMETER is set, so that it can be used to authorize plain page access as well.

Specified by:
authorize in interface org.apache.lenya.ac.Authorizer
Throws:
org.apache.lenya.ac.AccessControlException
See Also:
Authorizer.authorize(org.apache.cocoon.environment.Request)

getConfigurationURI

protected java.lang.String getConfigurationURI(org.apache.lenya.cms.publication.Publication publication)
Returns the source URI of the usecase role configuration file for a certain publication.

Parameters:
publication - The publication.
Returns:
A string representing a URI.

getUsecaseRoles

protected UsecaseRoles getUsecaseRoles(java.lang.String _configurationUri)
                                throws org.apache.lenya.ac.AccessControlException
Throws:
org.apache.lenya.ac.AccessControlException

service

public void service(org.apache.avalon.framework.service.ServiceManager _manager)
             throws org.apache.avalon.framework.service.ServiceException
Specified by:
service in interface org.apache.avalon.framework.service.Serviceable
Throws:
org.apache.avalon.framework.service.ServiceException
See Also:
Serviceable.service(org.apache.avalon.framework.service.ServiceManager)

dispose

public void dispose()
Specified by:
dispose in interface org.apache.avalon.framework.activity.Disposable
See Also:
Disposable.dispose()

parameterize

public void parameterize(org.apache.avalon.framework.parameters.Parameters parameters)
                  throws org.apache.avalon.framework.parameters.ParameterException
Specified by:
parameterize in interface org.apache.avalon.framework.parameters.Parameterizable
Throws:
org.apache.avalon.framework.parameters.ParameterException


Copyright © $ Apache Software Foundation. All Rights Reserved.