org.apache.jetspeed.security
Class FolderPermission

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

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 187964 2004-11-19 03:08:47Z taylor $
Author:
David Sean Taylor, Christophe Lombart
See Also:
Serialized Form

Field Summary
private  String cpath
           
private  boolean folder
           
static char FOLDER_SEPARATOR
           
private  boolean recursive
           
static char RECURSIVE_CHAR
           
static char WILD_CHAR
           
 
Fields inherited from class org.apache.jetspeed.security.PortalResourcePermission
mask, subject
 
Fields inherited from class java.security.Permission
 
Constructor Summary
FolderPermission(String name, String actions)
          Constructor for FolderPermission.
FolderPermission(String name, String actions, Subject subject)
          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.
 PermissionCollection newPermissionCollection()
          Overrides Permission.newPermissionCollection().
private  void parseActions(String actions)
          Parses the actions string.
 
Methods inherited from class org.apache.jetspeed.security.PortalResourcePermission
getActions, getSubject
 
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

FOLDER_SEPARATOR

public static final char FOLDER_SEPARATOR
See Also:
Constant Field Values

folder

private transient boolean folder

recursive

private transient boolean recursive

cpath

private transient 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,
                        String actions,
                        Subject subject)

Constructor for FolderPermission.

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

newPermissionCollection

public PermissionCollection newPermissionCollection()

Overrides Permission.newPermissionCollection().

See Also:
Permission.newPermissionCollection()

parseActions

private void parseActions(String actions)

Parses the actions string.

Actions are separated by commas or white space.

Parameters:
actions - The actions

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.

Overrides:
equals in class PortalResourcePermission
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.
See Also:
Permission.equals(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-2005 Apache Software Foundation. All Rights Reserved.