SEC-530: Refactor ACL module so ACE manipulation is index-based as
opposed to AccessControlEntry.getId() based.
This commit is contained in:
@@ -66,7 +66,7 @@ public class ContactManagerBackend extends ApplicationObjectSupport implements C
|
||||
acl = mutableAclService.createAcl(oid);
|
||||
}
|
||||
|
||||
acl.insertAce(null, permission, recipient, true);
|
||||
acl.insertAce(acl.getEntries().length, permission, recipient, true);
|
||||
mutableAclService.updateAcl(acl);
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
@@ -113,7 +113,7 @@ public class ContactManagerBackend extends ApplicationObjectSupport implements C
|
||||
|
||||
for (int i = 0; i < entries.length; i++) {
|
||||
if (entries[i].getSid().equals(recipient) && entries[i].getPermission().equals(permission)) {
|
||||
acl.deleteAce(entries[i].getId());
|
||||
acl.deleteAce(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -243,7 +243,7 @@ public class DataSourcePopulator implements InitializingBean {
|
||||
private void grantPermissions(int contactNumber, String recipientUsername, Permission permission) {
|
||||
AclImpl acl = (AclImpl) mutableAclService.readAclById(new ObjectIdentityImpl(Contact.class,
|
||||
new Long(contactNumber)));
|
||||
acl.insertAce(null, permission, new PrincipalSid(recipientUsername), true);
|
||||
acl.insertAce(acl.getEntries().length, permission, new PrincipalSid(recipientUsername), true);
|
||||
updateAclInTransaction(acl);
|
||||
}
|
||||
|
||||
|
||||
@@ -76,9 +76,9 @@ public class SecureDataSourcePopulator extends DataSourcePopulator {
|
||||
|
||||
// Now we have an ACL, add another ACE to it
|
||||
if (level == LEVEL_NEGATE_READ) {
|
||||
acl.insertAce(null, permission, sid, false); // not granting
|
||||
acl.insertAce(acl.getEntries().length, permission, sid, false); // not granting
|
||||
} else {
|
||||
acl.insertAce(null, permission, sid, true); // granting
|
||||
acl.insertAce(acl.getEntries().length, permission, sid, true); // granting
|
||||
}
|
||||
|
||||
// Finally, persist the modified ACL
|
||||
|
||||
@@ -54,7 +54,7 @@ public class SecureDocumentDaoImpl extends DocumentDaoImpl implements SecureDocu
|
||||
MutableAcl aclParent = (MutableAcl) mutableAclService.readAclById(parentIdentity);
|
||||
acl.setParent(aclParent);
|
||||
}
|
||||
acl.insertAce(null, BasePermission.ADMINISTRATION, new PrincipalSid(SecurityContextHolder.getContext().getAuthentication()), true);
|
||||
acl.insertAce(acl.getEntries().length, BasePermission.ADMINISTRATION, new PrincipalSid(SecurityContextHolder.getContext().getAuthentication()), true);
|
||||
|
||||
mutableAclService.updateAcl(acl);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user