test_class.file: oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/ACLTest.java
test_class.identifier: ACLTest
test_class.interfaces: implements PrivilegeConstants, AccessControlConstants
test_class.superclass: extends AbstractAccessControlTest
test_case.body: @Test
      public void testRestrictions() throws Exception {
          String[] names = acl.getRestrictionNames();
          assertNotNull(names);
          assertEquals(4, names.length);
          assertArrayEquals(new String[] {REP_GLOB, REP_NT_NAMES, REP_PREFIXES, REP_ITEM_NAMES}, names);
          assertEquals(PropertyType.STRING, acl.getRestrictionType(names[0]));
          assertEquals(PropertyType.NAME, acl.getRestrictionType(names[1]));
          assertEquals(PropertyType.STRING, acl.getRestrictionType(names[2]));
          assertEquals(PropertyType.NAME, acl.getRestrictionType(names[3]));
  
          Privilege[] writePriv = privilegesFromNames(JCR_WRITE);
  
          // add entry without restr. -> must succeed
          assertTrue(acl.addAccessControlEntry(testPrincipal, writePriv));
          assertEquals(1, acl.getAccessControlEntries().length);
  
          // ... again -> no modification.
          assertFalse(acl.addAccessControlEntry(testPrincipal, writePriv));
          assertEquals(1, acl.getAccessControlEntries().length);
  
          // ... again using different method -> no modification.
          assertFalse(acl.addEntry(testPrincipal, writePriv, true));
          assertEquals(1, acl.getAccessControlEntries().length);
  
          // ... complementary entry -> must modify the acl
          assertTrue(acl.addEntry(testPrincipal, writePriv, false));
          assertEquals(1, acl.getAccessControlEntries().length);
  
          // add an entry with a restrictions:
          Map<String, Value> restrictions = Collections.singletonMap(REP_GLOB, getValueFactory().createValue("/.*"));
          assertTrue(acl.addEntry(testPrincipal, writePriv, false, restrictions));
          assertEquals(2, acl.getAccessControlEntries().length);
  
          // ... same again -> no modification.
          assertFalse(acl.addEntry(testPrincipal, writePriv, false, restrictions));
          assertEquals(2, acl.getAccessControlEntries().length);
  
          // ... complementary entry -> must modify the acl.
          assertTrue(acl.addEntry(testPrincipal, writePriv, true, restrictions));
          assertEquals(2, acl.getAccessControlEntries().length);
      }
