cakephp/cakephp — pull request #3156 by sam-at-github (2014-03-29 03:09:27+00:00)
Title: Make `cake acl delete <acl-object>` delete all matching records.

You can create multi records in acos or aros table that are logically the same. Calling `cake create (aco|aro) "" ` multiple times will do this, and there is no default restriction on the aros acos table (although you can and probably should place unique constraints on them..). Anyway you can easily end up with multiple ACL nodes that are logically the same in default setup. It makes more sense for `cake acl delete` to delete them all rather than one arbitrary one.

Use case that drove me to want to change this was a deployment script that did `cake acl create "" admin`. Somehow 2 aro node for admin where in there. With this change I can do `cake acl delete "admin"; cake acl create "" admin` and be sure there is only one admin entry for example. You could also try and force uniqueness on `create` but this is still useful for edge case of deleting nodes that may have got in another way - very edge but its still the right behavior.

On reflection I will apply unique constraints but this change may be more useful to others in general.