org.apache.sling.jcr.jackrabbit.accessmanager
Class PrivilegesInfo

java.lang.Object
  extended by org.apache.sling.jcr.jackrabbit.accessmanager.PrivilegesInfo

public class PrivilegesInfo
extends java.lang.Object

Helper class to assist in the usage of access control from scripts.


Nested Class Summary
static class PrivilegesInfo.AccessRights
          Wrapper class that holds the set of Privileges that are granted and/or denied for a specific principal.
 
Constructor Summary
PrivilegesInfo()
           
 
Method Summary
 boolean canAddChildren(javax.jcr.Node node)
          Checks whether the current user has been granted privileges to add children to the specified node.
 boolean canAddChildren(javax.jcr.Session session, java.lang.String absPath)
          Checks whether the current user has been granted privileges to add children to the specified path.
 boolean canDelete(javax.jcr.Node node)
          Checks whether the current user has been granted privileges to delete the specified node.
 boolean canDelete(javax.jcr.Session session, java.lang.String absPath)
          Checks whether the current user has been granted privileges to delete the specified path.
 boolean canDeleteAuthorizable(javax.jcr.Session session, java.lang.String principalID)
          Checks whether the current user has been granted privileges to delete the specified principal.
 boolean canDeleteChildren(javax.jcr.Node node)
          Checks whether the current user has been granted privileges to delete children to the specified node.
 boolean canDeleteChildren(javax.jcr.Session session, java.lang.String absPath)
          Checks whether the current user has been granted privileges to delete children of the specified path.
 boolean canModifyAccessControl(javax.jcr.Node node)
          Checks whether the current user has been granted privileges to modify the access control of the specified node.
 boolean canModifyAccessControl(javax.jcr.Session session, java.lang.String absPath)
          Checks whether the current user has been granted privileges to modify the access control of the specified path.
 boolean canModifyProperties(javax.jcr.Node node)
          Checks whether the current user has been granted privileges to modify properties of the specified node.
 boolean canModifyProperties(javax.jcr.Session session, java.lang.String absPath)
          Checks whether the current user has been granted privileges to modify properties of the specified path.
 boolean canReadAccessControl(javax.jcr.Node node)
          Checks whether the current user has been granted privileges to read the access control of the specified node.
 boolean canReadAccessControl(javax.jcr.Session session, java.lang.String absPath)
          Checks whether the current user has been granted privileges to read the access control of the specified path.
 boolean canUpdateAuthorizable(javax.jcr.Session session, java.lang.String principalID)
          Checks whether the current user has been granted privileges to update the properties of the specified principal.
 java.util.Map<java.security.Principal,PrivilegesInfo.AccessRights> getDeclaredAccessRights(javax.jcr.Node node)
          Returns the mapping of declared access rights that have been set for the resource at the given path.
 java.util.Map<java.security.Principal,PrivilegesInfo.AccessRights> getDeclaredAccessRights(javax.jcr.Session session, java.lang.String absPath)
          Returns the mapping of declared access rights that have been set for the resource at the given path.
 PrivilegesInfo.AccessRights getDeclaredAccessRightsForPrincipal(javax.jcr.Node node, java.lang.String principalId)
          Returns the declared access rights for the specified Node for the given principalId.
 PrivilegesInfo.AccessRights getDeclaredAccessRightsForPrincipal(javax.jcr.Session session, java.lang.String absPath, java.lang.String principalId)
          Returns the declared access rights for the resource at the specified path for the given principalId.
 java.util.Map<java.security.Principal,PrivilegesInfo.AccessRights> getEffectiveAccessRights(javax.jcr.Node node)
          Returns the mapping of effective access rights that have been set for the resource at the given path.
 java.util.Map<java.security.Principal,PrivilegesInfo.AccessRights> getEffectiveAccessRights(javax.jcr.Session session, java.lang.String absPath)
          Returns the mapping of effective access rights that have been set for the resource at the given path.
 PrivilegesInfo.AccessRights getEffectiveAccessRightsForPrincipal(javax.jcr.Node node, java.lang.String principalId)
          Returns the effective access rights for the specified Node for the given principalId.
 PrivilegesInfo.AccessRights getEffectiveAccessRightsForPrincipal(javax.jcr.Session session, java.lang.String absPath, java.lang.String principalId)
          Returns the effective access rights for the resource at the specified path for the given principalId.
 org.apache.jackrabbit.api.jsr283.security.Privilege[] getSupportedPrivileges(javax.jcr.Node node)
          Return the supported Privileges for the specified node.
 org.apache.jackrabbit.api.jsr283.security.Privilege[] getSupportedPrivileges(javax.jcr.Session session, java.lang.String absPath)
          Returns the supported privileges for the specified path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrivilegesInfo

