Class PrivilegesInfo
java.lang.Object
org.apache.sling.jcr.jackrabbit.accessmanager.PrivilegesInfo
Helper class to assist in the usage of access control from scripts.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classWrapper class that holds the set of Privileges that are granted and/or denied for a specific principal.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleancanAddChildren(javax.jcr.Node node) Checks whether the current user has been granted privileges to add children to the specified node.booleancanAddChildren(javax.jcr.Session session, String absPath) Checks whether the current user has been granted privileges to add children to the specified path.booleancanDelete(javax.jcr.Node node) Checks whether the current user has been granted privileges to delete the specified node.booleanChecks whether the current user has been granted privileges to delete the specified path.booleancanDeleteChildren(javax.jcr.Node node) Checks whether the current user has been granted privileges to delete children to the specified node.booleancanDeleteChildren(javax.jcr.Session session, String absPath) Checks whether the current user has been granted privileges to delete children of the specified path.booleancanModifyAccessControl(javax.jcr.Node node) Checks whether the current user has been granted privileges to modify the access control of the specified node.booleancanModifyAccessControl(javax.jcr.Session session, String absPath) Checks whether the current user has been granted privileges to modify the access control of the specified path.booleancanModifyProperties(javax.jcr.Node node) Checks whether the current user has been granted privileges to modify properties of the specified node.booleancanModifyProperties(javax.jcr.Session session, String absPath) Checks whether the current user has been granted privileges to modify properties of the specified path.booleancanReadAccessControl(javax.jcr.Node node) Checks whether the current user has been granted privileges to read the access control of the specified node.booleancanReadAccessControl(javax.jcr.Session session, String absPath) Checks whether the current user has been granted privileges to read the access control of the specified path.getDeclaredAccessRights(javax.jcr.Node node) Returns the mapping of declared access rights that have been set for the resource at the given path.getDeclaredAccessRights(javax.jcr.Session session, String absPath) Returns the mapping of declared access rights that have been set for the resource at the given path.getDeclaredAccessRightsForPrincipal(javax.jcr.Node node, String principalId) Returns the declared access rights for the specified Node for the given principalId.getDeclaredAccessRightsForPrincipal(javax.jcr.Session session, String absPath, String principalId) Returns the declared access rights for the resource at the specified path for the given principalId.getDeclaredRestrictionsForPrincipal(javax.jcr.Node node, String principalId) Deprecated.don't use this as it assumes that all the privileges have the same restrictions which may not be truegetDeclaredRestrictionsForPrincipal(javax.jcr.Session session, String absPath, String principalId) Deprecated.don't use this as it assumes that all the privileges have the same restrictions which may not be truegetEffectiveAccessRights(javax.jcr.Node node) Returns the mapping of effective access rights that have been set for the resource at the given path.getEffectiveAccessRights(javax.jcr.Session session, String absPath) Returns the mapping of effective access rights that have been set for the resource at the given path.getEffectiveAccessRightsForPrincipal(javax.jcr.Node node, String principalId) Returns the effective access rights for the specified Node for the given principalId.getEffectiveAccessRightsForPrincipal(javax.jcr.Session session, String absPath, String principalId) Returns the effective access rights for the resource at the specified path for the given principalId.javax.jcr.security.Privilege[]getSupportedPrivileges(javax.jcr.Node node) Return the supported Privileges for the specified node.javax.jcr.security.Privilege[]getSupportedPrivileges(javax.jcr.Session session, String absPath) Returns the supported privileges for the specified path.protected Map<Principal,PrivilegesInfo.AccessRights> toMap(javax.jcr.Session session, jakarta.json.JsonObject aclJson) Convert the JSON acl to a map of Principal to AccessRights
- 
Constructor Details- 
PrivilegesInfopublic PrivilegesInfo()
 
- 
- 
Method Details- 
getSupportedPrivilegespublic javax.jcr.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- if any errors reading the information
 
- 
getSupportedPrivilegespublic javax.jcr.security.Privilege[] getSupportedPrivileges(javax.jcr.Session session, 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- if any errors reading the information
 
- 
getDeclaredAccessRightspublic Map<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- if any errors reading the information
 
- 
getDeclaredAccessRightspublic Map<Principal,PrivilegesInfo.AccessRights> getDeclaredAccessRights(javax.jcr.Session session, 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- if any errors reading the information
 
- 
toMapprotected Map<Principal,PrivilegesInfo.AccessRights> toMap(javax.jcr.Session session, jakarta.json.JsonObject aclJson) throws javax.jcr.RepositoryException Convert the JSON acl to a map of Principal to AccessRights- Parameters:
- session- the jcr session
- aclJson- the acl JSON object
- Returns:
- map of Principal to AccessRights
- Throws:
- javax.jcr.RepositoryException
 
- 
getDeclaredAccessRightsForPrincipalpublic PrivilegesInfo.AccessRights getDeclaredAccessRightsForPrincipal(javax.jcr.Node node, 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- if any errors reading the information
 
- 
getDeclaredAccessRightsForPrincipalpublic PrivilegesInfo.AccessRights getDeclaredAccessRightsForPrincipal(javax.jcr.Session session, String absPath, 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- if any errors reading the information
 
- 
getDeclaredRestrictionsForPrincipal@Deprecated public Map<String,Object> getDeclaredRestrictionsForPrincipal(javax.jcr.Node node, String principalId) throws javax.jcr.RepositoryException Deprecated.don't use this as it assumes that all the privileges have the same restrictions which may not be trueReturns the restrictions for the specified path.- Parameters:
- node- the node to inspect
- principalId- the principalId to get the access rights for
- Returns:
- map of restrictions (key is restriction name, value is Value or Value[])
- Throws:
- javax.jcr.RepositoryException- if any errors reading the information
 
- 
getDeclaredRestrictionsForPrincipal@Deprecated public Map<String,Object> getDeclaredRestrictionsForPrincipal(javax.jcr.Session session, String absPath, String principalId) throws javax.jcr.RepositoryException Deprecated.don't use this as it assumes that all the privileges have the same restrictions which may not be trueReturns the restrictions for the specified path.- Parameters:
- session- the session for the current user
- absPath- the path to get the privileges for
- principalId- the principalId to get the access rights for
- Returns:
- map of restrictions (key is restriction name, value is Value or Value[])
- Throws:
- javax.jcr.RepositoryException- if any errors reading the information
 
- 
getEffectiveAccessRightspublic Map<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- if any errors reading the information
 
- 
getEffectiveAccessRightspublic Map<Principal,PrivilegesInfo.AccessRights> getEffectiveAccessRights(javax.jcr.Session session, 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- if any errors reading the information
 
- 
getEffectiveAccessRightsForPrincipalpublic PrivilegesInfo.AccessRights getEffectiveAccessRightsForPrincipal(javax.jcr.Node node, 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- if any errors reading the information
 
- 
getEffectiveAccessRightsForPrincipalpublic PrivilegesInfo.AccessRights getEffectiveAccessRightsForPrincipal(javax.jcr.Session session, String absPath, 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- if any errors reading the information
 
- 
canAddChildrenpublic 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
 
- 
canAddChildrenChecks 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
 
- 
canDeleteChildrenpublic 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
 
- 
canDeleteChildrenChecks 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
 
- 
canDeletepublic 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
 
- 
canDeleteChecks 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
 
- 
canModifyPropertiespublic 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
 
- 
canModifyPropertiesChecks 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
 
- 
canReadAccessControlpublic 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
 
- 
canReadAccessControlChecks 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
 
- 
canModifyAccessControlpublic 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
 
- 
canModifyAccessControlChecks 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
 
 
-