List of usage examples for com.liferay.portal.kernel.theme ThemeDisplay getPermissionChecker
@JSON(include = false)
public PermissionChecker getPermissionChecker()
From source file:com.liferay.journal.content.web.internal.display.context.JournalContentDisplayContext.java
License:Open Source License
public boolean isShowSelectArticleIcon() throws PortalException { if (_showSelectArticleIcon != null) { return _showSelectArticleIcon; }/*from w w w .j av a2 s . c om*/ ThemeDisplay themeDisplay = (ThemeDisplay) _portletRequest.getAttribute(WebKeys.THEME_DISPLAY); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); _showSelectArticleIcon = PortletPermissionUtil.contains(themeDisplay.getPermissionChecker(), themeDisplay.getLayout(), portletDisplay.getId(), ActionKeys.CONFIGURATION); return _showSelectArticleIcon; }
From source file:com.liferay.journal.content.web.internal.portlet.toolbar.contributor.JournalContentPortletToolbarContributor.java
License:Open Source License
@Override protected List<MenuItem> getPortletTitleMenuItems(PortletRequest portletRequest, PortletResponse portletResponse) { ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); Layout layout = themeDisplay.getLayout(); long scopeGroupId = themeDisplay.getScopeGroupId(); if (!_resourcePermissionChecker.checkResource(themeDisplay.getPermissionChecker(), scopeGroupId, ActionKeys.ADD_ARTICLE) || layout.isLayoutPrototypeLinkActive()) { return Collections.emptyList(); }/*from w w w .ja v a 2 s.co m*/ List<MenuItem> menuItems = new ArrayList<>(); try { addPortletTitleAddJournalArticleMenuItems(menuItems, themeDisplay, portletRequest); } catch (Exception e) { _log.error("Unable to add folder menu item", e); } return menuItems; }
From source file:com.liferay.journal.search.JournalOpenSearchImpl.java
License:Open Source License
protected String getLayoutURL(ThemeDisplay themeDisplay, String articleId) throws Exception { PermissionChecker permissionChecker = themeDisplay.getPermissionChecker(); List<JournalContentSearch> contentSearches = _journalContentSearchLocalService .getArticleContentSearches(articleId); for (JournalContentSearch contentSearch : contentSearches) { if (LayoutPermissionUtil.contains(permissionChecker, contentSearch.getGroupId(), contentSearch.isPrivateLayout(), contentSearch.getLayoutId(), ActionKeys.VIEW)) { if (contentSearch.isPrivateLayout()) { if (!_groupLocalService.hasUserGroup(themeDisplay.getUserId(), contentSearch.getGroupId())) { continue; }/*from w w w . ja va2 s . co m*/ } Layout hitLayout = _layoutLocalService.getLayout(contentSearch.getGroupId(), contentSearch.isPrivateLayout(), contentSearch.getLayoutId()); return _portal.getLayoutURL(hitLayout, themeDisplay); } } return null; }
From source file:com.liferay.journal.search.JournalOpenSearchImpl.java
License:Open Source License
@Override protected String getURL(ThemeDisplay themeDisplay, long groupId, Document result, PortletURL portletURL) throws Exception { String articleId = result.get("articleId"); JournalArticle article = _journalArticleService.getArticle(groupId, articleId); if (Validator.isNotNull(article.getLayoutUuid())) { String groupFriendlyURL = _portal.getGroupFriendlyURL( _layoutSetLocalService.getLayoutSet(article.getGroupId(), false), themeDisplay); return groupFriendlyURL.concat(JournalArticleConstants.CANONICAL_URL_SEPARATOR) .concat(article.getUrlTitle()); }/*www . j av a 2s. co m*/ Layout layout = themeDisplay.getLayout(); List<Long> hitLayoutIds = _journalContentSearchLocalService.getLayoutIds(layout.getGroupId(), layout.isPrivateLayout(), articleId); for (Long hitLayoutId : hitLayoutIds) { PermissionChecker permissionChecker = themeDisplay.getPermissionChecker(); if (LayoutPermissionUtil.contains(permissionChecker, layout.getGroupId(), layout.isPrivateLayout(), hitLayoutId, ActionKeys.VIEW)) { Layout hitLayout = _layoutLocalService.getLayout(layout.getGroupId(), layout.isPrivateLayout(), hitLayoutId.longValue()); return _portal.getLayoutURL(hitLayout, themeDisplay); } } String layoutURL = getLayoutURL(themeDisplay, articleId); if (layoutURL != null) { return layoutURL; } AssetEntry assetEntry = _assetEntryLocalService.fetchEntry(JournalArticle.class.getName(), article.getResourcePrimKey()); if (assetEntry == null) { return null; } portletURL.setParameter("assetEntryId", String.valueOf(assetEntry.getEntryId())); portletURL.setParameter("groupId", String.valueOf(groupId)); portletURL.setParameter("articleId", articleId); return portletURL.toString(); }
From source file:com.liferay.journal.util.impl.JournalContentImpl.java
License:Open Source License
@Override public JournalArticleDisplay getDisplay(JournalArticle article, String ddmTemplateKey, String viewMode, String languageId, int page, PortletRequestModel portletRequestModel, ThemeDisplay themeDisplay) { StopWatch stopWatch = new StopWatch(); stopWatch.start();//from w w w . j a v a 2 s . c om long groupId = article.getGroupId(); String articleId = article.getArticleId(); double version = article.getVersion(); articleId = StringUtil.toUpperCase(GetterUtil.getString(articleId)); ddmTemplateKey = StringUtil.toUpperCase(GetterUtil.getString(ddmTemplateKey)); long layoutSetId = 0; boolean secure = false; if (themeDisplay != null) { try { if (!JournalArticlePermission.contains(themeDisplay.getPermissionChecker(), article, ActionKeys.VIEW)) { return null; } } catch (Exception e) { } LayoutSet layoutSet = themeDisplay.getLayoutSet(); layoutSetId = layoutSet.getLayoutSetId(); secure = themeDisplay.isSecure(); } JournalContentKey journalContentKey = new JournalContentKey(groupId, articleId, version, ddmTemplateKey, layoutSetId, viewMode, languageId, page, secure); JournalArticleDisplay articleDisplay = _portalCache.get(journalContentKey); boolean lifecycleRender = false; if (portletRequestModel != null) { lifecycleRender = RenderRequest.RENDER_PHASE.equals(portletRequestModel.getLifecycle()); } if ((articleDisplay == null) || !lifecycleRender) { articleDisplay = getArticleDisplay(article, ddmTemplateKey, viewMode, languageId, page, portletRequestModel, themeDisplay); if ((articleDisplay != null) && articleDisplay.isCacheable() && lifecycleRender) { _portalCache.put(journalContentKey, articleDisplay); } } if (_log.isDebugEnabled()) { _log.debug("getDisplay for {" + groupId + ", " + articleId + ", " + ddmTemplateKey + ", " + viewMode + ", " + languageId + ", " + page + "} takes " + stopWatch.getTime() + " ms"); } return articleDisplay; }
From source file:com.liferay.journal.web.asset.JournalArticleAssetRenderer.java
License:Open Source License
protected String getHitLayoutURL(boolean privateLayout, String noSuchEntryRedirect, ThemeDisplay themeDisplay) throws PortalException { List<Long> hitLayoutIds = JournalContentSearchLocalServiceUtil.getLayoutIds(_article.getGroupId(), privateLayout, _article.getArticleId()); for (Long hitLayoutId : hitLayoutIds) { Layout hitLayout = LayoutLocalServiceUtil.getLayout(_article.getGroupId(), privateLayout, hitLayoutId.longValue()); if (LayoutPermissionUtil.contains(themeDisplay.getPermissionChecker(), hitLayout, ActionKeys.VIEW)) { return PortalUtil.getLayoutURL(hitLayout, themeDisplay); }//from www. j a v a2 s. c o m } return noSuchEntryRedirect; }
From source file:com.liferay.journal.web.internal.display.context.JournalDisplayContext.java
License:Open Source License
public int getStatus() { if (_status != null) { return _status; }//from ww w . ja v a 2s .co m ThemeDisplay themeDisplay = (ThemeDisplay) _request.getAttribute(WebKeys.THEME_DISPLAY); int defaultStatus = WorkflowConstants.STATUS_APPROVED; PermissionChecker permissionChecker = themeDisplay.getPermissionChecker(); if (permissionChecker.isContentReviewer(themeDisplay.getCompanyId(), themeDisplay.getScopeGroupId()) || isNavigationMine()) { defaultStatus = WorkflowConstants.STATUS_ANY; } _status = ParamUtil.getInteger(_request, "status", defaultStatus); return _status; }
From source file:com.liferay.journal.web.internal.display.context.JournalMoveEntriesDisplayContext.java
License:Open Source License
public PermissionChecker getPermissionChecker() { if (_permissionChecker != null) { return _permissionChecker; }//from w w w . j a v a2 s. c o m ThemeDisplay themeDisplay = (ThemeDisplay) _liferayPortletRequest.getAttribute(WebKeys.THEME_DISPLAY); _permissionChecker = themeDisplay.getPermissionChecker(); return _permissionChecker; }
From source file:com.liferay.journal.web.internal.portlet.action.ActionUtil.java
License:Open Source License
public static JournalFolder getFolder(HttpServletRequest request) throws PortalException { ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); long folderId = ParamUtil.getLong(request, "folderId"); JournalFolder folder = null;/*from ww w . jav a 2s . c o m*/ if ((folderId > 0) && (folderId != JournalFolderConstants.DEFAULT_PARENT_FOLDER_ID)) { folder = JournalFolderServiceUtil.fetchFolder(folderId); } else { JournalPermission.check(themeDisplay.getPermissionChecker(), themeDisplay.getScopeGroupId(), ActionKeys.VIEW); } return folder; }
From source file:com.liferay.journal.web.internal.portlet.configuration.icon.FeedsPermissionsPortletConfigurationIcon.java
License:Open Source License
@Override public boolean isShow(PortletRequest portletRequest) { ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); return JournalPermission.contains(themeDisplay.getPermissionChecker(), themeDisplay.getScopeGroupId(), ActionKeys.PERMISSIONS);/* ww w . j a va 2 s .c om*/ }