public PrivilegesInfo()
Method Detail

getSupportedPrivileges

public org.apache.jackrabbit.api.jsr283.security.Privilege[] getSupportedPrivileges(javax.jcr.Node node)
                                                                             throws javax.jcr.RepositoryException
Return the supported Privileges for the specified node.

Parameters:
node - the node to check
Returns:
array of Privileges
Throws:
javax.jcr.RepositoryException

getSupportedPrivileges

public org.apache.jackrabbit.api.jsr283.security.Privilege[] getSupportedPrivileges(javax.jcr.Session session,
                                                                                    java.lang.String absPath)
                                                                             throws javax.jcr.RepositoryException
Returns the supported privileges for the specified path.

Parameters:
session - the session for the current user
absPath - the path to get the privileges for
Returns:
array of Privileges
Throws:
javax.jcr.RepositoryException

getDeclaredAccessRights

public java.util.Map<java.security.Principal,PrivilegesInfo.AccessRights> getDeclaredAccessRights(javax.jcr.Node node)
                                                                                           throws javax.jcr.RepositoryException
Returns the mapping of declared access rights that have been set for the resource at the given path.

Parameters:
node - the node to get the access rights for
Returns:
map of access rights. Key is the user/group principal, value contains the granted/denied privileges
Throws:
javax.jcr.RepositoryException

getDeclaredAccessRights

public java.util.Map<java.security.Principal,PrivilegesInfo.AccessRights> getDeclaredAccessRights(javax.jcr.Session session,
                                                                                                  java.lang.String absPath)
                                                                                           throws javax.jcr.RepositoryException
Returns the mapping of declared access rights that have been set for the resource at the given path.

Parameters:
session - the current user session.
absPath - the path of the resource to get the access rights for
Returns:
map of access rights. Key is the user/group principal, value contains the granted/denied privileges
Throws:
javax.jcr.RepositoryException

getDeclaredAccessRightsForPrincipal

public PrivilegesInfo.AccessRights getDeclaredAccessRightsForPrincipal(javax.jcr.Node node,
                                                                       java.lang.String principalId)
                                                                throws javax.jcr.RepositoryException
Returns the declared access rights for the specified Node for the given principalId.

Parameters:
node - the JCR node to retrieve the access rights for
principalId - the principalId to get the access rights for
Returns:
access rights for the specified principal
Throws:
javax.jcr.RepositoryException

getDeclaredAccessRightsForPrincipal

public PrivilegesInfo.AccessRights getDeclaredAccessRightsForPrincipal(javax.jcr.Session session,
                                                                       java.lang.String absPath,
                                                                       java.lang.String principalId)
                                                                throws javax.jcr.RepositoryException
Returns the declared access rights for the resource at the specified path for the given principalId.

Parameters:
session - the current JCR session
absPath - the path of the resource to retrieve the rights for
principalId - the principalId to get the access rights for
Returns:
access rights for the specified principal
Throws:
javax.jcr.RepositoryException

getEffectiveAccessRights

public java.util.Map<java.security.Principal,PrivilegesInfo.AccessRights> getEffectiveAccessRights(javax.jcr.Node node)
                                                                                            throws javax.jcr.RepositoryException
Returns the mapping of effective access rights that have been set for the resource at the given path.

Parameters:
node - the node to get the access rights for
Returns:
map of access rights. Key is the user/group principal, value contains the granted/denied privileges
Throws:
javax.jcr.RepositoryException

getEffectiveAccessRights

public java.util.Map<java.security.Principal,PrivilegesInfo.AccessRights> getEffectiveAccessRights(javax.jcr.Session session,
                                                                                                   java.lang.String absPath)
                                                                                            throws javax.jcr.RepositoryException
Returns the mapping of effective access rights that have been set for the resource at the given path.

Parameters:
session - the current user session.
absPath - the path of the resource to get the access rights for
Returns:
map of access rights. Key is the user/group principal, value contains the granted/denied privileges
Throws:
javax.jcr.RepositoryException

getEffectiveAccessRightsForPrincipal

public PrivilegesInfo.AccessRights getEffectiveAccessRightsForPrincipal(javax.jcr.Node node,
                                                                        java.lang.String principalId)
                                                                 throws javax.jcr.RepositoryException
Returns the effective access rights for the specified Node for the given principalId.

Parameters:
node - the JCR node to retrieve the access rights for
principalId - the principalId to get the access rights for
Returns:
access rights for the specified principal
Throws:
javax.jcr.RepositoryException

