ACL_SID table that is used in Spring security ACL contains name of the user as one of the columns. I am wondering about the best way to modify this value. This is necessary for example when a user name corresponding to an already existing user is changed. It doesn’t look like JdbcMutableAclService supports this functionality. Any help is appreciated.
Thanks,
Raghu
You can extend
JdbcMutableAclServiceclass and add new method that is needed.In your constructor you can create instance of
JdbcTemplate:Now you can use that
JdbcTemplatein your new method to update SID’s username.Remember about unique constraint
JdbcTemplatecan throwDataAccessExceptionin case of failure. For instanceDataIntegrityViolationExceptionis thrown when SID with that name already exists in your database.Also remember about transactions.
As you can see Spring Security is using
AclCacheto perform more efficiently. You’d better evict everything from that cache on every username update. You can usevoid clearCache();method for that.AclCacheis a private member of your superclass so you need to remember that instance inside your class (look at suggested constructor’s body).