Using the Recite Permissions Exception

When an Application_User_Permissions_Exception exception is thrown as a result of a failed permissions check, it is possible to retrieve a list of the failed permissions

Warning

As noted previously, if an "AND" permissions query fails then only the first failed permission will be available.

To retrieve a list of the failed permissions, call the getPerms() method on the exception object. An array of the failed permissions will be returned. Each element in the array will either be the string name of the permission or an instance of Application_User_Permissions_QueryItem.

Example 7.6. Retrieving the Failed Permissions

<?php
    try {
        Application_User_Permissions_Query_Item::BuildAndAssert('some:permission');
    }
    catch (Application_User_Permissions_Exception $ex) {
        foreach ($ex->getPerms() as $perm) {
            echo sprintf("Failed: %s\n", $perm);
        }
    }
?>