Continuing in my previous vein of ACL related topics. I’ve got another handy addition to the ACL user’s toolbox. In my previous tutorials on auth and acl I posted a little controller action that helped maintain the ACO side of your ACL. I got pretty good feedback on that snippet, and have taken the time to expand it into a shell.
Introducing the aco_sync shell
The aco_sync shell takes everything that was good about
buildAcl() and adds a bit of flair. aco_sync retains its ability to non-destructively add nodes to the
acos table based on changes made to your application since the last time it ran. This is done simply by running
from your prompt. It also has the ability to remove uneeded controllers and actions from the ACL as well. By running
The shell will not only add all missing Actions and Controllers to your ACL table but also remove all no longer existing nodes. Making ACL management a snap. No longer do you have to manually add ACO records when creating new controllers and actions.
To use the shell simply Download the Aco Sync Shell and place it in either
cake/vendors/shells/. Open a prompt and cd into your cake/console directory. You should now be able to run the aco_sync shell. One warning though, the shell will not work if you don’t already have the ACL table in your database.
I hope you find this useful. Let me know if you have any troubles with it.
Update: You can find the newest version of this file in my github repository