23. Acl Example – Querying Acl if ($acl->isAllowed(array('reporter'), 'create articles')) { echo PHP_EOL . " Reporter is allowed to create articles"; } if ($acl->isAllowed(array('reporter'), 'edit articles')) { echo PHP_EOL . " Reporter is allowed to edit articles"; } else { echo PHP_EOL . " Reporter is NOT allowed to edit articles"; } Reporter is allowed to create articles Reporter is NOT allowed to edit articles
28. Acl Assertions – Creating The Assertion Object class ownArticleAssertion implements Bare_Acl_AssertInterface { public function assert(Bare_Acl $acl) { //Write code here to test if the user has access to edit this article return true; } }
29. Acl Assertions – Querying The Acl $assertion = new ownArticleAssertion; if ($acl->isAllowed('reporter', null, $assertion)) { echo PHP_EOL . "Reporter has access to edit the article"; } else { echo PHP_EOL . "Reporter does NOT have access to edit the article"; }
33. Thank You This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 2.5 India License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/2.5/in/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.