I’d a recent need to do some DFC programming related to permission set. It makes sense to write an ACL helper class for reusability.
Common useful methods are: isACLExist, getACL, createACL and updateACL
The method getACL returns an IDfACL object if it exists. If it doesn’t, NULL is returned.
The isACLExist method calls the getACL method and do a NULL check. If it is NULL, the ACL doesn’t exist, and vice-versa.
The createACL method will create a new persistent object of type “dm_acl”. To grant accessor to the permission set, the IDfACL.grant method is used. After creation, the IDfACL.save method is invoked to save the object.
The updateACL method will check if an ACL exists. If it does, it will do the necessary updates and lastly saves it.