Example usage for com.liferay.portal.kernel.portlet PortletConfigurationLayoutUtil getLayout

List of usage examples for com.liferay.portal.kernel.portlet PortletConfigurationLayoutUtil getLayout

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.portlet PortletConfigurationLayoutUtil getLayout.

Prototype

public static Layout getLayout(ThemeDisplay themeDisplay) 

Source Link

Usage

From source file:com.liferay.exportimport.web.internal.portlet.action.ActionUtil.java

License:Open Source License

public static Portlet getPortlet(PortletRequest portletRequest) throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);

    PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();

    String portletId = ParamUtil.getString(portletRequest, "portletResource");

    Layout layout = PortletConfigurationLayoutUtil.getLayout(themeDisplay);

    if (!PortletPermissionUtil.contains(permissionChecker, themeDisplay.getScopeGroupId(), layout, portletId,
            ActionKeys.CONFIGURATION)) {

        throw new PrincipalException.MustHavePermission(permissionChecker, Portlet.class.getName(), portletId,
                ActionKeys.CONFIGURATION);
    }//w  ww. j a va2 s  .  c o m

    return PortletLocalServiceUtil.getPortletById(themeDisplay.getCompanyId(), portletId);
}

From source file:com.liferay.portlet.configuration.web.internal.portlet.PortletConfigurationPortlet.java

License:Open Source License

protected void checkEditPermissionsJSP(PortletRequest request) throws PortalException {

    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

    String modelResource = ParamUtil.getString(request, "modelResource");

    long resourceGroupId = ParamUtil.getLong(request, "resourceGroupId", themeDisplay.getScopeGroupId());

    if (Validator.isNotNull(modelResource)) {
        String resourcePrimKey = ParamUtil.getString(request, "resourcePrimKey");

        _permissionService.checkPermission(resourceGroupId, modelResource, resourcePrimKey);

        return;//w ww .  j  av a2  s . c  o  m
    }

    String portletResource = ParamUtil.getString(request, "portletResource");

    PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();

    Layout layout = PortletConfigurationLayoutUtil.getLayout(themeDisplay);

    _portletPermission.check(permissionChecker, resourceGroupId, layout, portletResource,
            ActionKeys.PERMISSIONS);
}