org.modeshape.jcr.security.acl

## Class JcrAccessControlList

- java.lang.Object
- - org.modeshape.jcr.security.acl.JcrAccessControlList

- All Implemented Interfaces:
    AccessControlList, AccessControlPolicy

      public class JcrAccessControlList
      extends Object
      implements AccessControlList

  Resources based Access Control List implementation. ACLs are stored per node in a special child node called mode:acl. This node has a list of mode:{$principal_name} child nodes which has multi-value property permissions. Permissions are defined by JCR specifications. {node} {mode:AccessControllable} +mode:acl{mode:Acl} +user-name{mode:permission} -permissions {String}

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JcrAccessControlList(AccessControlManagerImpl acm, String path)` Creates new empty access control list.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `addAccessControlEntry(Principal principal, Privilege[] privileges)`
    `static JcrAccessControlList` | `defaultAcl(AccessControlManagerImpl acm)` Creates default Access Control List.
    `boolean` | `equals(Object other)`
    `AccessControlEntry[]` | `getAccessControlEntries()`
    `Privilege[]` | `getPrivileges(SecurityContext context)` Lists all privileges defined by this access list for the given user.
    `boolean` | `hasEntry(String name)`
    `int` | `hashCode()`
    `boolean` | `hasPrivileges(SecurityContext sc, Privilege[] privileges)` Tests privileges relatively to the given security context.
    `boolean` | `isEmpty()` Checks entries of this access control list.
    `void` | `removeAccessControlEntry(AccessControlEntry accessControlEntry)`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JcrAccessControlList

          public JcrAccessControlList(AccessControlManagerImpl acm,
                              String path)

      Creates new empty access control list.
      Parameters:
        `acm` - Access Control Manager managing this access list.
        `path` - the path to which this access list is applied.

  - ### Method Detail

    - #### defaultAcl

          public static JcrAccessControlList defaultAcl(AccessControlManagerImpl acm)

      Creates default Access Control List.
      Parameters:
        `acm` - access control manager instance
      Returns:
        Access Control List with all permissions granted to everyone.

    - #### isEmpty

          public boolean isEmpty()

      Checks entries of this access control list.
      Returns:
        true if this access list does not have entries and false otherwise.

    - #### getAccessControlEntries

          public AccessControlEntry[] getAccessControlEntries()

      Specified by:
        `getAccessControlEntries` in interface `AccessControlList`

    - #### addAccessControlEntry

          public boolean addAccessControlEntry(Principal principal,
                                      Privilege[] privileges)
                                        throws AccessControlException,
                                               RepositoryException

      Specified by:
        `addAccessControlEntry` in interface `AccessControlList`
      Throws:
        `AccessControlException`
        `RepositoryException`

    - #### removeAccessControlEntry

          public void removeAccessControlEntry(AccessControlEntry accessControlEntry)
                                        throws AccessControlException,
                                               RepositoryException

      Specified by:
        `removeAccessControlEntry` in interface `AccessControlList`
      Throws:
        `AccessControlException`
        `RepositoryException`

    - #### hasPrivileges

          public boolean hasPrivileges(SecurityContext sc,
                              Privilege[] privileges)

      Tests privileges relatively to the given security context.
      Parameters:
        `sc` - security context carrying information about principals
        `privileges` - privileges for test
      Returns:
        true when access list grants all given privileges within given security context.

    - #### getPrivileges

          public Privilege[] getPrivileges(SecurityContext context)

      Lists all privileges defined by this access list for the given user.
      Parameters:
        `context` - the security context of the user; never null
      Returns:
        list of privilege objects.

    - #### hasEntry

          public boolean hasEntry(String name)

    - #### equals

          public boolean equals(Object other)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.