private void resetAclRecords(Class<? extends ISecuredObject<?>> objectClass, Long securedId, Sid sid,
sk.seges.acris.security.shared.user_management.domain.Permission[] permissions) {
MutableAcl acl = null;
AclSecuredObjectIdentityData objectIdentity = getParentObjectIdentity(objectClass, securedId);
if (objectIdentity == null) {
throw new SecurityException("Could not update acl entry for aclId: " + securedId + " sid: " + sid
+ " cause acl object identity not found!");
}
try {
acl = (MutableAcl) aclService.readAclById(new ObjectIdentityImpl(objectIdentity.getJavaType(), securedId));
} catch (NotFoundException e) {
throw new SecurityException("Could not update acl entry for aclId: " + securedId + " sid: " + sid
+ " cause acl object identity not found!", e);
}
int authorityMask = 0;
for (sk.seges.acris.security.shared.user_management.domain.Permission authority : permissions) {
authorityMask |= authority.getMask();
}
for (int i = 0; i < acl.getEntries().size(); i++) {
acl.deleteAce(i);
}
acl.insertAce(0, permissionFactory.buildFromMask(authorityMask), sid, true);
acl.setOwner(sid);
aclService.updateAcl(acl);
}