Zend_Acl for individual parts of the page

I know how to use Zend_Acl to allow certain resources to specific user groups, but how can I use it to show only certain parts of the page? for instance

I have a button for deleting a message via AJAX on the page, but I want to show the button only to administrators. I can use Zend_Acl to block access to the message / delete the controller, but I cannot use it to block the button from showing.

+3
source share
3 answers
// in controller
$this->view->allow_delete_post = $acl->isAllowed($role, 'delete_post');

.

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

Is this really not so?

+5
source

ACL, script.

ACL , , , ACL , - ...

     if(My_Custom_Acl::getIsAllowed('some_resource', 'delete_post_action'){  

getIsAllowed(), ACL .

,

+1

, . DRY, 200 / , - , $this- > render ('view') $this- > render ('edit' ) . script . , , , . , , , ACL ...

+1

Source: https://habr.com/ru/post/1763393/


All Articles