test_case.class_method_signature: ACLTest.testRestrictions()
test_case.full_signature: @Test public void testRestrictions()
test_case.identifier: testRestrictions
test_case.invocations: getRestrictionNames assertNotNull assertEquals assertArrayEquals assertEquals getRestrictionType assertEquals getRestrictionType assertEquals getRestrictionType assertEquals getRestrictionType privilegesFromNames assertTrue addAccessControlEntry assertEquals getAccessControlEntries assertFalse addAccessControlEntry assertEquals getAccessControlEntries assertFalse addEntry assertEquals getAccessControlEntries assertTrue addEntry assertEquals getAccessControlEntries singletonMap createValue getValueFactory assertTrue addEntry assertEquals getAccessControlEntries assertFalse addEntry assertEquals getAccessControlEntries assertTrue addEntry assertEquals getAccessControlEntries
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testRestrictions()
focal_class.declarator: log = LoggerFactory.getLogger(ACL.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = LoggerFactory.getLogger(ACL.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: entries = new ArrayList<>()
focal_class.modifier: private final
focal_class.original_string: private final List<ACE> entries = new ArrayList<>();
focal_class.type: List<ACE>
focal_class.var_name: entries
focal_class.file: oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/ACL.java
focal_class.identifier: ACL
focal_class.class_method_signature: ACL.ACL(@Nullable String oakPath, @Nullable List<ACE> entries,
          @NotNull NamePathMapper namePathMapper)
focal_class.full_signature:   ACL(@Nullable String oakPath, @Nullable List<ACE> entries,
          @NotNull NamePathMapper namePathMapper)
focal_class.identifier: ACL
focal_class.parameters: (@Nullable String oakPath, @Nullable List<ACE> entries,
          @NotNull NamePathMapper namePathMapper)
focal_class.signature:  ACL(@Nullable String oakPath, @Nullable List<ACE> entries,
          @NotNull NamePathMapper namePathMapper)
focal_class.class_method_signature: ACL.createACE(Principal principal, PrivilegeBits privilegeBits, boolean isAllow, Set<Restriction> restrictions)
focal_class.full_signature: abstract ACE createACE(Principal principal, PrivilegeBits privilegeBits, boolean isAllow, Set<Restriction> restrictions)
focal_class.identifier: createACE
focal_class.modifiers: abstract
focal_class.parameters: (Principal principal, PrivilegeBits privilegeBits, boolean isAllow, Set<Restriction> restrictions)
focal_class.return: ACE
focal_class.signature: ACE createACE(Principal principal, PrivilegeBits privilegeBits, boolean isAllow, Set<Restriction> restrictions)
focal_class.class_method_signature: ACL.checkValidPrincipal(Principal principal)
focal_class.full_signature: abstract boolean checkValidPrincipal(Principal principal)
focal_class.identifier: checkValidPrincipal
focal_class.modifiers: abstract
focal_class.parameters: (Principal principal)
focal_class.return: boolean
focal_class.signature: boolean checkValidPrincipal(Principal principal)
focal_class.class_method_signature: ACL.getPrivilegeManager()
focal_class.full_signature: abstract PrivilegeManager getPrivilegeManager()
focal_class.identifier: getPrivilegeManager
focal_class.modifiers: abstract
focal_class.parameters: ()
focal_class.return: PrivilegeManager
focal_class.signature: PrivilegeManager getPrivilegeManager()
focal_class.class_method_signature: ACL.getPrivilegeBits(Privilege[] privileges)
focal_class.full_signature: abstract PrivilegeBits getPrivilegeBits(Privilege[] privileges)
focal_class.identifier: getPrivilegeBits
focal_class.modifiers: abstract
focal_class.parameters: (Privilege[] privileges)
focal_class.return: PrivilegeBits
focal_class.signature: PrivilegeBits getPrivilegeBits(Privilege[] privileges)
focal_class.class_method_signature: ACL.getEntries()
focal_class.full_signature: @NotNull @Override public List<ACE> getEntries()
focal_class.identifier: getEntries
focal_class.modifiers: @NotNull @Override public
focal_class.parameters: ()
focal_class.return: List<ACE>
focal_class.signature: List<ACE> getEntries()
focal_class.class_method_signature: ACL.removeAccessControlEntry(AccessControlEntry ace)
focal_class.full_signature: @Override public void removeAccessControlEntry(AccessControlEntry ace)
focal_class.identifier: removeAccessControlEntry
focal_class.modifiers: @Override public
focal_class.parameters: (AccessControlEntry ace)
focal_class.return: void
focal_class.signature: void removeAccessControlEntry(AccessControlEntry ace)
focal_class.class_method_signature: ACL.addEntry(@NotNull Principal principal, @NotNull Privilege[] privileges,
                              boolean isAllow, @Nullable Map<String, Value> restrictions,
                              @Nullable Map<String, Value[]> mvRestrictions)
focal_class.full_signature: @Override public boolean addEntry(@NotNull Principal principal, @NotNull Privilege[] privileges,
                              boolean isAllow, @Nullable Map<String, Value> restrictions,
                              @Nullable Map<String, Value[]> mvRestrictions)
focal_class.identifier: addEntry
focal_class.modifiers: @Override public
focal_class.parameters: (@NotNull Principal principal, @NotNull Privilege[] privileges,
                              boolean isAllow, @Nullable Map<String, Value> restrictions,
                              @Nullable Map<String, Value[]> mvRestrictions)
focal_class.return: boolean
focal_class.signature: boolean addEntry(@NotNull Principal principal, @NotNull Privilege[] privileges,
                              boolean isAllow, @Nullable Map<String, Value> restrictions,
                              @Nullable Map<String, Value[]> mvRestrictions)
focal_class.class_method_signature: ACL.orderBefore(@NotNull AccessControlEntry srcEntry, @Nullable AccessControlEntry destEntry)
focal_class.full_signature: @Override public void orderBefore(@NotNull AccessControlEntry srcEntry, @Nullable AccessControlEntry destEntry)
focal_class.identifier: orderBefore
focal_class.modifiers: @Override public
focal_class.parameters: (@NotNull AccessControlEntry srcEntry, @Nullable AccessControlEntry destEntry)
focal_class.return: void
focal_class.signature: void orderBefore(@NotNull AccessControlEntry srcEntry, @Nullable AccessControlEntry destEntry)
focal_class.class_method_signature: ACL.toString()
focal_class.full_signature: @Override public String toString()
focal_class.identifier: toString
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String toString()
focal_class.class_method_signature: ACL.checkACE(AccessControlEntry entry)
focal_class.full_signature: private static ACE checkACE(AccessControlEntry entry)
focal_class.identifier: checkACE
focal_class.modifiers: private static
focal_class.parameters: (AccessControlEntry entry)
focal_class.return: ACE
focal_class.signature: ACE checkACE(AccessControlEntry entry)
focal_class.class_method_signature: ACL.internalAddEntry(@NotNull ACE entry)
focal_class.full_signature: private boolean internalAddEntry(@NotNull ACE entry)
focal_class.identifier: internalAddEntry
focal_class.modifiers: private
focal_class.parameters: (@NotNull ACE entry)
focal_class.return: boolean
focal_class.signature: boolean internalAddEntry(@NotNull ACE entry)
focal_class.class_method_signature: ACL.createACE(@NotNull ACE existing, @NotNull PrivilegeBits newPrivilegeBits)
focal_class.full_signature: private ACE createACE(@NotNull ACE existing, @NotNull PrivilegeBits newPrivilegeBits)
focal_class.identifier: createACE
focal_class.modifiers: private
focal_class.parameters: (@NotNull ACE existing, @NotNull PrivilegeBits newPrivilegeBits)
focal_class.return: ACE
focal_class.signature: ACE createACE(@NotNull ACE existing, @NotNull PrivilegeBits newPrivilegeBits)
focal_class.class_method_signature: ACL.validateRestrictions(@NotNull Map<String, Value> restrictions, @NotNull Map<String, Value[]> mvRestrictions)
focal_class.full_signature: @NotNull private Set<Restriction> validateRestrictions(@NotNull Map<String, Value> restrictions, @NotNull Map<String, Value[]> mvRestrictions)
focal_class.identifier: validateRestrictions
focal_class.modifiers: @NotNull private
focal_class.parameters: (@NotNull Map<String, Value> restrictions, @NotNull Map<String, Value[]> mvRestrictions)
focal_class.return: Set<Restriction>
focal_class.signature: Set<Restriction> validateRestrictions(@NotNull Map<String, Value> restrictions, @NotNull Map<String, Value[]> mvRestrictions)
focal_class.superclass: extends AbstractAccessControlList
focal_method.body: @Override
      public boolean addEntry(@NotNull Principal principal, @NotNull Privilege[] privileges,
                              boolean isAllow, @Nullable Map<String, Value> restrictions,
                              @Nullable Map<String, Value[]> mvRestrictions) throws RepositoryException {
          if (privileges == null || privileges.length == 0) {
              throw new AccessControlException("Privileges may not be null nor an empty array");
          }
          for (Privilege p : privileges) {
              Privilege pv = getPrivilegeManager().getPrivilege(p.getName());
              if (pv.isAbstract()) {
                  throw new AccessControlException("Privilege " + p + " is abstract.");
              }
          }
  
          if (!checkValidPrincipal(principal)) {
              return false;
          }
  
          Set<Restriction> rs = validateRestrictions((restrictions == null) ? Collections.emptyMap() : restrictions, (mvRestrictions == null) ? Collections.emptyMap() : mvRestrictions);
  
          ACE entry = createACE(principal, getPrivilegeBits(privileges), isAllow, rs);
          if (entries.contains(entry)) {
              log.debug("Entry is already contained in policy -> no modification.");
              return false;
          } else {
              return internalAddEntry(entry);
          }
      }
focal_method.class_method_signature: ACL.addEntry(@NotNull Principal principal, @NotNull Privilege[] privileges,
                              boolean isAllow, @Nullable Map<String, Value> restrictions,
                              @Nullable Map<String, Value[]> mvRestrictions)
focal_method.full_signature: @Override public boolean addEntry(@NotNull Principal principal, @NotNull Privilege[] privileges,
                              boolean isAllow, @Nullable Map<String, Value> restrictions,
                              @Nullable Map<String, Value[]> mvRestrictions)
focal_method.identifier: addEntry
focal_method.invocations: getPrivilege getPrivilegeManager getName isAbstract checkValidPrincipal validateRestrictions emptyMap emptyMap createACE getPrivilegeBits contains debug internalAddEntry
focal_method.modifiers: @Override public
focal_method.parameters: (@NotNull Principal principal, @NotNull Privilege[] privileges,
                              boolean isAllow, @Nullable Map<String, Value> restrictions,
                              @Nullable Map<String, Value[]> mvRestrictions)
focal_method.return: boolean
focal_method.signature: boolean addEntry(@NotNull Principal principal, @NotNull Privilege[] privileges,
                              boolean isAllow, @Nullable Map<String, Value> restrictions,
                              @Nullable Map<String, Value[]> mvRestrictions)