List of usage examples for com.liferay.portal.kernel.theme ThemeDisplay getRealUserId
public long getRealUserId()
From source file:com.liferay.iframe.web.internal.util.IFrameUtil.java
License:Open Source License
public static boolean isPasswordTokenEnabled(PortletRequest portletRequest) throws PortalException { if (!PropsValues.SESSION_STORE_PASSWORD) { return false; }/* ww w .j av a2 s.c o m*/ ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); Layout layout = themeDisplay.getLayout(); String roleName = PropsValues.IFRAME_PASSWORD_PASSWORD_TOKEN_ROLE; if (layout.isPrivateLayout() && layout.getGroup().isUser() && (themeDisplay.getRealUserId() == layout.getGroup().getClassPK())) { return true; } if (Validator.isNull(roleName)) { return false; } try { Role role = RoleLocalServiceUtil.getRole(themeDisplay.getCompanyId(), roleName); if (UserLocalServiceUtil.hasRoleUser(role.getRoleId(), themeDisplay.getUserId())) { return true; } } catch (Exception e) { if (_log.isWarnEnabled()) { _log.warn("Error getting role " + roleName + ". The password token " + "will be disabled."); } } return false; }
From source file:com.liferay.iframe.web.internal.util.IFrameUtil.java
License:Open Source License
public static boolean isPasswordTokenResolutionEnabled(PortletRequest portletRequest) throws PortalException { if (!PropsValues.SESSION_STORE_PASSWORD) { return false; }//from ww w . j a va 2 s .co m ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); Layout layout = themeDisplay.getLayout(); if (layout.isPrivateLayout() && layout.getGroup().isUser() && (themeDisplay.getRealUserId() != layout.getGroup().getClassPK())) { return false; } return true; }