com.metamatrix.platform.security.util
Class RolePermission

java.lang.Object
  extended by com.metamatrix.platform.security.api.AuthorizationPermission
      extended by com.metamatrix.platform.security.util.RolePermission
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable

public class RolePermission
extends AuthorizationPermission
implements java.lang.Cloneable

A RolePermission defines access permissions for Metadata resources (i.e., MetadataID instances). This class extends the AuthorizationPermission abstract class and provides specialized implies, equals, and compareTo method implementations.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.metamatrix.platform.security.api.AuthorizationPermission
DEFAULT_ACTIONS, hashCode, PRIME, resource
 
Method Summary
protected  java.lang.Object clone()
          Make a deep copy of this object.
 int compareTo(java.lang.Object o)
          Compares this AuthorizationPermission to another Object.
 boolean equals(java.lang.Object obj)
          Returns true if the specified object is semantically equal to this instance.
 boolean implies(AuthorizationPermission request)
          Determine whether the official AuthorizationPermission instance implies the access requested by the request AuthorizationPermission instance.
 boolean resourceIsRecursive()
          Roles are not recursive.
 
Methods inherited from class com.metamatrix.platform.security.api.AuthorizationPermission
compare, getActions, getContentModifier, getFactoryClassName, getRealm, getRealmName, getResource, getResourceName, hasContentModifier, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

clone

protected java.lang.Object clone()
                          throws java.lang.CloneNotSupportedException
Make a deep copy of this object.

Specified by:
clone in class AuthorizationPermission
Returns:
The newly copied object.
Throws:
java.lang.CloneNotSupportedException

resourceIsRecursive

public boolean resourceIsRecursive()
Roles are not recursive.

Overrides:
resourceIsRecursive in class AuthorizationPermission
Returns:
false allways.

implies

public boolean implies(AuthorizationPermission request)
Determine whether the official AuthorizationPermission instance implies the access requested by the request AuthorizationPermission instance.

The requested request is implied by the official request if all of the following conditions are satisfied:

  • the realm name of each request instance must be equivalent (since the realm names are String instances, this is evaluated using the String.equals() method);
  • all of the actions of the requested request must be included in the actions of the official request (@see AuthorizationActions.implies);
  • the number of atomic names in the official resource must be equal to or greater than the number of atomic names in the requested resource;
  • if there is a recursive parameter in both resource names, and the requested resource name is more restrictive than the official resource name;
  • if there is a recursive parameter in the official resource but not the requested resource or neither resource contains a recursive parameter, and the requested resource is contained in its entirety within the official resource name (starting at the beginning of the official resource).
  • Note: the content modifier of the permissions is not used in this algorithm.

    Specified by:
    implies in class AuthorizationPermission
    Parameters:
    request - the request that is being requested or attempted, and which is in question by the caller
    Returns:
    true if the official request does imply access to the resource(s) specified by the request

    equals

    public boolean equals(java.lang.Object obj)
    Description copied from class: AuthorizationPermission
    Returns true if the specified object is semantically equal to this instance. Note: this method is consistent with compareTo().

    Overrides:
    equals in class AuthorizationPermission
    Parameters:
    obj - the object that this instance is to be compared to.
    Returns:
    whether the object is equal to this object.

    compareTo

    public int compareTo(java.lang.Object o)
                  throws java.lang.ClassCastException
    Description copied from class: AuthorizationPermission
    Compares this AuthorizationPermission to another Object. If the Object is an AuthorizationPermission, this function compares the name. Otherwise, it throws a ClassCastException (as policyID instances are comparable only to other AuthorizationPermission instances). Note: this method is consistent with equals().

    Specified by:
    compareTo in interface java.lang.Comparable
    Overrides:
    compareTo in class AuthorizationPermission
    Parameters:
    o - the object that this instance is to be compared to.
    Returns:
    a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object, respectively.
    Throws:
    java.lang.ClassCastException - if the specified object's type prevents it from being compared to this AuthorizationPermission.


    Copyright © 2009. All Rights Reserved.