AbstractAccessControlManager implements JackrabbitAccessControlManager, AccessControlConstants { @NotNull @Override public Privilege[] getPrivileges(@Nullable String absPath) throws RepositoryException { return getPrivileges(absPath, getPermissionProvider(), Permissions.NO_PERMISSION); } protected  AbstractAccessControlManager(@NotNull Root root,
                                           @NotNull NamePathMapper namePathMapper,
                                           @NotNull SecurityProvider securityProvider); @NotNull @Override Privilege[] getSupportedPrivileges(@Nullable String absPath); @NotNull @Override Privilege privilegeFromName(@NotNull String privilegeName); @Override boolean hasPrivileges(@Nullable String absPath, @Nullable Privilege[] privileges); @NotNull @Override Privilege[] getPrivileges(@Nullable String absPath); @Override boolean hasPrivileges(@Nullable String absPath, @NotNull Set<Principal> principals, @Nullable Privilege[] privileges); @NotNull @Override Privilege[] getPrivileges(@Nullable String absPath, @NotNull Set<Principal> principals);  }
@Test(expected = PathNotFoundException.class) public void testGetPrivilegesNonExistingNodePath() throws Exception { acMgr.getPrivileges(nonExistingPath); }
@Test(expected = PathNotFoundException.class) public void testGetPrivilegesNonExistingNodePathEmptyPrincipalSet() throws Exception { acMgr.getPrivileges(nonExistingPath, ImmutableSet.<Principal>of()); }
@Test public void testGetPrivilegesInvalidPaths() { for (String path : getInvalidPaths()) { try { acMgr.getPrivileges(path); fail("AccessControlManager#getPrivileges for node that doesn't exist should fail."); } catch (RepositoryException e) { } } for (String path : getInvalidPaths()) { try { acMgr.getPrivileges(path, Collections.singleton(testPrincipal)); fail("AccessControlManager#getPrivileges for node that doesn't exist should fail."); } catch (RepositoryException e) { } } for (String path : getInvalidPaths()) { try { acMgr.getPrivileges(path, ImmutableSet.<Principal>of()); fail("AccessControlManager#getPrivileges for node that doesn't exist should fail."); } catch (RepositoryException e) { } } }
@Test public void testGetPrivileges() throws Exception { assertArrayEquals(allPrivileges, acMgr.getPrivileges(testPath)); }
@Test public void testGetPrivilegesEveronePrincipalSet() throws Exception { assertArrayEquals(new Privilege[0], acMgr.getPrivileges(testPath, getEveryonePrincipalSet())); }
@Test public void testGetPrivilegesEmptyPrincipalSet() throws Exception { assertArrayEquals(new Privilege[0], acMgr.getPrivileges(testPath, ImmutableSet.<Principal>of())); }
@Test public void testGetPrivilegesSessionPrincipalSet() throws Exception { AbstractAccessControlManager mgr = spy(acMgr); Privilege[] privileges = mgr.getPrivileges(testPath, testPrincipals); assertArrayEquals(acMgr.getPrivileges(testPath), privileges); verify(mgr, times(1)).getPrivileges(testPath); }
@Test public void testGetRepoPrivileges() throws Exception { assertArrayEquals(allPrivileges, acMgr.getPrivileges(null)); }
@Test public void testGetRepoPrivilegesEveryonePrincipalSet() throws Exception { assertArrayEquals(new Privilege[0], acMgr.getPrivileges(null, getEveryonePrincipalSet())); }
@Test public void testGetRepoPrivilegesEmptyPrincipalSet() throws Exception { assertArrayEquals(new Privilege[0], acMgr.getPrivileges(null, ImmutableSet.<Principal>of())); }