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
-- 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
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
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
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) ?
-- 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
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
-- 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,
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');
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
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
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
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:
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
juhasuni, did you find the solution?
I'd also like to know
Thanks,
juhasuni wrote
Hello,
Is there a correct way to register custom MVC plugins that should be
accessible from all controllers implementing the Pluggable interface?
ZF introduces few plugins by default and those are
Here's a tutorial: http://akrabat.com/getting-started-with-zend-framework-2/
-
Hasan H. Gürsoy (HHGAG)
--
View this message in context:
http://zend-framework-community.634137.n4.nabble.com/ZF2-What-s-the-proper-way-to-register-global-MVC-plugins-tp4265227p4418281.html
Sent from the Zend
16 matches
Mail list logo