org.apache.jetspeed.security
Class FolderPermission

java.lang.Object
  extended by java.security.Permission
      extended by org.apache.jetspeed.security.PortalResourcePermission
          extended by org.apache.jetspeed.security.FolderPermission
All Implemented Interfaces:
Serializable, Guard

public class FolderPermission
extends PortalResourcePermission

Folder permission.

This code was partially inspired from:

This class represents access to a portal content/folder or document. A FolderPermission consists of a pathname and a set of actions valid for that pathname.

Pathname is the pathname of the folder or document granted the specified actions. A pathname that ends in "/*" (where "/" is the separator character) indicates all the folders and documents contained in that folder. A pathname that ends with "/-" indicates (recursively) all documents and subfolders contained in that directory. A pathname consisting of the special token "<<ALL FILES>>" matches any folder or document.

Version:
$Id: FolderPermission.java 516448 2007-03-09 16:25:47Z ate $
Author:
David Sean Taylor, Christophe Lombart
See Also:
Serialized Form

Field Summary
private  String cpath
           
private  boolean folder
           
static char FOLDER_SEPARATOR
           
static String FOLDER_SEPARATOR_STR
           
private  boolean recursive
           
static char RECURSIVE_CHAR
           
static char WILD_CHAR
           
static String WILD_CHAR_STR
           
 
Fields inherited from class org.apache.jetspeed.security.PortalResourcePermission
mask
 
Constructor Summary
FolderPermission(String name, int mask)
          Constructor for FolderPermission.
FolderPermission(String name, String actions)
          Constructor for FolderPermission.
 
Method Summary
 boolean equals(Object obj)
          Checks two FolderPermission objects for equality.
 int hashCode()
          Returns the hash code value for this object.
 boolean implies(Permission p)
          Checks if this FolderPermission object "implies" the specified permission.
(package private)  boolean impliesIgnoreMask(FolderPermission that)
          Checks if the Permission's actions are a proper subset of the this object's actions.
private  void parsePath()
          Parses the path.
 
Methods inherited from class org.apache.jetspeed.security.PortalResourcePermission
getActions, newPermissionCollection, parseActions
 
Methods inherited from class java.security.Permission
checkGuard, getName, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

RECURSIVE_CHAR

public static final char RECURSIVE_CHAR
See Also:
Constant Field Values

WILD_CHAR

public static final char WILD_CHAR
See Also:
Constant Field Values

WILD_CHAR_STR

public static final String WILD_CHAR_STR

FOLDER_SEPARATOR

public static final char FOLDER_SEPARATOR
See Also:
Constant Field Values

FOLDER_SEPARATOR_STR

public static final String FOLDER_SEPARATOR_STR

folder

private boolean folder

recursive

private boolean recursive

cpath

private String cpath
Constructor Detail

FolderPermission

public FolderPermission(String name,
                        String actions)

Constructor for FolderPermission.

Parameters:
name - The portlet name.
actions - The actions on the portlet.

FolderPermission

public FolderPermission(String name,
                        int mask)

Constructor for FolderPermission.

Parameters:
name - The portlet name.
mask - The mask of actions on the portlet.
Method Detail

parsePath

private void parsePath()

Parses the path.


implies

public boolean implies(Permission p)
Checks if this FolderPermission object "implies" the specified permission.

More specifically, this method returns true if:

Overrides:
implies in class PortalResourcePermission
Parameters:
p - the permission to check against.
Returns:
true if the specified permission is implied by this object, false if not.

impliesIgnoreMask

boolean impliesIgnoreMask(FolderPermission that)
Checks if the Permission's actions are a proper subset of the this object's actions. Returns the effective mask iff the this FolderPermission's path also implies that FolderPermission's path.

Parameters:
that - the FolderPermission to check against.
Returns:
the effective mask

equals

public boolean equals(Object obj)
Checks two FolderPermission objects for equality. Checks that obj is a FolderPermission, and has the same pathname and actions as this object.

Specified by:
equals in class Permission
Parameters:
obj - the object we are testing for equality with this object.
Returns:
true if obj is a FolderPermission, and has the same pathname and actions as this FolderPermission object.

hashCode

public int hashCode()
Returns the hash code value for this object.

Overrides:
hashCode in class PortalResourcePermission
Returns:
a hash code value for this object.
See Also:
Permission.hashCode()


Copyright © 1999-2007 Apache Software Foundation. All Rights Reserved.