Forums de discussion

Configuring multiple hooks for same action

Sai SRINIVAS, modifié il y a 7 années.

Configuring multiple hooks for same action

New Member Publications: 8 Date d'inscription: 07/10/16 Publications récentes
Hi

We have a scenario, where we need to write multiple hooks for same Liferay Action (Eg: Login post & pre events), but we need to configure each hook for different site. Let's say, I have two hooks "Hook A" & "Hook B", I need to configure "Hook A for site A" & "Hook B for Site B". I figured how we can do it for JSP's using "application adapter hooks", but I need similar control on Liferay actions. Can someone please direct me in right way if you have already come across this scenario or with any web resources and I want to know, whether it is possible or not. Thanks in advance
thumbnail
David H Nebinger, modifié il y a 7 années.

RE: Configuring multiple hooks for same action

Liferay Legend Publications: 14916 Date d'inscription: 02/09/06 Publications récentes
Liferay login isn't by site, it is to the server. Whatever you think you're doing, you're actually not.

Now you might say that if the user logs in on Site X that we want to do one thing when they log in but something else when they log in on site Y, but in either case it is still one login.

That said, login pre and post event handlers can check what the current source and choose whether to do something or not. They have access to the request header which means you can get anything you need to determine whether to do something or not.

Either way though, it is still a single login. If you're doing something like "in X add role ABC to user at login" and "in Y set a cookie for Z", you should be doing both of these when I log in because you have no idea if I know how to switch between the sites manually. They are, after all, just address bar changes away from each other. If you don't properly construct the environment for me regardless of the site I'm currently on, users may encounter unexpected results.
Sai SRINIVAS, modifié il y a 7 années.

RE: Configuring multiple hooks for same action

New Member Publications: 8 Date d'inscription: 07/10/16 Publications récentes
Thanks david for the response

Is there a way, where I can set, which "Hook" need to enabled & disabled (Eg: in portal-ext.properties) ?. I want to configure which hook needs to be used end of the day
thumbnail
David H Nebinger, modifié il y a 7 années.

RE: Configuring multiple hooks for same action

Liferay Legend Publications: 14916 Date d'inscription: 02/09/06 Publications récentes
Nothing ootb. You can certainly add keys to portal-ext.properties and read them in the code, but I think you missed my whole response of what you are thinking is likely going to have a bad outcome.
Sai SRINIVAS, modifié il y a 7 années.

RE: Configuring multiple hooks for same action

New Member Publications: 8 Date d'inscription: 07/10/16 Publications récentes
oh ok. Thanks