CakePHP ACL enhancement

This snippet is a pair of diff files to be applied to a CakePHP installation. It adds a checkMany($aros, $acos) method to the ACL class (only for database ACLs, not ini files). It can query multiple aros or acos more efficiently than multiple calls to $Acl->check() and return all keys found (ie. _create, _update...). It will also deal with single aros/acos, though if there is only one of each, $Acl->check() is faster.

Installation:
Merge diff_acl.txt with cake/libs/controller/components/acl.php
Merge diff_db_acl.txt with cake/libs/controller/components/dbacl/db_acl.php

Usage:

    $perms = $Acl->checkMany(array('User.1', 'Guest'), array('Posts', 'Comments'));


Result:

Array
(
  [User.1] => Array
  (
    [Posts] => Array
    (
    [_create] => 1
    [_read] => 1
    [_update] => 1
    [_delete] => 1
    )
 [Comments] => Array
    (
    [_create] => 1
    [_read] => 1
    [_update] => 1
    [_delete] => 1
    )
  )
  [Guest] => Array
  (
    [Posts] => Array
    (
    [_create] => 0
    [_read] => 1
    [_update] => 0
    [_delete] => 0
    )
 [Comments] => Array
    (
    [_create] => 1
    [_read] => 1
    [_update] => 0
    [_delete] => 0
    )
  )
)

Note that in the sample output above, I have substituted 1/0 for true/false for readability.

Download

Click here to download