掲示板

Get UserId of logged in user without request object

11年前 に Hussain Shaikh によって更新されました。

Get UserId of logged in user without request object

Junior Member 投稿: 44 参加年月日: 12/06/07 最新の投稿
Hi,
How can i get current user's userId without a request object?
Thanks
thumbnail
11年前 に Mika Koivisto によって更新されました。

RE: Get UserId of logged in user without request object

Liferay Legend 投稿: 1519 参加年月日: 06/08/07 最新の投稿
You can always access PrincipalThreadLocal just remember that any scheduled tasks won't have any user associated with them.
11年前 に Rahul Sharma によって更新されました。

RE: Get UserId of logged in user without request object

Junior Member 投稿: 59 参加年月日: 12/01/11 最新の投稿
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
11年前 に Mika Koivisto によって更新されました。

RE: Get UserId of logged in user without request object

Liferay Legend 投稿: 1519 参加年月日: 06/08/07 最新の投稿
Rahul, usually when you don't have request you don't have ThemeDisplay either.