I'm using the Spring Security ACL implementation and am wondering what's the best way of granting a new permission to a role/user (security identity - SID) for existing object identities.
For example, let's say I have the following (I'm mostly omitting the primary keys and some other columns and simply reference by string values for readability):
- ACL_SID:
ROLE_TEST
- ACL_CLASS:
test_class
- ACL_OBJECT_IDENTITY:
- id:
1
- object_id_class:
test_class
- object_id_identity:
someObjectInstanceId
- id:
- ACL_ENTRY:
- acl_object_identity:
1
- sid:
ROLE_TEST
- mask:
CREATE
(this would be an integer in the db)
- acl_object_identity:
Now, I want to grant the permission WRITE
to the role ROLE_TEST
for all future and existing objects of class test_class
. For objects created in the future I will simply check the role for its permissions and grant them. But what about the existing objects?
Does Spring provide anything to easily do this or do I have to write my own custom code to do the following (which wouldn't be so bad but if Spring already provides this, I would rather not do it myself):
- Retrieve all ACL entries with the SID of the role/user I want to grant the new permission to and that reference an object identity which has the appropriate
object_id_class
. - For each result, create a new ACL entry that is identical to the result except for the mask, which would reflect the new permission.