We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Multimodule + Auth / ACL

HI. I generated multimodule aplication:

  • Frontend
  • Backend

Working good.

But I tired install ACL from INVO (demo) aplication and it seems thats are 2 different versions.

Has someone demo or instruction how to install Plugin ACL in multimodule structrue.

edited Oct '17

I don't about invo. But my resources are just defined as ModuleName:ControllerName, and action is access. Works pretty much fine.

Hi. I have installed the SecurityPlugin already. The class is loaded good, BUT the event beforeDispatch doesn't work.

Don't call Plugin.

Below screen my code where i set the dispatcher and EventListener:

edited Oct '17

First beacause you have two services definition, delete one of them. Well beforeDispatch doesn't work beacause you attached plugin to beforeExecuteRoute.

Hi. Thanks.

Which of file i have to delete? NotFoundPlugin?

This code is from: Invo Demo Security Plugin:

$eventsManager->attach('dispatch:beforeExecuteRoute', new SecurityPlugin);

So i think is good connected to beforeExecuteRoute' .

In the demo in single module, working good.

edited Oct '17

I didn't wrote about any file deleting. You have TWO SERVICES DECLEARTION, you are setting two times dispatcher, it's kind of stupid. You are asking why beforeDispatch event doesn't work. So i wrote it doesn't work beacause you attached it to beforeExecuteRoute. Not sure what else question you have.

Hi. Dispatcher beforeExecuteRoute is from invo there working fine. I copied to my multimodule application and does'nt work... added namespace, aliases to class name etc...

But all the time any dispatcher it doesn't work.

Look please for my code. There is die() function in SecurityPlugin in beforeDispatch function ,and this not call ... why ,, ,i don't know. Class is loaded fine.

Yes beacause you attached SecurityPlugin to event beforeExecuteRoute, and you added die() to beforeDispatch which is not fired in this case beacause you added plugin only to beforeExecuteRoute

edited Oct '17

beforeExecuteRoute, Triggered before executing the controller/action method. At this point the dispatcher has been initialized the controller and know if the action exist.

I added die() to check the application call my Service. But application doesn't stop it . Any dispatcher not working in Phalcon in multimodules. In controller no problem, but as registered dispatcher not ...

But. in invo working normaly.... before action is calling and die() is working and stoped my application in called method. This is normal....

Here any dispatch doesn't work.... maby i don't understad something.

Do you understand what i wrote? You added security plugin ONLY TO beforeExecuteRoute, you added yoru die in beforeDispatch method. Since you added security plugin only to one event then that's why method beforeDispatch is not executed at all.

Thanks Wojciech.

I had not oryginal invo code.

[SOLVED] $eventsManager->attach('dispatch:beforeDispatch', new SecurityPlugin);
instead $eventsManager->attach('dispatch:beforeExecuteRoute', new SecurityPlugin);

Sory for confusion.