[fw-general] Re: [ZF2] What's the proper way to register global MVC plugins?

2012-02-27 Thread Marco Pivetta
You can still define your Acl service and put it in your Di config with all of its requirements. Then you can inject it into your controller either as hard dependency (constructor parameter) or via setter injection. Marco Pivetta http://twitter.com/Ocramius http://marco-pivetta.com On 27

Re: [fw-general] Re: [ZF2] What's the proper way to register global MVC plugins?

2012-02-27 Thread Matthew Weier O'Phinney
-- cmple roman.vidya...@gmail.com wrote (on Sunday, 26 February 2012, 07:32 PM -0800): But this means that I'll have to add $this-myAcl()-isAllowed() in every controller which makes my code redundant. Is there a way to use it globally(a single class available to all) ? maybe via DI instead of

[fw-general] Re: [ZF2] What's the proper way to register global MVC plugins?

2012-02-27 Thread cmple
Marco Pivetta wrote You can still define your Acl service and put it in your Di config with all of its requirements. Then you can inject it into your controller either as hard dependency (constructor parameter) or via setter injection. Marco Pivetta http://twitter.com/Ocramius

[fw-general] Re: [ZF2] What's the proper way to register global MVC plugins?

2012-02-27 Thread Marco Pivetta
Nope, what I gave you is a service you could inject to check your ACL within the controllers. If you want to restrict acces in your application, then use Matthew's example, which is an event happening at 'dispatch' and which does exactly that, without copy/paste in every example. Marco Pivetta

[fw-general] AW: ACL in module bootstrap with entities

2012-02-27 Thread tridem
I finally got it working thanks to this tutorial and the closed issue at the end: public function editAction() { . $acl = Zend_Registry::get('acl'); $acl-addResource(new Zend_Acl_Resource('address-' . $address-getId(), $address));

[fw-general] Re: [ZF2] What's the proper way to register global MVC plugins?

2012-02-27 Thread cmple
weierophinney wrote -- cmple lt;roman.vidyayev@gt; wrote (on Sunday, 26 February 2012, 07:32 PM -0800): But this means that I'll have to add $this-myAcl()-isAllowed() in every controller which makes my code redundant. Is there a way to use it globally(a single class available to all) ?

Re: [fw-general] Re: [ZF2] What's the proper way to register global MVC plugins?

2012-02-27 Thread Matthew Weier O'Phinney
-- cmple roman.vidya...@gmail.com wrote (on Monday, 27 February 2012, 08:17 AM -0800): weierophinney wrote -- cmple lt;roman.vidyayev@gt; wrote (on Sunday, 26 February 2012, 07:32 PM -0800): But this means that I'll have to add $this-myAcl()-isAllowed() in every controller which makes my

[fw-general] Re: [ZF2] What's the proper way to register global MVC plugins?

2012-02-27 Thread cmple
weierophinney wrote -- cmple lt;roman.vidyayev@gt; wrote (on Monday, 27 February 2012, 08:17 AM -0800): weierophinney wrote -- cmple lt;roman.vidyayev@gt; wrote (on Sunday, 26 February 2012, 07:32 PM -0800): But this means that I'll have to add $this-myAcl()-isAllowed() in every

Re: [fw-general] Re: [ZF2] What's the proper way to register global MVC plugins?

2012-02-27 Thread Matthew Weier O'Phinney
-- cmple roman.vidya...@gmail.com wrote (on Monday, 27 February 2012, 12:13 PM -0800): weierophinney wrote -- cmple lt;roman.vidyayev@gt; wrote (on Monday, 27 February 2012, 08:17 AM -0800): weierophinney wrote -- cmple lt;roman.vidyayev@gt; wrote (on Sunday, 26 February 2012,

[fw-general] Re: [ZF2] What's the proper way to register global MVC plugins?

2012-02-27 Thread cmple
weierophinney wrote Simply alter the RouteMatch -- since you're doing this as a high-priority dispatch listener, the controller hasn't yet been retrieved from the locator. This means you can do something like this: $matches-setParam('controller', 'Alternate\Controller\Classname');