Fórum

How to set the default role when user log in in liferay 6.0 or 6.1

Kiran Kumar Boyini, modificado 11 Anos atrás.

How to set the default role when user log in in liferay 6.0 or 6.1

Expert Postagens: 287 Data de Entrada: 02/06/11 Postagens Recentes
Hi All,

I have requirement i.e., When the user logs in we have to assign one role as default role from the available roles related to him.
And he has in role (default role) every time, when he logs.

Tell me, how it is possible in simplest way.

Regards,

Kiran.
thumbnail
Jitendra Rajput, modificado 11 Anos atrás.

RE: How to set the default role when user log in in liferay 6.0 or 6.1

Liferay Master Postagens: 875 Data de Entrada: 07/01/11 Postagens Recentes
over ride login.events.post event using hook. This event will be called after successful login.

Specify below entries in your liferay-hook.xml

<hook>
<event>
<event-class>com.test.sample.CustomLoginPostAction</event-class>
<event-type>login.events.post</event-type>
</event>
</hook>



And create CustomLoginPostAction class and write your logic to associate default role with logged in user.



public class LoginPostAction extends Action {



You can get logged in users details using PortalUtil.getUserId(request);
To know more about this check LoginPostAction inside portal source
thumbnail
Sreeraj AV, modificado 11 Anos atrás.

RE: How to set the default role when user log in in liferay 6.0 or 6.1

Regular Member Postagens: 239 Data de Entrada: 27/04/10 Postagens Recentes
Kiran Kumar Boyini:
Hi All,

I have requirement i.e., When the user logs in we have to assign one role as default role from the available roles related to him.
And he has in role (default role) every time, when he logs.

Tell me, how it is possible in simplest way.

Regards,

Kiran.


I didnt get ur question exactly.. One option is, using control panel section. We can set default users associations using Control Panel -> Portal Settings -> Users -> Default User Associations Tab.