Example usage for com.liferay.portal.kernel.security.permission ActionKeys VIEW

List of usage examples for com.liferay.portal.kernel.security.permission ActionKeys VIEW

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.security.permission ActionKeys VIEW.

Prototype

String VIEW

To view the source code for com.liferay.portal.kernel.security.permission ActionKeys VIEW.

Click Source Link

Usage

From source file:com.liferay.screens.service.impl.ScreensDDLRecordServiceImpl.java

License:Open Source License

@Override
public int getDDLRecordsCount(long ddlRecordSetId) throws PortalException {
    _ddlRecordSetModelResourcePermission.check(getPermissionChecker(), ddlRecordSetId, ActionKeys.VIEW);

    return ddlRecordLocalService.getRecordsCount(ddlRecordSetId);
}

From source file:com.liferay.screens.service.impl.ScreensDDLRecordServiceImpl.java

License:Open Source License

@Override
public int getDDLRecordsCount(long ddlRecordSetId, long userId) throws PortalException {

    _ddlRecordSetModelResourcePermission.check(getPermissionChecker(), ddlRecordSetId, ActionKeys.VIEW);

    return ddlRecordLocalService.getRecordsCount(ddlRecordSetId, userId);
}

From source file:com.liferay.screens.service.impl.ScreensJournalArticleServiceImpl.java

License:Open Source License

@Override
public String getJournalArticleContent(long classPK, Locale locale) throws PortalException {

    JournalArticleResource journalArticleResource = journalArticleResourceLocalService
            .getArticleResource(classPK);

    JournalArticlePermission.check(getPermissionChecker(), journalArticleResource.getGroupId(),
            journalArticleResource.getArticleId(), ActionKeys.VIEW);

    return journalArticleLocalService.getArticleContent(journalArticleResource.getGroupId(),
            journalArticleResource.getArticleId(), null, null, getLanguageId(locale), null, null);
}

From source file:com.liferay.screens.service.impl.ScreensJournalArticleServiceImpl.java

License:Open Source License

@Override
public String getJournalArticleContent(long classPK, long ddmTemplateId, Locale locale) throws PortalException {

    JournalArticleResource journalArticleResource = journalArticleResourceLocalService
            .getArticleResource(classPK);

    JournalArticlePermission.check(getPermissionChecker(), journalArticleResource.getGroupId(),
            journalArticleResource.getArticleId(), ActionKeys.VIEW);

    return journalArticleLocalService.getArticleContent(journalArticleResource.getGroupId(),
            journalArticleResource.getArticleId(), null, getDDMTemplateKey(ddmTemplateId),
            getLanguageId(locale), null, null);
}

From source file:com.liferay.screens.service.impl.ScreensJournalArticleServiceImpl.java

License:Open Source License

@Override
public String getJournalArticleContent(long groupId, String articleId, long ddmTemplateId, Locale locale)
        throws PortalException {

    JournalArticlePermission.check(getPermissionChecker(), groupId, articleId, ActionKeys.VIEW);

    return journalArticleLocalService.getArticleContent(groupId, articleId, null,
            getDDMTemplateKey(ddmTemplateId), getLanguageId(locale), null, null);
}

From source file:com.liferay.screens.service.impl.ScreensRatingsEntryServiceImpl.java

License:Open Source License

@Override
public JSONObject getRatingsEntries(long assetEntryId, int ratingsLength) throws PortalException {

    AssetEntry assetEntry = assetEntryLocalService.fetchEntry(assetEntryId);

    AssetEntryPermission.check(getPermissionChecker(), assetEntry, ActionKeys.VIEW);

    return getRatingsEntries(assetEntry.getClassPK(), assetEntry.getClassName(), ratingsLength);
}

From source file:com.liferay.site.navigation.service.impl.SiteNavigationMenuServiceImpl.java

License:Open Source License

@Override
public SiteNavigationMenu fetchSiteNavigationMenu(long siteNavigationMenuId) throws PortalException {

    _siteNavigationMenuModelResourcePermission.check(getPermissionChecker(), siteNavigationMenuId,
            ActionKeys.VIEW);

    return siteNavigationMenuLocalService.fetchSiteNavigationMenu(siteNavigationMenuId);
}

From source file:com.liferay.site.navigation.site.map.web.internal.display.context.SiteNavigationSiteMapDisplayContext.java

License:Open Source License

