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 February 2012 04:32, cmple [via Zend Framework Community] <
ml-node+s634137n4423529...@n4.nabble.com> wrote:

>  Marco Pivetta wrote
> As you can see from the plugin I've linked, plugins are just registered in
> the pluginLoader.
> I would just create a new plugin class extending the AbstractPlugin as
> ZfcUserAuthentication does and then map it to "myAcl" for examle.
> Then you should be able to use it with $this->myAcl()->isAllowed() in your
> controllers :)
> Marco Pivetta
>
> http://twitter.com/Ocramius
>
> http://marco-pivetta.com
>
>
>
> On 26 February 2012 20:13, cmple [via Zend Framework Community] <
> [hidden email] <http://user/SendEmail.jtp?type=node&node=4423529&i=0>>
> wrote:
>
> >  Marco Pivetta wrote
> > You can check
> >
> >
> https://github.com/ZF-Commons/ZfcUser/blob/master/src/ZfcUser/Controller/Plugin/ZfcUserAuthentication.php
> > and
> >
> >
> https://github.com/ZF-Commons/ZfcUser/blob/master/config/module.config.php#L63
> >
> > Marco Pivetta
> >
> > http://twitter.com/Ocramius
> >
> > http://marco-pivetta.com
> >
> >
> >
> > On 26 February 2012 03:13, cmple <[hidden email]<
> http://user/SendEmail.jtp?type=node&node=4422729&i=0>>
> > wrote:
> >
> > >
> > > HHGAG wrote
> > > >
> > > > Here's a tutorial:
> > > > http://akrabat.com/getting-started-with-zend-framework-2/
> > > >
> > > Its a great tutorial but it has nothing to do with plugins
> > >
> > > --
> > > View this message in context:
> > >
> >
> http://zend-framework-community.634137.n4.nabble.com/ZF2-What-s-the-proper-way-to-register-global-MVC-plugins-tp4265227p4421465.html
> > > Sent from the Zend Framework mailing list archive at Nabble.com.
> > >
> > > --
> > > List: [hidden email]<
> http://user/SendEmail.jtp?type=node&node=4422729&i=1>
> > > Info: http://framework.zend.com/archives
> > > Unsubscribe: [hidden email]<
> http://user/SendEmail.jtp?type=node&node=4422729&i=2>
>
> > >
> > >
> > >
> >
> > Thanks Marco!
> > It looks like the plugin functionality has moved to a controller level ?
> > or there is another way to add plugins to the module ?
> > for instance if I want to use the ACL library, where do i put the
> *$acl->isAllowed($role,
> > $resource, $action)* method ?
> >
> > ------------------------------
> >  If you reply to this email, your message will be added to the
> discussion
> > below:
> >
> >
> http://zend-framework-community.634137.n4.nabble.com/ZF2-What-s-the-proper-way-to-register-global-MVC-plugins-tp4265227p4422729.html
> >  To unsubscribe from Zend Framework Community, click here<
> http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=634137&code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4>
> > .
> > NAML<
> http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml><http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml%3E>
> >
>
> 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 plugins ?
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://zend-framework-community.634137.n4.nabble.com/ZF2-What-s-the-proper-way-to-register-global-MVC-plugins-tp4265227p4423529.html
>  To unsubscribe from Zend Framework Community, click 
> here<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=634137&code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4>
> .
> NAML<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>


--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/ZF2-What-s-the-proper-way-to-register-global-MVC-plugins-tp4265227p4424030.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to