views:

57

answers:

0

Hi all,

I got an issue setting up Zend_Acl, I got it pretty well setup and running but I realised that in some forms where I'm using zend_dojo, dojo doesn't actualy gets loaded.

Without going to I have setup my access list, as soon as I call the line isAllowed with the name of the resource taken from the request object, dojo is not loaded (I think)

This is the code that breaks dojo:

class MyPluginAcl extends Zend_Controller_Plugin_Abstract {


public function __construct(Zend_Acl $acl) {
    $this->_acl = $acl;
}

public function preDispatch(Zend_Controller_Request_Abstract $request) {
    .....

    $role = "guest"

    $resource = $request->getControllerName();
    var_dump($resource) //Returns string(10)'myresource'
    $action = $request->getActionName();
    if (!$this->_acl->isAllowed($role, $resource,$action)){
       //Code to redirect somewhere 
    }
......
}

The thing that doesn't make sense are the following:

  1. If I do a var_dump($resource) I get a string(10)'myresource', still doesn't work
  2. If I set the $resource to be $resource = new Zend_Acl_Resource($request->getControllerName()); still doesn't work , but
  3. If I set $resource to have a string value, this whole thing works (eg. $resources = "myresource; it works.

Any ideas ...

Thanks