private void _buildSiteMap(Layout layout, List<Layout> layouts, Layout rootLayout, boolean includeRootInTree,
        int displayDepth, boolean showCurrentPage, boolean useHtmlTitle, boolean showHiddenPages, int curDepth,
        ThemeDisplay themeDisplay, StringBundler sb) throws Exception {

    if (layouts.isEmpty()) {
        return;/*w ww .  j av a2 s.  c  o m*/
    }

    if ((rootLayout != null) && !LayoutPermissionUtil.contains(themeDisplay.getPermissionChecker(), rootLayout,
            ActionKeys.VIEW)) {

        return;
    }

    sb.append("<ul>");

    if (includeRootInTree && (rootLayout != null) && (curDepth == 1)) {
        sb.append("<li>");

        String cssClass = "root";

        if (rootLayout.getPlid() == layout.getPlid()) {
            cssClass += " current";
        }

        _buildLayoutView(rootLayout, cssClass, useHtmlTitle, themeDisplay, sb);

        _buildSiteMap(layout, layouts, rootLayout, includeRootInTree, displayDepth, showCurrentPage,
                useHtmlTitle, showHiddenPages, curDepth + 1, themeDisplay, sb);

        sb.append("</li>");
    } else {
        for (Layout curLayout : layouts) {
            if ((showHiddenPages || !curLayout.isHidden()) && LayoutPermissionUtil
                    .contains(themeDisplay.getPermissionChecker(), curLayout, ActionKeys.VIEW)) {

                sb.append("<li>");

                String cssClass = StringPool.BLANK;

                if (curLayout.getPlid() == layout.getPlid()) {
                    cssClass = "current";
                }

                _buildLayoutView(curLayout, cssClass, useHtmlTitle, themeDisplay, sb);

                if ((displayDepth == 0) || (displayDepth > curDepth)) {
                    if (showHiddenPages) {
                        _buildSiteMap(layout, curLayout.getChildren(), rootLayout, includeRootInTree,
                                displayDepth, showCurrentPage, useHtmlTitle, showHiddenPages, curDepth + 1,
                                themeDisplay, sb);
                    } else {
                        _buildSiteMap(layout, curLayout.getChildren(themeDisplay.getPermissionChecker()),
                                rootLayout, includeRootInTree, displayDepth, showCurrentPage, useHtmlTitle,
                                showHiddenPages, curDepth + 1, themeDisplay, sb);
                    }
                }

                sb.append("</li>");
            }
        }
    }

    sb.append("</ul>");
}

From source file:com.liferay.site.service.persistence.test.GroupFinderTest.java

License:Open Source License

protected static ResourceAction getModelResourceAction() throws PortalException {

    String name = RandomTestUtil.randomString() + "Model";

    List<String> actionIds = new ArrayList<>();

    actionIds.add(ActionKeys.UPDATE);//from  w w w  .ja v a  2  s  .c  o  m
    actionIds.add(ActionKeys.VIEW);

    ResourceActionLocalServiceUtil.checkResourceActions(name, actionIds, true);

    return ResourceActionLocalServiceUtil.getResourceAction(name, ActionKeys.VIEW);
}

From source file:com.liferay.site.util.GroupSearchProvider.java

License:Open Source License

protected LinkedHashMap<String, Object> getGroupParams(PortletRequest portletRequest,
        GroupSearchTerms searchTerms, long parentGroupId) throws PortalException {

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

    LinkedHashMap<String, Object> groupParams = new LinkedHashMap<>();

    groupParams.put("site", Boolean.TRUE);

    PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();

    User user = themeDisplay.getUser();//ww  w.j ava 2 s  .c om

    if (searchTerms.hasSearchTerms()) {
        if (isFilterManageableGroups(portletRequest)) {
            groupParams.put("groupsTree", getAllGroups(portletRequest));
        } else if (parentGroupId > 0) {
            List<Group> groupsTree = new ArrayList<>();

            Group parentGroup = _groupLocalService.getGroup(parentGroupId);

            groupsTree.add(parentGroup);

            groupParams.put("groupsTree", groupsTree);
        }

        if (!permissionChecker.isCompanyAdmin()
                && !GroupPermissionUtil.contains(permissionChecker, ActionKeys.VIEW)) {

            groupParams.put("usersGroups", Long.valueOf(user.getUserId()));
        }
    }

    return groupParams;
}