ZF-2289: Multiple Assertions


I think it would be interesting if it was possible to assign more than one assertion in the allow and deny methods (4th parameter). Or maybe a new method to add more assertions...

Of course you can implement a new Zend_Acl_Assert_Interface class calling multiple asserts, but it's boring.



I think that the proper solution is, as you suggested, to implement the assertion method... however you want, including assertion chains. This is actually quite trivial to do, and I don't see a compelling need to bloat the API with this. If you disagree, please feel free to reopen the issue with more feedback. Thank you! :)

OK, thanks.

I was implementing a new class (calling multiple asserts) for each combination of asserts in the application. Now, I realized it can be done by implementing a generic 'MultiAssert' class like this:

class MultiAssert implements Zend_Acl_Assert_Interface {

    protected $_asserts;

    public function __construct(array $asserts) {
        foreach ($asserts as $assert) {
            $this->_asserts[] = new $assert();

    public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $role = null,
                           Zend_Acl_Resource_Interface $resource = null, $privilege = null) {
        $result = TRUE;
        foreach ($this->_asserts as $assert) {
            $result &= $assert->assert($acl, $role, $resource, $privilege);
        return $result ;