Example usage for com.liferay.portal.plugin PluginUtil restrictPlugins

List of usage examples for com.liferay.portal.plugin PluginUtil restrictPlugins

Introduction

In this page you can find the example usage for com.liferay.portal.plugin PluginUtil restrictPlugins.

Prototype

public static <P extends Plugin> List<P> restrictPlugins(List<P> plugins, User user) 

Source Link

Usage

From source file:com.liferay.nested.portlets.web.internal.display.context.NestedPortletsDisplayContext.java

License:Open Source License

public List<LayoutTemplate> getLayoutTemplates() {
    ThemeDisplay themeDisplay = (ThemeDisplay) _request.getAttribute(WebKeys.THEME_DISPLAY);

    List<LayoutTemplate> layoutTemplates = LayoutTemplateLocalServiceUtil
            .getLayoutTemplates(themeDisplay.getThemeId());

    layoutTemplates = PluginUtil.restrictPlugins(layoutTemplates, themeDisplay.getUser());

    final List<String> unSupportedLayoutTemplateIds = getUnsupportedLayoutTemplateIds();

    return ListUtil.filter(layoutTemplates, new PredicateFilter<LayoutTemplate>() {

        @Override/*  www  . j a  va 2 s  .c  om*/
        public boolean filter(LayoutTemplate layoutTemplate) {
            return !unSupportedLayoutTemplateIds.contains(layoutTemplate.getLayoutTemplateId());
        }

    });
}