Liferay fails to manage unique session and displays the mismatched data of the users

Issue

  • Liferay fails to manage unique sessions and displays the mismatched data of the users when using the below code
    ThemeDisplay td = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY); 
    User user = td.getUser();
    String clientId = user.getScreenName().toUpperCase();

Environment

  • Liferay DXP 7.1

Resolution

Please note: The following information involves customizations or implementation ideas that are beyond the scope of Liferay Support.  Please exercise appropriate discretion on the implementation based on your needs in the use of this information. 

  • The above code shows that the wrong getUser() method is used for ThemeDisplay Java Class API.
  • To know the available methods of this API, go through this article "Accessing ThemeDisplay Information" and use the available methods as per the needs to fetch various Portal elements related to the user.
  • For example, getUserId: Returns the user’s ID, getUserName: Returns the user’s name, and so on.
这篇文章有帮助吗?
0 人中有 0 人觉得有帮助