Example usage for com.liferay.portal.util PropsValues LAYOUT_USER_PUBLIC_LAYOUTS_POWER_USER_REQUIRED

List of usage examples for com.liferay.portal.util PropsValues LAYOUT_USER_PUBLIC_LAYOUTS_POWER_USER_REQUIRED

Introduction

In this page you can find the example usage for com.liferay.portal.util PropsValues LAYOUT_USER_PUBLIC_LAYOUTS_POWER_USER_REQUIRED.

Prototype

boolean LAYOUT_USER_PUBLIC_LAYOUTS_POWER_USER_REQUIRED

To view the source code for com.liferay.portal.util PropsValues LAYOUT_USER_PUBLIC_LAYOUTS_POWER_USER_REQUIRED.

Click Source Link

Usage

From source file:com.liferay.portlet.mypages.action.ViewAction.java

License:Open Source License

@Override
public ActionForward render(ActionMapping mapping, ActionForm form, PortletConfig portletConfig,
        RenderRequest renderRequest, RenderResponse renderResponse) throws Exception {

    if (renderRequest.getRemoteUser() == null) {
        return mapping.findForward("portlet.my_pages.view");
    }/*from  w ww  . ja  v a2s . c o m*/

    if (!renderRequest.getWindowState().equals(WindowState.MAXIMIZED)) {
        return mapping.findForward("portlet.my_pages.view");
    }

    User user = PortalUtil.getUser(renderRequest);

    RenderRequestImpl renderRequestImpl = (RenderRequestImpl) renderRequest;

    DynamicServletRequest dynamicRequest = (DynamicServletRequest) renderRequestImpl.getHttpServletRequest();

    dynamicRequest.setParameter("p_u_i_d", String.valueOf(user.getUserId()));

    String tabs1 = "public-pages";

    boolean hasPowerUserRole = RoleLocalServiceUtil.hasUserRole(user.getUserId(), user.getCompanyId(),
            RoleConstants.POWER_USER, true);

    if (!PropsValues.LAYOUT_USER_PUBLIC_LAYOUTS_MODIFIABLE
            || (PropsValues.LAYOUT_USER_PUBLIC_LAYOUTS_POWER_USER_REQUIRED && !hasPowerUserRole)) {

        tabs1 = "private-pages";
    }

    dynamicRequest.setParameter("tabs1", tabs1);

    Group group = user.getGroup();

    dynamicRequest.setParameter("groupId", String.valueOf(group.getGroupId()));

    ActionUtil.getGroup(renderRequest);

    return mapping.findForward("portlet.my_pages.edit_layouts");
}

From source file:com.liferay.portlet.mypages.MyPagesControlPanelEntry.java

License:Open Source License

public boolean isVisible(PermissionChecker permissionChecker, Portlet portlet) throws Exception {

    boolean hasPowerUserRole = RoleLocalServiceUtil.hasUserRole(permissionChecker.getUserId(),
            permissionChecker.getCompanyId(), RoleConstants.POWER_USER, true);

    if (PropsValues.LAYOUT_USER_PRIVATE_LAYOUTS_MODIFIABLE
            && (!PropsValues.LAYOUT_USER_PRIVATE_LAYOUTS_POWER_USER_REQUIRED || hasPowerUserRole)) {

        return true;
    }//from  ww  w.java  2 s  . com

    if (PropsValues.LAYOUT_USER_PUBLIC_LAYOUTS_MODIFIABLE
            && (!PropsValues.LAYOUT_USER_PUBLIC_LAYOUTS_POWER_USER_REQUIRED || hasPowerUserRole)) {

        return true;
    }

    return false;
}