PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Querying an ACL

We now have a flexible ACL that can be used to determine whether requesters have permission to perform functions throughout the web application. Performing queries is quite simple using the isAllowed() method:

<?php
echo $acl->isAllowed('guest'null'view') ?
     
"allowed" "denied";
// allowed

echo $acl->isAllowed('staff'null'publish') ?
     
"allowed" "denied";
// denied

echo $acl->isAllowed('staff'null'revise') ?
     
"allowed" "denied";
// allowed

echo $acl->isAllowed('editor'null'view') ?
     
"allowed" "denied";
// allowed because of inheritance from guest

echo $acl->isAllowed('editor'null'update') ?
     
"allowed" "denied";
// denied because no allow rule for 'update'

echo $acl->isAllowed('administrator'null'view') ?
     
"allowed" "denied";
// allowed because administrator is allowed all privileges

echo $acl->isAllowed('administrator') ?
     
"allowed" "denied";
// allowed because administrator is allowed all privileges

echo $acl->isAllowed('administrator'null'update') ?
     
"allowed" "denied";
// allowed because administrator is allowed all privileges

Zend Framework