Description
the following test will fail with the current implementation of the permission store:
@Test public void testJcrAllWithCustomPrivileges() throws Exception { Node testNode = session.getRootNode().addNode("test"); String testPath = testNode.getPath(); AccessControlUtils.grantAllToEveryone(session, testPath); session.save(); JackrabbitAccessControlManager acMgr = (JackrabbitAccessControlManager) session.getAccessControlManager(); Privilege[] allPrivileges = AccessControlUtils.privilegesFromNames(session, Privilege.JCR_ALL); Set<Principal> principalSet = ImmutableSet.<Principal>of(EveryonePrincipal.getInstance()); assertTrue(acMgr.hasPrivileges(testPath, principalSet, allPrivileges)); org.junit.Assert.assertArrayEquals(allPrivileges, acMgr.getPrivileges(testPath, principalSet)); privilegeManager.registerPrivilege("customPriv", false, null); assertTrue(acMgr.hasPrivileges(testPath, principalSet, allPrivileges)); org.junit.Assert.assertArrayEquals(allPrivileges, acMgr.getPrivileges(testPath, principalSet)); }
the issue is caused by the current implementation of the PermissionStore and the PermissionStoreEditor, which do not reflect the dynamic nature of jcr:all upon reading/writing entries from the permission store.