Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Hussain Shaikh
Get UserId of logged in user without request object
December 7, 2012 5:57 AM
Answer

Hussain Shaikh

Rank: Junior Member

Posts: 45

Join Date: June 6, 2012

Recent Posts

Hi,
How can i get current user's userId without a request object?
Thanks
Mika Koivisto
RE: Get UserId of logged in user without request object
December 13, 2012 5:37 PM
Answer

Mika Koivisto

Rank: Liferay Legend

Posts: 1518

Join Date: August 7, 2006

Recent Posts

You can always access PrincipalThreadLocal just remember that any scheduled tasks won't have any user associated with them.
Rahul Sharma
RE: Get UserId of logged in user without request object
December 17, 2012 2:54 AM
Answer

Rahul Sharma

Rank: Junior Member

Posts: 60

Join Date: January 10, 2012

Recent Posts

Hi Hussain,

You can use ThemeDisplay object to get the user's userID, such as themeDisplay.getUserId().

Hope this will help you.

Regards,
Rahul
Mika Koivisto
RE: Get UserId of logged in user without request object
December 17, 2012 11:26 AM
Answer

Mika Koivisto

Rank: Liferay Legend

Posts: 1518

Join Date: August 7, 2006

Recent Posts

Rahul, usually when you don't have request you don't have ThemeDisplay either.

Participate in the State of Liferay Community 2017. Help the community and even win some prizes!