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
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));
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');
10 matches
Mail list logo