org.apache.jackrabbit.core.security.authorization
Class PrivilegeRegistry

java.lang.Object
  extended by org.apache.jackrabbit.core.security.authorization.PrivilegeRegistry
All Implemented Interfaces:
PrivilegeEventListener

public final class PrivilegeRegistry
extends Object
implements PrivilegeEventListener

The PrivilegeRegistry defines the set of Privileges known to the repository.


Field Summary
static int NO_PRIVILEGE
          No privileges
static String REP_PRIVILEGE_MANAGEMENT
          Jackrabbit specific privilege for privilege management.
static org.apache.jackrabbit.spi.Name REP_PRIVILEGE_MANAGEMENT_NAME
           
static String REP_WRITE
          Jackrabbit specific write privilege that combines Privilege.JCR_WRITE and Privilege.JCR_NODE_TYPE_MANAGEMENT.
static org.apache.jackrabbit.spi.Name REP_WRITE_NAME
           
 
Constructor Summary
PrivilegeRegistry(org.apache.jackrabbit.spi.commons.conversion.NameResolver resolver)
          Deprecated. Use PrivilegeManager instead.
PrivilegeRegistry(NamespaceRegistry namespaceRegistry, FileSystem fs)
          Create a new PrivilegeRegistry instance.
 
Method Summary
static int calculatePermissions(int privs, int parentPrivs, boolean isAllow, boolean protectsPolicy)
          Deprecated. Use calculatePermissions(PrivilegeBits, PrivilegeBits, boolean, boolean) instead.
static int calculatePermissions(PrivilegeBits privs, PrivilegeBits parentPrivs, boolean isAllow, boolean protectsPolicy)
          Build the permissions granted by evaluating the given privileges.
 void externalRegisteredPrivileges(Collection<org.apache.jackrabbit.spi.PrivilegeDefinition> definitions)
          Called when one or more privilege definitions have been externally registered.
static int getBits(Privilege[] privileges)
          Deprecated. Use PrivilegeManagerImpl.getBits(javax.jcr.security.Privilege...) instead.
 Privilege getPrivilege(String privilegeName)
          Deprecated. Use PrivilegeManager.getPrivilege(String) instead.
 Privilege[] getPrivileges(int bits)
          Deprecated. Use PrivilegeManagerImpl.getPrivileges(PrivilegeBits) instead.
 Privilege[] getRegisteredPrivileges()
          Deprecated. Use PrivilegeManager.getRegisteredPrivileges() instead.
 void setEventChannel(PrivilegeEventChannel eventChannel)
          Set a clustering event channel to inform about changes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REP_WRITE

public static final String REP_WRITE
Jackrabbit specific write privilege that combines Privilege.JCR_WRITE and Privilege.JCR_NODE_TYPE_MANAGEMENT.

See Also:
Constant Field Values

REP_WRITE_NAME

public static final org.apache.jackrabbit.spi.Name REP_WRITE_NAME

REP_PRIVILEGE_MANAGEMENT

public static final String REP_PRIVILEGE_MANAGEMENT
Jackrabbit specific privilege for privilege management.

See Also:
Constant Field Values

REP_PRIVILEGE_MANAGEMENT_NAME

public static final org.apache.jackrabbit.spi.Name REP_PRIVILEGE_MANAGEMENT_NAME

NO_PRIVILEGE

public static final int NO_PRIVILEGE
No privileges

See Also:
Constant Field Values
Constructor Detail

PrivilegeRegistry

public PrivilegeRegistry(NamespaceRegistry namespaceRegistry,
                         FileSystem fs)
                  throws RepositoryException
Create a new PrivilegeRegistry instance.

Parameters:
namespaceRegistry -
fs -
Throws:
RepositoryException

PrivilegeRegistry

public PrivilegeRegistry(org.apache.jackrabbit.spi.commons.conversion.NameResolver resolver)
Deprecated. Use PrivilegeManager instead.

Create a new PrivilegeRegistry instance defining only built-in privileges.

Parameters:
resolver -
See Also:
JackrabbitWorkspace.getPrivilegeManager()
Method Detail

externalRegisteredPrivileges

