org.apache.wicket.authorization.strategies.role.metadata
Class InstantiationPermissions

java.lang.Object
  extended by org.apache.wicket.authorization.strategies.role.metadata.InstantiationPermissions
All Implemented Interfaces:
java.io.Serializable, org.apache.wicket.IClusterable

public class InstantiationPermissions
extends java.lang.Object
implements org.apache.wicket.IClusterable

An internal data structure that maps a given component class to a set of role strings. Permissions can be granted to instantiate a given component class via authorize(Class, Roles roles) and denied via unauthorize(Class, Roles roles). All authorization can be removed for a given class with authorizeAll(Class).

Author:
Eelco Hillenius, Jonathan Locke
See Also:
Serialized Form

Constructor Summary
InstantiationPermissions()
           
 
Method Summary
 void authorize(java.lang.Class<? extends org.apache.wicket.Component> componentClass, Roles rolesToAdd)
          Gives the given role permission to instantiate the given class.
 void authorizeAll(java.lang.Class<? extends org.apache.wicket.Component> componentClass)
          Gives all roles permission to instantiate the given class.
 Roles authorizedRoles(java.lang.Class<? extends org.apache.wicket.Component> componentClass)
          Gets the roles that have a binding with the given component class.
protected  java.util.Map<java.lang.Class<? extends org.apache.wicket.Component>,Roles> getRolesForComponentClass()
           
 void unauthorize(java.lang.Class<? extends org.apache.wicket.Component> componentClass, Roles rolesToRemove)
          Removes permission for the given role to instantiate the given class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstantiationPermissions

public InstantiationPermissions()
Method Detail

authorize

public final void authorize(java.lang.Class<? extends org.apache.wicket.Component> componentClass,
                            Roles rolesToAdd)
Gives the given role permission to instantiate the given class.

Parameters:
componentClass - The component class
rolesToAdd - The roles to add

authorizeAll

public final void authorizeAll(java.lang.Class<? extends org.apache.wicket.Component> componentClass)
Gives all roles permission to instantiate the given class.

Parameters:
componentClass - The component class

authorizedRoles

public Roles authorizedRoles(java.lang.Class<? extends org.apache.wicket.Component> componentClass)
Gets the roles that have a binding with the given component class.

Parameters:
componentClass - the component class
Returns:
the roles that have a binding with the given component class, or null if no entries are found

unauthorize

public final void unauthorize(java.lang.Class<? extends org.apache.wicket.Component> componentClass,
                              Roles rolesToRemove)
Removes permission for the given role to instantiate the given class.

Parameters:
componentClass - The class
rolesToRemove - The role to deny

getRolesForComponentClass

protected final java.util.Map<java.lang.Class<? extends org.apache.wicket.Component>,Roles> getRolesForComponentClass()
Returns:
gets map with roles objects for a component classes


Copyright © 2004-2008 Apache Software Foundation. All Rights Reserved.