Example usage for com.liferay.portal.kernel.service.permission PortletPermissionUtil contains

List of usage examples for com.liferay.portal.kernel.service.permission PortletPermissionUtil contains

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.service.permission PortletPermissionUtil contains.

Prototype

public static boolean contains(PermissionChecker permissionChecker, long plid, String portletId,
            String actionId, boolean strict) throws PortalException 

Source Link

Usage

From source file:com.liferay.dynamic.data.mapping.service.permission.DDMTemplatePermission.java

License:Open Source License

private static boolean _containsAddTemplatePermission(PermissionChecker permissionChecker, long groupId,
        long classNameId, ServiceWrapper<DDMTemplatePermissionSupport> templatePermissionSupportServiceWrapper)
        throws PortalException {

    String resourceName = getResourceName(templatePermissionSupportServiceWrapper, classNameId);

    List<String> portletNames = ResourceActionsUtil.getPortletNames();

    if (portletNames.contains(resourceName)) {
        return PortletPermissionUtil.contains(permissionChecker, groupId, null, resourceName,
                getAddTemplateActionId(templatePermissionSupportServiceWrapper));
    }//from   w w  w  . j ava 2  s .  c o m

    return contains(permissionChecker, resourceName, groupId,
            getAddTemplateActionId(templatePermissionSupportServiceWrapper));
}

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);
    }//from   w w w. ja v a 2  s.  c o  m

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