Forums de discussion

Get UserId of logged in user without request object

Hussain Shaikh, modifié il y a 11 années.

Get UserId of logged in user without request object

Junior Member Publications: 44 Date d'inscription: 07/06/12 Publications récentes
Hi,
How can i get current user's userId without a request object?
Thanks
thumbnail
Mika Koivisto, modifié il y a 11 années.

RE: Get UserId of logged in user without request object

Liferay Legend Publications: 1519 Date d'inscription: 07/08/06 Publications récentes
You can always access PrincipalThreadLocal just remember that any scheduled tasks won't have any user associated with them.
Rahul Sharma, modifié il y a 11 années.

RE: Get UserId of logged in user without request object

Junior Member Publications: 59 Date d'inscription: 11/01/12 Publications récentes
Hi Hussain,

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

Hope this will help you.

Regards,
Rahul
thumbnail
Mika Koivisto, modifié il y a 11 années.

RE: Get UserId of logged in user without request object

Liferay Legend Publications: 1519 Date d'inscription: 07/08/06 Publications récentes
Rahul, usually when you don't have request you don't have ThemeDisplay either.