public void externalRegisteredPrivileges(Collection<org.apache.jackrabbit.spi.PrivilegeDefinition> definitions)
                                  throws RepositoryException
Description copied from interface: PrivilegeEventListener
Called when one or more privilege definitions have been externally registered.

Specified by:
externalRegisteredPrivileges in interface PrivilegeEventListener
Parameters:
definitions - privilege definitions
Throws:
RepositoryException - if an error occurs
See Also:
PrivilegeEventListener.externalRegisteredPrivileges(java.util.Collection)

setEventChannel

public void setEventChannel(PrivilegeEventChannel eventChannel)
Set a clustering event channel to inform about changes.

Parameters:
eventChannel - event channel

getRegisteredPrivileges

public Privilege[] getRegisteredPrivileges()
Deprecated. Use PrivilegeManager.getRegisteredPrivileges() instead.

Throws UnsupportedOperationException.

Returns:
all registered privileges.

getPrivilege

public Privilege getPrivilege(String privilegeName)
                       throws AccessControlException,
                              RepositoryException
Deprecated. Use PrivilegeManager.getPrivilege(String) instead.

Creates a new PrivilegeManager from the specified resolver and calls PrivilegeManagerImpl.getRegisteredPrivileges().

Parameters:
privilegeName - Name of the privilege.
Returns:
the privilege with the specified privilegeName.
Throws:
AccessControlException - If no privilege with the given name exists.
RepositoryException - If another error occurs.

getPrivileges

public Privilege[] getPrivileges(int bits)
Deprecated. Use PrivilegeManagerImpl.getPrivileges(PrivilegeBits) instead.

Creates a new PrivilegeManager from the specified resolver and calls PrivilegeManagerImpl.getPrivileges(PrivilegeBits).

Parameters:
bits - Privilege bits as obtained from getBits(Privilege[]).
Returns:
Array of Privileges that are presented by the given it or an empty array if bits is lower than READ or cannot be resolved to registered Privileges.
See Also:
getBits(Privilege[])

getBits

public static int getBits(Privilege[] privileges)
                   throws AccessControlException
Deprecated. Use PrivilegeManagerImpl.getBits(javax.jcr.security.Privilege...) instead.

Best effort approach to calculate bits for built-in privileges. Throws UnsupportedOperationException if the workaround fails.

Parameters:
privileges - An array of privileges.
Returns:
The privilege bits.
Throws:
AccessControlException - If the specified array is null or if it contains an unregistered privilege.
See Also:
getPrivileges(int)

calculatePermissions

public static int calculatePermissions(PrivilegeBits privs,
                                       PrivilegeBits parentPrivs,
                                       boolean isAllow,
                                       boolean protectsPolicy)
Build the permissions granted by evaluating the given privileges. Note, that only built-in privileges can be mapped to permissions. Any other privileges will be ignored.

Parameters:
privs - The privileges granted on the Node itself (for properties the ACL of the direct ancestor).
parentPrivs - The privileges granted on the parent of the Node. Not relevant for properties since it only is used to determine permissions on a Node (add_child_nodes, remove_child_nodes).
isAllow - true if the privileges are granted; false otherwise.
protectsPolicy - If true the affected item itself defines access control related information.
Returns:
the permissions granted evaluating the given privileges.

calculatePermissions

public static int calculatePermissions(int privs,
                                       int parentPrivs,
                                       boolean isAllow,
                                       boolean protectsPolicy)
Deprecated. Use calculatePermissions(PrivilegeBits, PrivilegeBits, boolean, boolean) instead.

Build the permissions granted by evaluating the given privileges. Note, that only built-in privileges can be mapped to permissions. Any other privileges will be ignored.

Parameters:
privs - The privileges granted on the Node itself (for properties the ACL of the direct ancestor).
parentPrivs - The privileges granted on the parent of the Node. Not relevant for properties since it only is used to determine permissions on a Node (add_child_nodes, remove_child_nodes).
isAllow - true if the privileges are granted; false otherwise.
protectsPolicy - If true the affected item itself defines access control related information.
Returns:
the permissions granted evaluating the given privileges.


Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.