getEffectiveAccessRightsForPrincipal

public PrivilegesInfo.AccessRights getEffectiveAccessRightsForPrincipal(javax.jcr.Session session,
                                                                        java.lang.String absPath,
                                                                        java.lang.String principalId)
                                                                 throws javax.jcr.RepositoryException
Returns the effective access rights for the resource at the specified path for the given principalId.

Parameters:
session - the current JCR session
absPath - the path of the resource to retrieve the rights for
principalId - the principalId to get the access rights for
Returns:
access rights for the specified principal
Throws:
javax.jcr.RepositoryException

canAddChildren

public boolean canAddChildren(javax.jcr.Node node)
Checks whether the current user has been granted privileges to add children to the specified node.

Parameters:
node - the node to check
Returns:
true if the current user has the privileges, false otherwise

canAddChildren

public boolean canAddChildren(javax.jcr.Session session,
                              java.lang.String absPath)
Checks whether the current user has been granted privileges to add children to the specified path.

Parameters:
session - the JCR session of the current user
absPath - the path of the resource to check
Returns:
true if the current user has the privileges, false otherwise

canDeleteChildren

public boolean canDeleteChildren(javax.jcr.Node node)
Checks whether the current user has been granted privileges to delete children to the specified node.

Parameters:
node - the node to check
Returns:
true if the current user has the privileges, false otherwise

canDeleteChildren

public boolean canDeleteChildren(javax.jcr.Session session,
                                 java.lang.String absPath)
Checks whether the current user has been granted privileges to delete children of the specified path.

Parameters:
session - the JCR session of the current user
absPath - the path of the resource to check
Returns:
true if the current user has the privileges, false otherwise

canDelete

public boolean canDelete(javax.jcr.Node node)
Checks whether the current user has been granted privileges to delete the specified node.

Parameters:
node - the node to check
Returns:
true if the current user has the privileges, false otherwise

canDelete

public boolean canDelete(javax.jcr.Session session,
                         java.lang.String absPath)
Checks whether the current user has been granted privileges to delete the specified path.

Parameters:
session - the JCR session of the current user
absPath - the path of the resource to check
Returns:
true if the current user has the privileges, false otherwise

canModifyProperties

public boolean canModifyProperties(javax.jcr.Node node)
Checks whether the current user has been granted privileges to modify properties of the specified node.

Parameters:
node - the node to check
Returns:
true if the current user has the privileges, false otherwise

canModifyProperties

public boolean canModifyProperties(javax.jcr.Session session,
                                   java.lang.String absPath)
Checks whether the current user has been granted privileges to modify properties of the specified path.

Parameters:
session - the JCR session of the current user
absPath - the path of the resource to check
Returns:
true if the current user has the privileges, false otherwise

canReadAccessControl

public boolean canReadAccessControl(javax.jcr.Node node)
Checks whether the current user has been granted privileges to read the access control of the specified node.

Parameters:
node - the node to check
Returns:
true if the current user has the privileges, false otherwise

canReadAccessControl

public boolean canReadAccessControl(javax.jcr.Session session,
                                    java.lang.String absPath)
Checks whether the current user has been granted privileges to read the access control of the specified path.

Parameters:
session - the JCR session of the current user
absPath - the path of the resource to check
Returns:
true if the current user has the privileges, false otherwise

canModifyAccessControl

public boolean canModifyAccessControl(javax.jcr.Node node)
Checks whether the current user has been granted privileges to modify the access control of the specified node.

Parameters:
node - the node to check
Returns:
true if the current user has the privileges, false otherwise

canModifyAccessControl

public boolean canModifyAccessControl(javax.jcr.Session session,
                                      java.lang.String absPath)
Checks whether the current user has been granted privileges to modify the access control of the specified path.

Parameters:
session - the JCR session of the current user
absPath - the path of the resource to check
Returns:
true if the current user has the privileges, false otherwise

canUpdateAuthorizable

public boolean canUpdateAuthorizable(javax.jcr.Session session,
                                     java.lang.String principalID)
Checks whether the current user has been granted privileges to update the properties of the specified principal.

Parameters:
session - the JCR session for the current user
principalID - the id of the principal to check
Returns:
true if the current user has the privileges, false otherwise

canDeleteAuthorizable

public boolean canDeleteAuthorizable(javax.jcr.Session session,
                                     java.lang.String principalID)
Checks whether the current user has been granted privileges to delete the specified principal.

Parameters:
session - the JCR session for the current user
principalID - the id of the principal to check
Returns:
true if the current user has the privileges, false otherwise


Copyright © 2007-2009. All Rights Reserved.