2011年1月21日星期五

Re: [fw-mvc] Re: ACL stuck in a loop

Alright, got it figured out! I thought that resetting the controller name
and action name in the request object, and then setting isDispatched(false)
caused the dispatcher to dispatch the request to the new controller and
action. But such is not the case, at least not in the way I have implemented
it above.

What is the "proper" ZF way to go about handling a case where the user does
not have access to the resource? I solved the problem using the Redirector
action helper. Would this be using the redirector in line with it's intent,
or is there another way using the methods exposed to the Controller Plugin
itself?

--regards,
nathan


On Fri, Jan 21, 2011 at 9:43 AM, Nathan Garlington <garlinto@gmail.com>wrote:

> Thanks for the quick replies! Kevin, I would love to run Zend Server but
> I'm running a this code on a production server, and don't have a test
> machine atm. :(
>
> tendor wrote:
> >Try this
> >
> >ACL Class:
> > $this->add(new Zend_Acl_Resource('default'))
> > ->add(new Zend_Acl_Resource('default:index'), 'default')
> > ->add(new Zend_Acl_Resource('default:error'), 'default')
> > ->add(new Zend_Acl_Resource('default:user'), 'default');
> >
>
> So you think the problem may lie in the way the module is specified? I
> guess I'll give that a try...
>
> --regards,
> nathan
>
>
>
> On Fri, Jan 21, 2011 at 9:27 AM, tendor <marjarosz@gmail.com> wrote:
>
>>
>> Try this
>>
>> ACL Class:
>> $this->add(new Zend_Acl_Resource('default'))
>> ->add(new Zend_Acl_Resource('default:index'), 'default')
>> ->add(new Zend_Acl_Resource('default:error'), 'default')
>> ->add(new Zend_Acl_Resource('default:user'), 'default');
>>
>> $this->allow('guest', 'default:error');
>> $this->allow('guest', 'default:index', array('some action', '
>> some
>> action'));
>> $this->allow('guest', 'default:user');
>>
>> Using simple:
>>
>> if(!$this->_acl->isAllowed(Zend_Registry::get('role'),
>> $module.':'.$resource, $action)){
>> $request->setControllerName('index')
>> ->setActionName('login');
>> }
>> --
>> View this message in context:
>> http://zend-framework-community.634137.n4.nabble.com/ACL-stuck-in-a-loop-tp3230017p3230042.html
>> Sent from the Zend MVC mailing list archive at Nabble.com.
>>
>
>

没有评论: