Search code examples
ajaxzend-frameworkzend-acl

Zend_Acl For Specific Parts Of The Page


I know how to use Zend_Acl to allow certain resources to certain usergroups but how do i use it to allow only specific parts of the page to be shown? For example

I have a button to delete a post via AJAX on the page but i only want to show the button to Admins only. I can use Zend_Acl to block access to the controller post/delete but i can't use it to block the button from showing.


Solution

  • // in controller
    $this->view->allow_delete_post = $acl->isAllowed($role, 'delete_post');
    

    .

    // in template
    <? if ($this->allow_delete_post): ?>[button html]<? endif; ?>
    

    Would that not do it?