use of org.alfresco.repo.security.permissions.SimpleAccessControlEntry in project alfresco-repository by Alfresco.
the class AclDaoComponentTest method testOldDoesNotCow.
public void testOldDoesNotCow() throws Exception {
SimpleAccessControlListProperties properties = new SimpleAccessControlListProperties();
properties.setAclType(ACLType.OLD);
properties.setVersioned(false);
Long id = aclDaoComponent.createAccessControlList(properties).getId();
AccessControlListProperties aclProps = aclDaoComponent.getAccessControlListProperties(id);
assertEquals(aclProps.getAclType(), ACLType.OLD);
assertEquals(aclProps.getAclVersion(), Long.valueOf(1l));
assertEquals(aclProps.getInherits(), Boolean.TRUE);
testTX.commit();
testTX = transactionService.getUserTransaction();
testTX.begin();
AccessControlListProperties aclPropsBefore = aclDaoComponent.getAccessControlListProperties(id);
assertEquals(aclPropsBefore.getAclType(), ACLType.OLD);
assertEquals(aclPropsBefore.getAclVersion(), Long.valueOf(1l));
assertEquals(aclPropsBefore.getInherits(), Boolean.TRUE);
SimpleAccessControlEntry ace1 = new SimpleAccessControlEntry();
ace1.setAccessStatus(AccessStatus.ALLOWED);
ace1.setAceType(ACEType.ALL);
ace1.setAuthority("andy");
ace1.setPermission(new SimplePermissionReference(QName.createQName("uri", "local"), "Read"));
ace1.setPosition(null);
List<AclChange> changes = aclDaoComponent.setAccessControlEntry(id, ace1);
assertEquals(changes.size(), 1);
assertEquals(changes.get(0).getBefore(), id);
assertTrue(changes.get(0).getBefore().equals(changes.get(0).getAfter()));
aclPropsBefore = aclDaoComponent.getAccessControlListProperties(changes.get(0).getBefore());
assertEquals(aclPropsBefore.getAclType(), ACLType.OLD);
assertEquals(aclPropsBefore.getAclVersion(), Long.valueOf(1l));
assertEquals(aclPropsBefore.getInherits(), Boolean.TRUE);
assertEquals(aclPropsBefore.isLatest(), Boolean.TRUE);
assertEquals(aclPropsBefore.isVersioned(), Boolean.FALSE);
assertEquals(aclDaoComponent.getAccessControlList(changes.get(0).getBefore()).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(changes.get(0).getBefore()).getEntries(), ace1, 0));
}
use of org.alfresco.repo.security.permissions.SimpleAccessControlEntry in project alfresco-repository by Alfresco.
the class AclDaoComponentTest method testSimpleCowHerd1.
public void testSimpleCowHerd1() throws Exception {
SimpleAccessControlListProperties properties = new SimpleAccessControlListProperties();
properties.setAclType(ACLType.DEFINING);
properties.setVersioned(true);
Long i_1 = aclDaoComponent.createAccessControlList(properties).getId();
Long s_1 = aclDaoComponent.getInheritedAccessControlList(i_1);
Long i_1_2 = aclDaoComponent.createAccessControlList(properties).getId();
Long s_1_2 = aclDaoComponent.getInheritedAccessControlList(i_1_2);
aclDaoComponent.mergeInheritedAccessControlList(s_1, i_1_2);
Long i_1_3 = aclDaoComponent.createAccessControlList(properties).getId();
Long s_1_3 = aclDaoComponent.getInheritedAccessControlList(i_1_3);
aclDaoComponent.mergeInheritedAccessControlList(s_1, i_1_3);
Long i_1_2_4 = aclDaoComponent.createAccessControlList(properties).getId();
Long s_1_2_4 = aclDaoComponent.getInheritedAccessControlList(i_1_2_4);
aclDaoComponent.mergeInheritedAccessControlList(s_1_2, i_1_2_4);
Long i_1_2_4_5 = aclDaoComponent.createAccessControlList(properties).getId();
Long s_1_2_4_5 = aclDaoComponent.getInheritedAccessControlList(i_1_2_4_5);
aclDaoComponent.mergeInheritedAccessControlList(s_1_2_4, i_1_2_4_5);
Long i_1_3_6 = aclDaoComponent.createAccessControlList(properties).getId();
Long s_1_3_6 = aclDaoComponent.getInheritedAccessControlList(i_1_3_6);
aclDaoComponent.mergeInheritedAccessControlList(s_1_3, i_1_3_6);
Long i_1_3_6_7 = aclDaoComponent.createAccessControlList(properties).getId();
Long s_1_3_6_7 = aclDaoComponent.getInheritedAccessControlList(i_1_3_6_7);
aclDaoComponent.mergeInheritedAccessControlList(s_1_3_6, i_1_3_6_7);
testTX.commit();
testTX = transactionService.getUserTransaction();
testTX.begin();
SimpleAccessControlEntry ace1 = new SimpleAccessControlEntry();
ace1.setAccessStatus(AccessStatus.ALLOWED);
ace1.setAceType(ACEType.ALL);
ace1.setAuthority("andy");
ace1.setPermission(new SimplePermissionReference(QName.createQName("uri", "local"), "Read"));
ace1.setPosition(null);
List<AclChange> changes = aclDaoComponent.setAccessControlEntry(i_1, ace1);
// All should have changed
Set<Long> changed = new HashSet<Long>(changes.size());
for (AclChange change : changes) {
changed.add(change.getBefore());
assertFalse(change.getBefore().equals(change.getAfter()));
}
assertTrue(changed.contains(i_1));
assertTrue(changed.contains(s_1));
assertTrue(changed.contains(i_1_2));
assertTrue(changed.contains(s_1_2));
assertTrue(changed.contains(i_1_3));
assertTrue(changed.contains(s_1_3));
assertTrue(changed.contains(i_1_2_4));
assertTrue(changed.contains(s_1_2_4));
assertTrue(changed.contains(i_1_2_4_5));
assertTrue(changed.contains(s_1_2_4_5));
assertTrue(changed.contains(i_1_3_6));
assertTrue(changed.contains(s_1_3_6));
assertTrue(changed.contains(i_1_3_6_7));
assertTrue(changed.contains(s_1_3_6_7));
}
use of org.alfresco.repo.security.permissions.SimpleAccessControlEntry in project alfresco-repository by Alfresco.
the class AclDaoComponentTest method testInheritanceChainDefShared.
public void testInheritanceChainDefShared() {
SimpleAccessControlListProperties properties = new SimpleAccessControlListProperties();
properties.setAclType(ACLType.DEFINING);
properties.setVersioned(true);
Long def1 = aclDaoComponent.createAccessControlList(properties).getId();
Long shared1 = aclDaoComponent.getInheritedAccessControlList(def1);
Long def2 = aclDaoComponent.createAccessControlList(properties).getId();
aclDaoComponent.mergeInheritedAccessControlList(shared1, def2);
Long shared2 = aclDaoComponent.getInheritedAccessControlList(def2);
Long def3 = aclDaoComponent.createAccessControlList(properties).getId();
aclDaoComponent.mergeInheritedAccessControlList(shared2, def3);
Long shared3 = aclDaoComponent.getInheritedAccessControlList(def3);
assertEquals(aclDaoComponent.getAccessControlList(def1).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(shared1).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(def2).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(shared1).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(def3).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(shared1).getEntries().size(), 0);
SimpleAccessControlEntry ace1 = new SimpleAccessControlEntry();
ace1.setAccessStatus(AccessStatus.ALLOWED);
ace1.setAceType(ACEType.ALL);
ace1.setAuthority("andy");
ace1.setPermission(new SimplePermissionReference(QName.createQName("uri", "local"), "Write"));
ace1.setPosition(null);
aclDaoComponent.setAccessControlEntry(def1, ace1);
assertEquals(aclDaoComponent.getAccessControlList(def1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def1).getEntries(), ace1, 0));
assertEquals(aclDaoComponent.getAccessControlList(shared1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared1).getEntries(), ace1, 1));
assertEquals(aclDaoComponent.getAccessControlList(def2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def2).getEntries(), ace1, 2));
assertEquals(aclDaoComponent.getAccessControlList(shared2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared2).getEntries(), ace1, 3));
assertEquals(aclDaoComponent.getAccessControlList(def3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def3).getEntries(), ace1, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared3).getEntries(), ace1, 5));
Long def4 = aclDaoComponent.createAccessControlList(properties).getId();
aclDaoComponent.mergeInheritedAccessControlList(shared3, def4);
Long shared4 = aclDaoComponent.getInheritedAccessControlList(def4);
Long def5 = aclDaoComponent.createAccessControlList(properties).getId();
aclDaoComponent.mergeInheritedAccessControlList(shared4, def5);
Long shared5 = aclDaoComponent.getInheritedAccessControlList(def5);
Long def6_1 = aclDaoComponent.createAccessControlList(properties).getId();
aclDaoComponent.mergeInheritedAccessControlList(shared5, def6_1);
Long shared6_1 = aclDaoComponent.getInheritedAccessControlList(def6_1);
Long def6_2 = aclDaoComponent.createAccessControlList(properties).getId();
aclDaoComponent.mergeInheritedAccessControlList(shared5, def6_2);
Long shared6_2 = aclDaoComponent.getInheritedAccessControlList(def6_2);
Long def6_3 = aclDaoComponent.createAccessControlList(properties).getId();
aclDaoComponent.mergeInheritedAccessControlList(shared5, def6_3);
Long shared6_3 = aclDaoComponent.getInheritedAccessControlList(def6_3);
assertEquals(aclDaoComponent.getAccessControlList(def1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def1).getEntries(), ace1, 0));
assertEquals(aclDaoComponent.getAccessControlList(shared1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared1).getEntries(), ace1, 1));
assertEquals(aclDaoComponent.getAccessControlList(def2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def2).getEntries(), ace1, 2));
assertEquals(aclDaoComponent.getAccessControlList(shared2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared2).getEntries(), ace1, 3));
assertEquals(aclDaoComponent.getAccessControlList(def3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def3).getEntries(), ace1, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared3).getEntries(), ace1, 5));
assertEquals(aclDaoComponent.getAccessControlList(def4).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def4).getEntries(), ace1, 6));
assertEquals(aclDaoComponent.getAccessControlList(shared4).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared4).getEntries(), ace1, 7));
assertEquals(aclDaoComponent.getAccessControlList(def5).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def5).getEntries(), ace1, 8));
assertEquals(aclDaoComponent.getAccessControlList(shared5).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared5).getEntries(), ace1, 9));
assertEquals(aclDaoComponent.getAccessControlList(def6_1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_1).getEntries(), ace1, 10));
assertEquals(aclDaoComponent.getAccessControlList(shared6_1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_1).getEntries(), ace1, 11));
assertEquals(aclDaoComponent.getAccessControlList(def6_2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_2).getEntries(), ace1, 10));
assertEquals(aclDaoComponent.getAccessControlList(shared6_2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_2).getEntries(), ace1, 11));
assertEquals(aclDaoComponent.getAccessControlList(def6_3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_3).getEntries(), ace1, 10));
assertEquals(aclDaoComponent.getAccessControlList(shared6_3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_3).getEntries(), ace1, 11));
SimpleAccessControlEntry ace2 = new SimpleAccessControlEntry();
ace2.setAccessStatus(AccessStatus.ALLOWED);
ace2.setAceType(ACEType.ALL);
ace2.setAuthority("paul");
ace2.setPermission(new SimplePermissionReference(QName.createQName("uri", "local"), "Write"));
ace2.setPosition(null);
aclDaoComponent.setAccessControlEntry(def4, ace2);
assertEquals(aclDaoComponent.getAccessControlList(def1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def1).getEntries(), ace1, 0));
assertEquals(aclDaoComponent.getAccessControlList(shared1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared1).getEntries(), ace1, 1));
assertEquals(aclDaoComponent.getAccessControlList(def2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def2).getEntries(), ace1, 2));
assertEquals(aclDaoComponent.getAccessControlList(shared2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared2).getEntries(), ace1, 3));
assertEquals(aclDaoComponent.getAccessControlList(def3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def3).getEntries(), ace1, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared3).getEntries(), ace1, 5));
assertEquals(aclDaoComponent.getAccessControlList(def4).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def4).getEntries(), ace1, 6));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def4).getEntries(), ace2, 0));
assertEquals(aclDaoComponent.getAccessControlList(shared4).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared4).getEntries(), ace1, 7));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared4).getEntries(), ace2, 1));
assertEquals(aclDaoComponent.getAccessControlList(def5).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def5).getEntries(), ace1, 8));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def5).getEntries(), ace2, 2));
assertEquals(aclDaoComponent.getAccessControlList(shared5).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared5).getEntries(), ace1, 9));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared5).getEntries(), ace2, 3));
assertEquals(aclDaoComponent.getAccessControlList(def6_1).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_1).getEntries(), ace1, 10));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_1).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_1).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_1).getEntries(), ace1, 11));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_1).getEntries(), ace2, 5));
assertEquals(aclDaoComponent.getAccessControlList(def6_2).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_2).getEntries(), ace1, 10));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_2).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_2).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_2).getEntries(), ace1, 11));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_2).getEntries(), ace2, 5));
assertEquals(aclDaoComponent.getAccessControlList(def6_3).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_3).getEntries(), ace1, 10));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_3).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_3).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_3).getEntries(), ace1, 11));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_3).getEntries(), ace2, 5));
aclDaoComponent.disableInheritance(def4, false);
assertEquals(aclDaoComponent.getAccessControlList(def1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def1).getEntries(), ace1, 0));
assertEquals(aclDaoComponent.getAccessControlList(shared1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared1).getEntries(), ace1, 1));
assertEquals(aclDaoComponent.getAccessControlList(def2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def2).getEntries(), ace1, 2));
assertEquals(aclDaoComponent.getAccessControlList(shared2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared2).getEntries(), ace1, 3));
assertEquals(aclDaoComponent.getAccessControlList(def3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def3).getEntries(), ace1, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared3).getEntries(), ace1, 5));
assertEquals(aclDaoComponent.getAccessControlList(def4).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def4).getEntries(), ace2, 0));
assertEquals(aclDaoComponent.getAccessControlList(shared4).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared4).getEntries(), ace2, 1));
assertEquals(aclDaoComponent.getAccessControlList(def5).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def5).getEntries(), ace2, 2));
assertEquals(aclDaoComponent.getAccessControlList(shared5).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared5).getEntries(), ace2, 3));
assertEquals(aclDaoComponent.getAccessControlList(def6_1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_1).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_1).getEntries(), ace2, 5));
assertEquals(aclDaoComponent.getAccessControlList(def6_2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_2).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_2).getEntries(), ace2, 5));
assertEquals(aclDaoComponent.getAccessControlList(def6_3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_3).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_3).getEntries(), ace2, 5));
aclDaoComponent.enableInheritance(def4, shared3);
assertEquals(aclDaoComponent.getAccessControlList(def1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def1).getEntries(), ace1, 0));
assertEquals(aclDaoComponent.getAccessControlList(shared1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared1).getEntries(), ace1, 1));
assertEquals(aclDaoComponent.getAccessControlList(def2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def2).getEntries(), ace1, 2));
assertEquals(aclDaoComponent.getAccessControlList(shared2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared2).getEntries(), ace1, 3));
assertEquals(aclDaoComponent.getAccessControlList(def3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def3).getEntries(), ace1, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared3).getEntries(), ace1, 5));
assertEquals(aclDaoComponent.getAccessControlList(def4).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def4).getEntries(), ace1, 6));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def4).getEntries(), ace2, 0));
assertEquals(aclDaoComponent.getAccessControlList(shared4).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared4).getEntries(), ace1, 7));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared4).getEntries(), ace2, 1));
assertEquals(aclDaoComponent.getAccessControlList(def5).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def5).getEntries(), ace1, 8));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def5).getEntries(), ace2, 2));
assertEquals(aclDaoComponent.getAccessControlList(shared5).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared5).getEntries(), ace1, 9));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared5).getEntries(), ace2, 3));
assertEquals(aclDaoComponent.getAccessControlList(def6_1).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_1).getEntries(), ace1, 10));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_1).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_1).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_1).getEntries(), ace1, 11));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_1).getEntries(), ace2, 5));
assertEquals(aclDaoComponent.getAccessControlList(def6_2).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_2).getEntries(), ace1, 10));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_2).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_2).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_2).getEntries(), ace1, 11));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_2).getEntries(), ace2, 5));
assertEquals(aclDaoComponent.getAccessControlList(def6_3).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_3).getEntries(), ace1, 10));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_3).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_3).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_3).getEntries(), ace1, 11));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_3).getEntries(), ace2, 5));
aclDaoComponent.enableInheritance(def4, shared2);
assertEquals(aclDaoComponent.getAccessControlList(def1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def1).getEntries(), ace1, 0));
assertEquals(aclDaoComponent.getAccessControlList(shared1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared1).getEntries(), ace1, 1));
assertEquals(aclDaoComponent.getAccessControlList(def2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def2).getEntries(), ace1, 2));
assertEquals(aclDaoComponent.getAccessControlList(shared2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared2).getEntries(), ace1, 3));
assertEquals(aclDaoComponent.getAccessControlList(def3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def3).getEntries(), ace1, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared3).getEntries(), ace1, 5));
assertEquals(aclDaoComponent.getAccessControlList(def4).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def4).getEntries(), ace1, 4));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def4).getEntries(), ace2, 0));
assertEquals(aclDaoComponent.getAccessControlList(shared4).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared4).getEntries(), ace1, 5));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared4).getEntries(), ace2, 1));
assertEquals(aclDaoComponent.getAccessControlList(def5).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def5).getEntries(), ace1, 6));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def5).getEntries(), ace2, 2));
assertEquals(aclDaoComponent.getAccessControlList(shared5).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared5).getEntries(), ace1, 7));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared5).getEntries(), ace2, 3));
assertEquals(aclDaoComponent.getAccessControlList(def6_1).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_1).getEntries(), ace1, 8));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_1).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_1).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_1).getEntries(), ace1, 9));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_1).getEntries(), ace2, 5));
assertEquals(aclDaoComponent.getAccessControlList(def6_2).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_2).getEntries(), ace1, 8));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_2).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_2).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_2).getEntries(), ace1, 9));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_2).getEntries(), ace2, 5));
assertEquals(aclDaoComponent.getAccessControlList(def6_3).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_3).getEntries(), ace1, 8));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_3).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_3).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_3).getEntries(), ace1, 9));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_3).getEntries(), ace2, 5));
aclDaoComponent.disableInheritance(def4, true);
assertEquals(aclDaoComponent.getAccessControlList(def1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def1).getEntries(), ace1, 0));
assertEquals(aclDaoComponent.getAccessControlList(shared1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared1).getEntries(), ace1, 1));
assertEquals(aclDaoComponent.getAccessControlList(def2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def2).getEntries(), ace1, 2));
assertEquals(aclDaoComponent.getAccessControlList(shared2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared2).getEntries(), ace1, 3));
assertEquals(aclDaoComponent.getAccessControlList(def3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def3).getEntries(), ace1, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared3).getEntries(), ace1, 5));
assertEquals(aclDaoComponent.getAccessControlList(def4).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def4).getEntries(), ace1, 0));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def4).getEntries(), ace2, 0));
assertEquals(aclDaoComponent.getAccessControlList(shared4).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared4).getEntries(), ace1, 1));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared4).getEntries(), ace2, 1));
assertEquals(aclDaoComponent.getAccessControlList(def5).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def5).getEntries(), ace1, 2));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def5).getEntries(), ace2, 2));
assertEquals(aclDaoComponent.getAccessControlList(shared5).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared5).getEntries(), ace1, 3));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared5).getEntries(), ace2, 3));
assertEquals(aclDaoComponent.getAccessControlList(def6_1).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_1).getEntries(), ace1, 4));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_1).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_1).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_1).getEntries(), ace1, 5));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_1).getEntries(), ace2, 5));
assertEquals(aclDaoComponent.getAccessControlList(def6_2).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_2).getEntries(), ace1, 4));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_2).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_2).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_2).getEntries(), ace1, 5));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_2).getEntries(), ace2, 5));
assertEquals(aclDaoComponent.getAccessControlList(def6_3).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_3).getEntries(), ace1, 4));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_3).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_3).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_3).getEntries(), ace1, 5));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_3).getEntries(), ace2, 5));
aclDaoComponent.deleteAccessControlEntries(def4, ace1);
assertEquals(aclDaoComponent.getAccessControlList(def1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def1).getEntries(), ace1, 0));
assertEquals(aclDaoComponent.getAccessControlList(shared1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared1).getEntries(), ace1, 1));
assertEquals(aclDaoComponent.getAccessControlList(def2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def2).getEntries(), ace1, 2));
assertEquals(aclDaoComponent.getAccessControlList(shared2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared2).getEntries(), ace1, 3));
assertEquals(aclDaoComponent.getAccessControlList(def3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def3).getEntries(), ace1, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared3).getEntries(), ace1, 5));
assertEquals(aclDaoComponent.getAccessControlList(def4).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def4).getEntries(), ace2, 0));
assertEquals(aclDaoComponent.getAccessControlList(shared4).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared4).getEntries(), ace2, 1));
assertEquals(aclDaoComponent.getAccessControlList(def5).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def5).getEntries(), ace2, 2));
assertEquals(aclDaoComponent.getAccessControlList(shared5).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared5).getEntries(), ace2, 3));
assertEquals(aclDaoComponent.getAccessControlList(def6_1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_1).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_1).getEntries().size(), 1);
;
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_1).getEntries(), ace2, 5));
assertEquals(aclDaoComponent.getAccessControlList(def6_2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_2).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_2).getEntries(), ace2, 5));
assertEquals(aclDaoComponent.getAccessControlList(def6_3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_3).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_3).getEntries(), ace2, 5));
aclDaoComponent.deleteLocalAccessControlEntries(def4);
assertEquals(aclDaoComponent.getAccessControlList(def1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def1).getEntries(), ace1, 0));
assertEquals(aclDaoComponent.getAccessControlList(shared1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared1).getEntries(), ace1, 1));
assertEquals(aclDaoComponent.getAccessControlList(def2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def2).getEntries(), ace1, 2));
assertEquals(aclDaoComponent.getAccessControlList(shared2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared2).getEntries(), ace1, 3));
assertEquals(aclDaoComponent.getAccessControlList(def3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def3).getEntries(), ace1, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared3).getEntries(), ace1, 5));
assertEquals(aclDaoComponent.getAccessControlList(def4).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(shared4).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(def5).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(shared5).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(def6_1).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(shared6_1).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(def6_2).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(shared6_2).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(def6_3).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(shared6_3).getEntries().size(), 0);
aclDaoComponent.enableInheritance(def4, shared3);
aclDaoComponent.setAccessControlEntry(def4, ace2);
assertEquals(aclDaoComponent.getAccessControlList(def1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def1).getEntries(), ace1, 0));
assertEquals(aclDaoComponent.getAccessControlList(shared1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared1).getEntries(), ace1, 1));
assertEquals(aclDaoComponent.getAccessControlList(def2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def2).getEntries(), ace1, 2));
assertEquals(aclDaoComponent.getAccessControlList(shared2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared2).getEntries(), ace1, 3));
assertEquals(aclDaoComponent.getAccessControlList(def3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def3).getEntries(), ace1, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared3).getEntries(), ace1, 5));
assertEquals(aclDaoComponent.getAccessControlList(def4).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def4).getEntries(), ace1, 6));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def4).getEntries(), ace2, 0));
assertEquals(aclDaoComponent.getAccessControlList(shared4).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared4).getEntries(), ace1, 7));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared4).getEntries(), ace2, 1));
assertEquals(aclDaoComponent.getAccessControlList(def5).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def5).getEntries(), ace1, 8));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def5).getEntries(), ace2, 2));
assertEquals(aclDaoComponent.getAccessControlList(shared5).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared5).getEntries(), ace1, 9));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared5).getEntries(), ace2, 3));
assertEquals(aclDaoComponent.getAccessControlList(def6_1).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_1).getEntries(), ace1, 10));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_1).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_1).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_1).getEntries(), ace1, 11));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_1).getEntries(), ace2, 5));
assertEquals(aclDaoComponent.getAccessControlList(def6_2).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_2).getEntries(), ace1, 10));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_2).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_2).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_2).getEntries(), ace1, 11));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_2).getEntries(), ace2, 5));
assertEquals(aclDaoComponent.getAccessControlList(def6_3).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_3).getEntries(), ace1, 10));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_3).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_3).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_3).getEntries(), ace1, 11));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_3).getEntries(), ace2, 5));
aclDaoComponent.deleteLocalAccessControlEntries(def4);
assertEquals(aclDaoComponent.getAccessControlList(def1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def1).getEntries(), ace1, 0));
assertEquals(aclDaoComponent.getAccessControlList(shared1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared1).getEntries(), ace1, 1));
assertEquals(aclDaoComponent.getAccessControlList(def2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def2).getEntries(), ace1, 2));
assertEquals(aclDaoComponent.getAccessControlList(shared2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared2).getEntries(), ace1, 3));
assertEquals(aclDaoComponent.getAccessControlList(def3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def3).getEntries(), ace1, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared3).getEntries(), ace1, 5));
assertEquals(aclDaoComponent.getAccessControlList(def4).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def4).getEntries(), ace1, 6));
assertEquals(aclDaoComponent.getAccessControlList(shared4).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared4).getEntries(), ace1, 7));
assertEquals(aclDaoComponent.getAccessControlList(def5).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def5).getEntries(), ace1, 8));
assertEquals(aclDaoComponent.getAccessControlList(shared5).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared5).getEntries(), ace1, 9));
assertEquals(aclDaoComponent.getAccessControlList(def6_1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_1).getEntries(), ace1, 10));
assertEquals(aclDaoComponent.getAccessControlList(shared6_1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_1).getEntries(), ace1, 11));
assertEquals(aclDaoComponent.getAccessControlList(def6_2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_2).getEntries(), ace1, 10));
assertEquals(aclDaoComponent.getAccessControlList(shared6_2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_2).getEntries(), ace1, 11));
assertEquals(aclDaoComponent.getAccessControlList(def6_3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_3).getEntries(), ace1, 10));
assertEquals(aclDaoComponent.getAccessControlList(shared6_3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_3).getEntries(), ace1, 11));
aclDaoComponent.setAccessControlEntry(def4, ace2);
assertEquals(aclDaoComponent.getAccessControlList(def1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def1).getEntries(), ace1, 0));
assertEquals(aclDaoComponent.getAccessControlList(shared1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared1).getEntries(), ace1, 1));
assertEquals(aclDaoComponent.getAccessControlList(def2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def2).getEntries(), ace1, 2));
assertEquals(aclDaoComponent.getAccessControlList(shared2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared2).getEntries(), ace1, 3));
assertEquals(aclDaoComponent.getAccessControlList(def3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def3).getEntries(), ace1, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared3).getEntries(), ace1, 5));
assertEquals(aclDaoComponent.getAccessControlList(def4).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def4).getEntries(), ace1, 6));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def4).getEntries(), ace2, 0));
assertEquals(aclDaoComponent.getAccessControlList(shared4).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared4).getEntries(), ace1, 7));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared4).getEntries(), ace2, 1));
assertEquals(aclDaoComponent.getAccessControlList(def5).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def5).getEntries(), ace1, 8));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def5).getEntries(), ace2, 2));
assertEquals(aclDaoComponent.getAccessControlList(shared5).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared5).getEntries(), ace1, 9));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared5).getEntries(), ace2, 3));
assertEquals(aclDaoComponent.getAccessControlList(def6_1).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_1).getEntries(), ace1, 10));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_1).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_1).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_1).getEntries(), ace1, 11));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_1).getEntries(), ace2, 5));
assertEquals(aclDaoComponent.getAccessControlList(def6_2).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_2).getEntries(), ace1, 10));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_2).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_2).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_2).getEntries(), ace1, 11));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_2).getEntries(), ace2, 5));
assertEquals(aclDaoComponent.getAccessControlList(def6_3).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_3).getEntries(), ace1, 10));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_3).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_3).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_3).getEntries(), ace1, 11));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_3).getEntries(), ace2, 5));
aclDaoComponent.deleteInheritedAccessControlEntries(def4);
assertEquals(aclDaoComponent.getAccessControlList(def1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def1).getEntries(), ace1, 0));
assertEquals(aclDaoComponent.getAccessControlList(shared1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared1).getEntries(), ace1, 1));
assertEquals(aclDaoComponent.getAccessControlList(def2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def2).getEntries(), ace1, 2));
assertEquals(aclDaoComponent.getAccessControlList(shared2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared2).getEntries(), ace1, 3));
assertEquals(aclDaoComponent.getAccessControlList(def3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def3).getEntries(), ace1, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared3).getEntries(), ace1, 5));
assertEquals(aclDaoComponent.getAccessControlList(def4).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def4).getEntries(), ace2, 0));
assertEquals(aclDaoComponent.getAccessControlList(shared4).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared4).getEntries(), ace2, 1));
assertEquals(aclDaoComponent.getAccessControlList(def5).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def5).getEntries(), ace2, 2));
assertEquals(aclDaoComponent.getAccessControlList(shared5).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared5).getEntries(), ace2, 3));
assertEquals(aclDaoComponent.getAccessControlList(def6_1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_1).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_1).getEntries(), ace2, 5));
assertEquals(aclDaoComponent.getAccessControlList(def6_2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_2).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_2).getEntries(), ace2, 5));
assertEquals(aclDaoComponent.getAccessControlList(def6_3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_3).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_3).getEntries(), ace2, 5));
aclDaoComponent.deleteLocalAccessControlEntries(def4);
assertEquals(aclDaoComponent.getAccessControlList(def1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def1).getEntries(), ace1, 0));
assertEquals(aclDaoComponent.getAccessControlList(shared1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared1).getEntries(), ace1, 1));
assertEquals(aclDaoComponent.getAccessControlList(def2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def2).getEntries(), ace1, 2));
assertEquals(aclDaoComponent.getAccessControlList(shared2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared2).getEntries(), ace1, 3));
assertEquals(aclDaoComponent.getAccessControlList(def3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def3).getEntries(), ace1, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared3).getEntries(), ace1, 5));
assertEquals(aclDaoComponent.getAccessControlList(def4).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(shared4).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(def5).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(shared5).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(def6_1).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(shared6_1).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(def6_2).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(shared6_2).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(def6_3).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(shared6_3).getEntries().size(), 0);
aclDaoComponent.enableInheritance(def4, shared3);
aclDaoComponent.setAccessControlEntry(def4, ace2);
assertEquals(aclDaoComponent.getAccessControlList(def1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def1).getEntries(), ace1, 0));
assertEquals(aclDaoComponent.getAccessControlList(shared1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared1).getEntries(), ace1, 1));
assertEquals(aclDaoComponent.getAccessControlList(def2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def2).getEntries(), ace1, 2));
assertEquals(aclDaoComponent.getAccessControlList(shared2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared2).getEntries(), ace1, 3));
assertEquals(aclDaoComponent.getAccessControlList(def3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def3).getEntries(), ace1, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared3).getEntries(), ace1, 5));
assertEquals(aclDaoComponent.getAccessControlList(def4).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def4).getEntries(), ace1, 6));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def4).getEntries(), ace2, 0));
assertEquals(aclDaoComponent.getAccessControlList(shared4).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared4).getEntries(), ace1, 7));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared4).getEntries(), ace2, 1));
assertEquals(aclDaoComponent.getAccessControlList(def5).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def5).getEntries(), ace1, 8));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def5).getEntries(), ace2, 2));
assertEquals(aclDaoComponent.getAccessControlList(shared5).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared5).getEntries(), ace1, 9));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared5).getEntries(), ace2, 3));
assertEquals(aclDaoComponent.getAccessControlList(def6_1).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_1).getEntries(), ace1, 10));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_1).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_1).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_1).getEntries(), ace1, 11));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_1).getEntries(), ace2, 5));
assertEquals(aclDaoComponent.getAccessControlList(def6_2).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_2).getEntries(), ace1, 10));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_2).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_2).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_2).getEntries(), ace1, 11));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_2).getEntries(), ace2, 5));
assertEquals(aclDaoComponent.getAccessControlList(def6_3).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_3).getEntries(), ace1, 10));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_3).getEntries(), ace2, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared6_3).getEntries().size(), 2);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_3).getEntries(), ace1, 11));
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_3).getEntries(), ace2, 5));
aclDaoComponent.deleteAccessControlList(def4);
assertEquals(aclDaoComponent.getAccessControlList(def1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def1).getEntries(), ace1, 0));
assertEquals(aclDaoComponent.getAccessControlList(shared1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared1).getEntries(), ace1, 1));
assertEquals(aclDaoComponent.getAccessControlList(def2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def2).getEntries(), ace1, 2));
assertEquals(aclDaoComponent.getAccessControlList(shared2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared2).getEntries(), ace1, 3));
assertEquals(aclDaoComponent.getAccessControlList(def3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def3).getEntries(), ace1, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared3).getEntries(), ace1, 5));
assertEquals(aclDaoComponent.getAccessControlList(def5).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def5).getEntries(), ace1, 6));
assertEquals(aclDaoComponent.getAccessControlList(shared5).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared5).getEntries(), ace1, 7));
assertEquals(aclDaoComponent.getAccessControlList(def6_1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_1).getEntries(), ace1, 8));
assertEquals(aclDaoComponent.getAccessControlList(shared6_1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_1).getEntries(), ace1, 9));
assertEquals(aclDaoComponent.getAccessControlList(def6_2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_2).getEntries(), ace1, 8));
assertEquals(aclDaoComponent.getAccessControlList(shared6_2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_2).getEntries(), ace1, 9));
assertEquals(aclDaoComponent.getAccessControlList(def6_3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_3).getEntries(), ace1, 8));
assertEquals(aclDaoComponent.getAccessControlList(shared6_3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_3).getEntries(), ace1, 9));
aclDaoComponent.deleteAccessControlList(def5);
assertEquals(aclDaoComponent.getAccessControlList(def1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def1).getEntries(), ace1, 0));
assertEquals(aclDaoComponent.getAccessControlList(shared1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared1).getEntries(), ace1, 1));
assertEquals(aclDaoComponent.getAccessControlList(def2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def2).getEntries(), ace1, 2));
assertEquals(aclDaoComponent.getAccessControlList(shared2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared2).getEntries(), ace1, 3));
assertEquals(aclDaoComponent.getAccessControlList(def3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def3).getEntries(), ace1, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared3).getEntries(), ace1, 5));
assertEquals(aclDaoComponent.getAccessControlList(def6_1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_1).getEntries(), ace1, 6));
assertEquals(aclDaoComponent.getAccessControlList(shared6_1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_1).getEntries(), ace1, 7));
assertEquals(aclDaoComponent.getAccessControlList(def6_2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_2).getEntries(), ace1, 6));
assertEquals(aclDaoComponent.getAccessControlList(shared6_2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_2).getEntries(), ace1, 7));
assertEquals(aclDaoComponent.getAccessControlList(def6_3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_3).getEntries(), ace1, 6));
assertEquals(aclDaoComponent.getAccessControlList(shared6_3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_3).getEntries(), ace1, 7));
aclDaoComponent.deleteAccessControlList(def6_3);
assertEquals(aclDaoComponent.getAccessControlList(def1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def1).getEntries(), ace1, 0));
assertEquals(aclDaoComponent.getAccessControlList(shared1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared1).getEntries(), ace1, 1));
assertEquals(aclDaoComponent.getAccessControlList(def2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def2).getEntries(), ace1, 2));
assertEquals(aclDaoComponent.getAccessControlList(shared2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared2).getEntries(), ace1, 3));
assertEquals(aclDaoComponent.getAccessControlList(def3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def3).getEntries(), ace1, 4));
assertEquals(aclDaoComponent.getAccessControlList(shared3).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared3).getEntries(), ace1, 5));
assertEquals(aclDaoComponent.getAccessControlList(def6_1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_1).getEntries(), ace1, 6));
assertEquals(aclDaoComponent.getAccessControlList(shared6_1).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_1).getEntries(), ace1, 7));
assertEquals(aclDaoComponent.getAccessControlList(def6_2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(def6_2).getEntries(), ace1, 6));
assertEquals(aclDaoComponent.getAccessControlList(shared6_2).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(shared6_2).getEntries(), ace1, 7));
aclDaoComponent.deleteAccessControlList(def1);
assertEquals(aclDaoComponent.getAccessControlList(def2).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(shared2).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(def3).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(shared3).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(def6_1).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(shared6_1).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(def6_2).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(shared6_2).getEntries().size(), 0);
}
use of org.alfresco.repo.security.permissions.SimpleAccessControlEntry in project alfresco-repository by Alfresco.
the class AclDaoComponentTest method testSimpleCow.
public void testSimpleCow() throws Exception {
SimpleAccessControlListProperties properties = new SimpleAccessControlListProperties();
properties.setAclType(ACLType.DEFINING);
properties.setVersioned(true);
Long id = aclDaoComponent.createAccessControlList(properties).getId();
AccessControlListProperties aclProps = aclDaoComponent.getAccessControlListProperties(id);
assertEquals(aclProps.getAclType(), ACLType.DEFINING);
assertEquals(aclProps.getAclVersion(), Long.valueOf(1l));
assertEquals(aclProps.getInherits(), Boolean.TRUE);
testTX.commit();
testTX = transactionService.getUserTransaction();
testTX.begin();
AccessControlListProperties aclPropsBefore = aclDaoComponent.getAccessControlListProperties(id);
assertEquals(aclPropsBefore.getAclType(), ACLType.DEFINING);
assertEquals(aclPropsBefore.getAclVersion(), Long.valueOf(1l));
assertEquals(aclPropsBefore.getInherits(), Boolean.TRUE);
SimpleAccessControlEntry ace1 = new SimpleAccessControlEntry();
ace1.setAccessStatus(AccessStatus.ALLOWED);
ace1.setAceType(ACEType.ALL);
ace1.setAuthority("andy");
ace1.setPermission(new SimplePermissionReference(QName.createQName("uri", "local"), "Read"));
ace1.setPosition(null);
List<AclChange> changes = aclDaoComponent.setAccessControlEntry(id, ace1);
assertEquals(changes.size(), 1);
assertEquals(changes.get(0).getBefore(), id);
assertFalse(changes.get(0).getBefore().equals(changes.get(0).getAfter()));
aclPropsBefore = aclDaoComponent.getAccessControlListProperties(changes.get(0).getBefore());
assertEquals(aclPropsBefore.getAclType(), ACLType.DEFINING);
assertEquals(aclPropsBefore.getAclVersion(), Long.valueOf(1l));
assertEquals(aclPropsBefore.getInherits(), Boolean.TRUE);
assertEquals(aclPropsBefore.isLatest(), Boolean.FALSE);
assertEquals(aclPropsBefore.isVersioned(), Boolean.TRUE);
AccessControlListProperties aclPropsAfter = aclDaoComponent.getAccessControlListProperties(changes.get(0).getAfter());
assertEquals(aclPropsAfter.getAclType(), aclPropsBefore.getAclType());
assertEquals(aclPropsAfter.getAclVersion(), Long.valueOf(aclPropsBefore.getAclVersion() + 1));
assertEquals(aclPropsAfter.getInherits(), aclPropsBefore.getInherits());
assertEquals(aclPropsAfter.getAclId(), aclPropsBefore.getAclId());
assertEquals(aclPropsAfter.isVersioned(), aclPropsBefore.isVersioned());
assertEquals(aclPropsAfter.isLatest(), Boolean.TRUE);
assertEquals(aclDaoComponent.getAccessControlList(changes.get(0).getBefore()).getEntries().size(), 0);
assertEquals(aclDaoComponent.getAccessControlList(changes.get(0).getAfter()).getEntries().size(), 1);
assertTrue(hasAce(aclDaoComponent.getAccessControlList(changes.get(0).getAfter()).getEntries(), ace1, 0));
}
use of org.alfresco.repo.security.permissions.SimpleAccessControlEntry in project alfresco-repository by Alfresco.
the class AclDAOImpl method getAccessControlList.
/**
* {@inheritDoc}
*/
@Override
public AccessControlList getAccessControlList(Long id) {
// Used the cached properties as our cache key
AccessControlListProperties properties = getAccessControlListProperties(id);
if (properties == null) {
return null;
}
AccessControlList aclCached = aclCache.get((Serializable) properties);
if (aclCached != null) {
return aclCached;
}
SimpleAccessControlList acl = new SimpleAccessControlList();
acl.setProperties(properties);
List<Map<String, Object>> results = aclCrudDAO.getAcesAndAuthoritiesByAcl(id);
List<AccessControlEntry> entries = new ArrayList<AccessControlEntry>(results.size());
for (Map<String, Object> result : results) // for (AclMemberEntity member : members)
{
Boolean aceIsAllowed = (Boolean) result.get("allowed");
Integer aceType = (Integer) result.get("applies");
String authority = (String) result.get("authority");
Long permissionId = (Long) result.get("permissionId");
Integer position = (Integer) result.get("pos");
// Long result_aclmemId = (Long) result.get("aclmemId"); // not used here
SimpleAccessControlEntry sacEntry = new SimpleAccessControlEntry();
sacEntry.setAccessStatus(aceIsAllowed ? AccessStatus.ALLOWED : AccessStatus.DENIED);
sacEntry.setAceType(ACEType.getACETypeFromId(aceType));
sacEntry.setAuthority(authority);
// if (entry.getContext() != null)
// {
// SimpleAccessControlEntryContext context = new SimpleAccessControlEntryContext();
// context.setClassContext(entry.getContext().getClassContext());
// context.setKVPContext(entry.getContext().getKvpContext());
// context.setPropertyContext(entry.getContext().getPropertyContext());
// sacEntry.setContext(context);
// }
Permission perm = aclCrudDAO.getPermission(permissionId);
// Has an ID so must exist
QName permTypeQName = qnameDAO.getQName(perm.getTypeQNameId()).getSecond();
SimplePermissionReference permissionRefernce = SimplePermissionReference.getPermissionReference(permTypeQName, perm.getName());
sacEntry.setPermission(permissionRefernce);
sacEntry.setPosition(position);
entries.add(sacEntry);
}
Collections.sort(entries);
acl.setEntries(entries);
// Cache it for next time
aclCache.put((Serializable) properties, acl);
return acl;
}
Aggregations