1

how should i implement Zend_Acl_Resources? do i have something like:

$acl->isAllowed()

in controller actions? i somehow think there maybe a better way ... but cant think of it.

iceangel89
  • 6,113
  • 8
  • 40
  • 55

1 Answers1

1

You can set this in preDispatch in plugin or in preDispatch of Controller base class. There you have your request and you can check sth like this:

if($acl->isAllowed('resource'.$request->getControllerName().$request->getActionName())){
    return;
} else {
   //redirect to 403
} 

You can also extend resourceControllerAction from resourceController to ensure the rights are always inherited. And that way you can simplify the ACL rules generation...

Tomáš Fejfar
  • 11,129
  • 8
  • 54
  • 82
  • oh yes something like that will be more "dynamic". ... except maybe for some controller actions, i may need to include exceptions. eg. show some parts of a page but not others. – iceangel89 Sep 23 '09 at 02:23
  • Other parts should be added via view helpers and they can be easily connected with ACL and return html block od '' if not allowed. – Tomáš Fejfar Sep 23 '09 at 09:20