List of usage examples for com.liferay.portal.util PropsValues IFRAME_PASSWORD_PASSWORD_TOKEN_ROLE
String IFRAME_PASSWORD_PASSWORD_TOKEN_ROLE
To view the source code for com.liferay.portal.util PropsValues IFRAME_PASSWORD_PASSWORD_TOKEN_ROLE.
Click Source Link
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; }// www . j a va 2 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.portlet.iframe.util.IFrameUtil.java
License:Open Source License
public static boolean isPasswordTokenEnabled(PortletRequest portletRequest) throws PortalException, SystemException { ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); Layout layout = themeDisplay.getLayout(); String roleName = PropsValues.IFRAME_PASSWORD_PASSWORD_TOKEN_ROLE; if (Validator.isNull(roleName)) { return true; }// w ww . j ava 2 s. c o m if (layout.isPrivateLayout() && layout.getGroup().isUser()) { return true; } 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; }