com.arsdigita.kernel.permissions
Class PrivilegeDescriptor

java.lang.Object
  extended bycom.arsdigita.kernel.permissions.PrivilegeDescriptor

public class PrivilegeDescriptor
extends Object

Describes a privilege that can be granted or checked.

Version:
1.0
Author:
Oumi Mehrotra

Field Summary
static PrivilegeDescriptor ADMIN
          The PrivilegeDescriptor corresponding to the primitive admin privilege
static PrivilegeDescriptor CREATE
          The PrivilegeDescriptor corresponding to the primitive create privilege
static PrivilegeDescriptor DELETE
          The PrivilegeDescriptor corresponding to the primitive delete privilege
static PrivilegeDescriptor EDIT
          The PrivilegeDescriptor corresponding to the read and write privilege
static PrivilegeDescriptor READ
          The PrivilegeDescriptor corresponding to the primitive read privilege
static String versionId
           
static PrivilegeDescriptor WRITE
          The PrivilegeDescriptor corresponding to the primitive write privilege
 
Constructor Summary
PrivilegeDescriptor(String name)
          Deprecated. see #get
 
Method Summary
static void addChildPrivilege(String privilegeName, String childPrivilegeName)
           
static PrivilegeDescriptor createPrivilege(String name)
          Adds a privilege to the system.
 void deletePrivilege()
          Deletes the privilege described by this from the system.
 boolean equals(Object o)
          Determines whether this PrivilegeDescriptor is equal to some other PrivilegeDescriptor.
static PrivilegeDescriptor get(String privilegeName)
          Given a privilege name, returns a privilege descriptor or null if the privilege does not exist on the system.
static Collection getAll()
          Returns a collection of privilege descriptors for every privilege in the system.
 String getColumnName()
          Get column name from privilege - pd_priv_xxx column name mapping.
 String getDisplayName()
          
Returns the display name for the privilege, or just the privilege name if no display name is defined.
 Collection getImplyingPrivilegeNames()
          Returns the list of privilege names that imply this privilege.
 String getName()
          Returns the privilege name.
 int hashCode()
           
static void initialize()
          Initializes the PrivilegeDescriptor's internal cache of privileges.
 boolean isImpliedBy(PrivilegeDescriptor privilege)
          Determine whether or not this privilege is implied by the specified privilege.
protected static void put(PrivilegeDescriptor privDesc)
          Puts a privilege descriptor into the internal cache that is used by the get method.
 String toString()
          Equivalent to getName().
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values

ADMIN

public static final PrivilegeDescriptor ADMIN
The PrivilegeDescriptor corresponding to the primitive admin privilege


EDIT

public static final PrivilegeDescriptor EDIT
The PrivilegeDescriptor corresponding to the read and write privilege


READ

public static final PrivilegeDescriptor READ
The PrivilegeDescriptor corresponding to the primitive read privilege


WRITE

public static final PrivilegeDescriptor WRITE
The PrivilegeDescriptor corresponding to the primitive write privilege


CREATE

public static final PrivilegeDescriptor CREATE
The PrivilegeDescriptor corresponding to the primitive create privilege


DELETE

public static final PrivilegeDescriptor DELETE
The PrivilegeDescriptor corresponding to the primitive delete privilege

Constructor Detail

PrivilegeDescriptor

public PrivilegeDescriptor(String name)
Deprecated. see #get

Create a new privilege descriptor for use with PermissionDescriptor and PermissionService.

Parameters:
name - The name of the privilege.
Method Detail

createPrivilege

public static PrivilegeDescriptor createPrivilege(String name)
                                           throws PersistenceException
Adds a privilege to the system.

Throws:
PersistenceException - when there is a persistence error in saving the new privilege.
See Also:
get(String)

addChildPrivilege

public static void addChildPrivilege(String privilegeName,
                                     String childPrivilegeName)

get

public static PrivilegeDescriptor get(String privilegeName)
Given a privilege name, returns a privilege descriptor or null if the privilege does not exist on the system.

Parameters:
privilegeName - the name of the privilege to return
Returns:
a privilege descriptor, or null if the privilege does not exist.
See Also:
createPrivilege(String)

getAll

public static Collection getAll()
Returns a collection of privilege descriptors for every privilege in the system.

Returns:
a collection of privilege descriptors.
See Also:
get(String)

deletePrivilege

public void deletePrivilege()
                     throws PersistenceException
Deletes the privilege described by this from the system.

Throws:
PersistenceException - when there is a persistence error in saving the new privilege.
See Also:
get(String)

getName

public final String getName()
Returns the privilege name.

Returns:
the privilege name.

getDisplayName

public String getDisplayName()

Returns the display name for the privilege, or just the privilege name if no display name is defined.

Returns:
the display name

toString

public String toString()
Equivalent to getName().

Returns:
the privilege name

getColumnName

public String getColumnName()
Get column name from privilege - pd_priv_xxx column name mapping.

Returns:
the column name from dnm_privilege_col_map table

equals

public boolean equals(Object o)
Determines whether this PrivilegeDescriptor is equal to some other PrivilegeDescriptor. Equality is based on privilege name.

Returns:
true if the privilege descriptors are equal; false otherwise.

hashCode

public int hashCode()

put

protected static void put(PrivilegeDescriptor privDesc)
Puts a privilege descriptor into the internal cache that is used by the get method. The put method supports extendibility by allowing subclasses to be returned by the get method.


getImplyingPrivilegeNames

public Collection getImplyingPrivilegeNames()
Returns the list of privilege names that imply this privilege.

Returns:
a collection of the privilege names that imply this privilege.

isImpliedBy

public boolean isImpliedBy(PrivilegeDescriptor privilege)
Determine whether or not this privilege is implied by the specified privilege.

Returns:
true if the privilege on which this method is invoked is implied by the specified privilege, false otherwise

initialize

public static void initialize()
Initializes the PrivilegeDescriptor's internal cache of privileges. Called from the kernel initializer.



Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 20 2004:2337 UTC