Permission checkPermission = new Permission("TestPermission");
assertEquals("Principal has permission from entry", 1, acl.checkPermission(checkPrincipal, checkPermission));
}
public void testNegativePermsissionCancelsPermission() {
Permission permission = new Permission("TestPermission");
Principal principal = new Principal("TestPrincipal");
AclEntry entry = new AclEntry(principal);
entry.addPermission(permission);
acl.addEntry(owner, entry);
AclEntry negativeEntry = new AclEntry(principal);
negativeEntry.addPermission(permission);
negativeEntry.setNegativePermissions();
acl.addEntry(owner, negativeEntry);
Principal checkPrincipal = new Principal("TestPrincipal");
Permission checkPermission = new Permission("TestPermission");
assertEquals("Principal does not have permission because of negative entry", -1, acl.checkPermission(checkPrincipal, checkPermission));
}