0
我怎樣才能刪除用戶訪問在春季安全acl使用mutableAclService。 是這個代碼是確定如何在Spring security acl中爲某些Sid刪除AccessControlEntry(acl_entry)?
private void deleteEntry(Long id){
ObjectIdentity objectIdentity = new ObjectIdentityImpl(OrganizationStructure.class, id);
Sid user = new PrincipalSid("admin");
Permission p1 = BasePermission.READ;
try {
MutableAcl acl = (MutableAcl) mutableAclService.readAclById(objectIdentity);
acl.getEntries().forEach(c->{
System.out.println(c.toString());
if(c.getSid().equals(user))
acl.getEntries().remove(c);
});
mutableAclService.updateAcl(acl);
} catch (NotFoundException nfe) {
}
}