Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
How to set the default role when user log in in liferay 6.0 or 6.1
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 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.
over ride login.events.post event using hook. This event will be called after successful login.
Specify below entries in your liferay-hook.xml
And create CustomLoginPostAction class and write your logic to associate default role with logged in user.
You can get logged in users details using PortalUtil.getUserId(request);
To know more about this check LoginPostAction inside portal source
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
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.