views:

58

answers:

0

I have a schedule controller with four actions:

class ScheduleController extends Zend_Controller_Action {

    public function indexAction(){ ... }

    public function viewAction(){ ... }

    public function addAction(){ ... }

    public function deleteAction(){ ... }

}

So I've set up Zend_Navigation with an array like so:

array(

    ...other links here...

    array(
        'controller'=> 'schedule',
        'action' => 'index',
        'label' => 'Schedule',
        'resource' => 'schedule',
        'privilege' => 'index',
        'privilege' => 'view',      
        'privilege' => 'add',
        'privilege' => 'edit',
    )
);

And I've also created two groups in the ACL: users & admins. I want to set it up so that users can access 'index' and 'view', while admins can access everything. So I started with this:

class My_AccessControlList extends Zend_Acl {
    $this->addRole(new Zend_Acl_Role('user'));
    $this->addRole(new Zend_Acl_Role('admin'), 'user');
    ...
    $this->addResource(new Zend_Acl_Resource('schedule'));
    $this->deny();
    ...

Now, it seems that unless I add this line:

    $this->allow('user', 'schedule');

the link will not show up in the navigation. Then if I add this:

    $this->deny('user', 'schedule', 'add');

users are blocked from the 'add' action, so far so good. But if I then add:

    $this->deny('user', 'schedule', 'edit');
    --or change it to this--
    $this->deny('user', 'schedule', array('add', 'edit'));

the users are blocked appropriately but the link disappears from the Navigation object. Does anyone know what I'm doing wrong? Thanks.