List of usage examples for com.liferay.portal.kernel.security.permission ActionKeys ADD_ARTICLE
String ADD_ARTICLE
To view the source code for com.liferay.portal.kernel.security.permission ActionKeys ADD_ARTICLE.
Click Source Link
From source file:com.liferay.journal.content.web.internal.display.context.JournalContentDisplayContext.java
License:Open Source License
public boolean isShowAddArticleIcon() throws PortalException { if (_showAddArticleIcon != null) { return _showAddArticleIcon; }// w w w. j a va2 s . com ThemeDisplay themeDisplay = (ThemeDisplay) _portletRequest.getAttribute(WebKeys.THEME_DISPLAY); _showAddArticleIcon = false; if (!isShowSelectArticleIcon()) { return _showAddArticleIcon; } _showAddArticleIcon = JournalPermission.contains(themeDisplay.getPermissionChecker(), themeDisplay.getScopeGroupId(), ActionKeys.ADD_ARTICLE); return _showAddArticleIcon; }
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 .j av a2s .c om*/ 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.internal.trash.JournalArticleTrashHandler.java
License:Open Source License
@Override public boolean hasTrashPermission(PermissionChecker permissionChecker, long groupId, long classPK, String trashActionId) throws PortalException { if (trashActionId.equals(TrashActionKeys.MOVE)) { return JournalFolderPermission.contains(permissionChecker, groupId, classPK, ActionKeys.ADD_ARTICLE); }//from w w w .j a v a2s . c o m return super.hasTrashPermission(permissionChecker, groupId, classPK, trashActionId); }
From source file:com.liferay.journal.service.impl.JournalArticleServiceImpl.java
License:Open Source License
/** * Adds a web content article with additional parameters. * * @param groupId the primary key of the web content article's group * @param folderId the primary key of the web content article folder * @param classNameId the primary key of the DDMStructure class if the web * content article is related to a DDM structure, the primary key of * the class name associated with the article, or * JournalArticleConstants.CLASSNAME_ID_DEFAULT in the journal-api * module otherwise/*from w w w . j a v a 2 s .com*/ * @param classPK the primary key of the DDM structure, if the primary key * of the DDMStructure class is given as the * <code>classNameId</code> parameter, the primary key of the class * associated with the web content article, or <code>0</code> * otherwise * @param articleId the primary key of the web content article * @param autoArticleId whether to auto generate the web content article ID * @param titleMap the web content article's locales and localized titles * @param descriptionMap the web content article's locales and localized * descriptions * @param content the HTML content wrapped in XML. For more information, * see the content example in the {@link #updateArticle(long, long, * String, double, String, ServiceContext)} description. * @param ddmStructureKey the primary key of the web content article's DDM * structure, if the article is related to a DDM structure, or * <code>null</code> otherwise * @param ddmTemplateKey the primary key of the web content article's DDM * template * @param layoutUuid the unique string identifying the web content * article's display page * @param displayDateMonth the month the web content article is set to * display * @param displayDateDay the calendar day the web content article is set to * display * @param displayDateYear the year the web content article is set to * display * @param displayDateHour the hour the web content article is set to * display * @param displayDateMinute the minute the web content article is set to * display * @param expirationDateMonth the month the web content article is set to * expire * @param expirationDateDay the calendar day the web content article is set * to expire * @param expirationDateYear the year the web content article is set to * expire * @param expirationDateHour the hour the web content article is set to * expire * @param expirationDateMinute the minute the web content article is set to * expire * @param neverExpire whether the web content article is not set to auto * expire * @param reviewDateMonth the month the web content article is set for * review * @param reviewDateDay the calendar day the web content article is set for * review * @param reviewDateYear the year the web content article is set for review * @param reviewDateHour the hour the web content article is set for review * @param reviewDateMinute the minute the web content article is set for * review * @param neverReview whether the web content article is not set for review * @param indexable whether the web content article is searchable * @param smallImage whether the web content article has a small image * @param smallImageURL the web content article's small image URL * @param smallFile the web content article's small image file * @param images the web content's images * @param articleURL the web content article's accessible URL * @param serviceContext the service context to be applied. Can set the * UUID, creation date, modification date, expando bridge * attributes, guest permissions, group permissions, asset category * IDs, asset tag names, asset link entry IDs, asset priority, URL * title, and workflow actions for the web content article. Can also * set whether to add the default guest and group permissions. * @return the web content article */ @Override public JournalArticle addArticle(long groupId, long folderId, long classNameId, long classPK, String articleId, boolean autoArticleId, Map<Locale, String> titleMap, Map<Locale, String> descriptionMap, String content, String ddmStructureKey, String ddmTemplateKey, String layoutUuid, int displayDateMonth, int displayDateDay, int displayDateYear, int displayDateHour, int displayDateMinute, int expirationDateMonth, int expirationDateDay, int expirationDateYear, int expirationDateHour, int expirationDateMinute, boolean neverExpire, int reviewDateMonth, int reviewDateDay, int reviewDateYear, int reviewDateHour, int reviewDateMinute, boolean neverReview, boolean indexable, boolean smallImage, String smallImageURL, File smallFile, Map<String, byte[]> images, String articleURL, ServiceContext serviceContext) throws PortalException { JournalFolderPermission.check(getPermissionChecker(), groupId, folderId, ActionKeys.ADD_ARTICLE); return journalArticleLocalService.addArticle(getUserId(), groupId, folderId, classNameId, classPK, articleId, autoArticleId, JournalArticleConstants.VERSION_DEFAULT, titleMap, descriptionMap, content, ddmStructureKey, ddmTemplateKey, layoutUuid, displayDateMonth, displayDateDay, displayDateYear, displayDateHour, displayDateMinute, expirationDateMonth, expirationDateDay, expirationDateYear, expirationDateHour, expirationDateMinute, neverExpire, reviewDateMonth, reviewDateDay, reviewDateYear, reviewDateHour, reviewDateMinute, neverReview, indexable, smallImage, smallImageURL, smallFile, images, articleURL, serviceContext); }
From source file:com.liferay.journal.service.impl.JournalArticleServiceImpl.java
License:Open Source License
/** * Adds a web content article without any images. * * @param groupId the primary key of the web content article's group * @param folderId the primary key of the web content article folder * @param classNameId the primary key of the DDMStructure class if the web * content article is related to a DDM structure, the primary key of * the class name associated with the article, or * JournalArticleConstants.CLASSNAME_ID_DEFAULT in the journal-api * module otherwise//from ww w . j a v a 2s.c om * @param classPK the primary key of the DDM structure, if the primary key * of the DDMStructure class is given as the * <code>classNameId</code> parameter, the primary key of the class * associated with the web content article, or <code>0</code> * otherwise * @param articleId the primary key of the web content article * @param autoArticleId whether to auto generate the web content article ID * @param titleMap the web content article's locales and localized titles * @param descriptionMap the web content article's locales and localized * descriptions * @param content the HTML content wrapped in XML * @param ddmStructureKey the primary key of the web content article's DDM * structure, if the article is related to a DDM structure, or * <code>null</code> otherwise * @param ddmTemplateKey the primary key of the web content article's DDM * template * @param layoutUuid the unique string identifying the web content * article's display page * @param displayDateMonth the month the web content article is set to * display * @param displayDateDay the calendar day the web content article is set to * display * @param displayDateYear the year the web content article is set to * display * @param displayDateHour the hour the web content article is set to * display * @param displayDateMinute the minute the web content article is set to * display * @param expirationDateMonth the month the web content article is set to * expire * @param expirationDateDay the calendar day the web content article is set * to expire * @param expirationDateYear the year the web content article is set to * expire * @param expirationDateHour the hour the web content article is set to * expire * @param expirationDateMinute the minute the web content article is set to * expire * @param neverExpire whether the web content article is not set to auto * expire * @param reviewDateMonth the month the web content article is set for * review * @param reviewDateDay the calendar day the web content article is set for * review * @param reviewDateYear the year the web content article is set for review * @param reviewDateHour the hour the web content article is set for review * @param reviewDateMinute the minute the web content article is set for * review * @param neverReview whether the web content article is not set for review * @param indexable whether the web content article is searchable * @param articleURL the web content article's accessible URL * @param serviceContext the service context to be applied. Can set the * UUID, creation date, modification date, expando bridge * attributes, guest permissions, group permissions, asset category * IDs, asset tag names, asset link entry IDs, asset priority, URL * title, and workflow actions for the web content article. Can also * set whether to add the default guest and group permissions. * @return the web content article */ @Override public JournalArticle addArticle(long groupId, long folderId, long classNameId, long classPK, String articleId, boolean autoArticleId, Map<Locale, String> titleMap, Map<Locale, String> descriptionMap, String content, String ddmStructureKey, String ddmTemplateKey, String layoutUuid, int displayDateMonth, int displayDateDay, int displayDateYear, int displayDateHour, int displayDateMinute, int expirationDateMonth, int expirationDateDay, int expirationDateYear, int expirationDateHour, int expirationDateMinute, boolean neverExpire, int reviewDateMonth, int reviewDateDay, int reviewDateYear, int reviewDateHour, int reviewDateMinute, boolean neverReview, boolean indexable, String articleURL, ServiceContext serviceContext) throws PortalException { JournalFolderPermission.check(getPermissionChecker(), groupId, folderId, ActionKeys.ADD_ARTICLE); return journalArticleLocalService.addArticle(getUserId(), groupId, folderId, classNameId, classPK, articleId, autoArticleId, JournalArticleConstants.VERSION_DEFAULT, titleMap, descriptionMap, content, ddmStructureKey, ddmTemplateKey, layoutUuid, displayDateMonth, displayDateDay, displayDateYear, displayDateHour, displayDateMinute, expirationDateMonth, expirationDateDay, expirationDateYear, expirationDateHour, expirationDateMinute, neverExpire, reviewDateMonth, reviewDateDay, reviewDateYear, reviewDateHour, reviewDateMinute, neverReview, indexable, false, null, null, null, articleURL, serviceContext); }
From source file:com.liferay.journal.service.impl.JournalArticleServiceImpl.java
License:Open Source License
/** * Copies the web content article matching the group, article ID, and * version. This method creates a new article, extracting all the values * from the old one and updating its article ID. * * @param groupId the primary key of the web content article's group * @param oldArticleId the primary key of the old web content article * @param newArticleId the primary key of the new web content article * @param autoArticleId whether to auto-generate the web content article ID * @param version the web content article's version * @return the new web content article//from w w w. ja v a 2s . c o m */ @Override public JournalArticle copyArticle(long groupId, String oldArticleId, String newArticleId, boolean autoArticleId, double version) throws PortalException { JournalArticle article = getArticle(groupId, oldArticleId); JournalFolderPermission.check(getPermissionChecker(), groupId, article.getFolderId(), ActionKeys.ADD_ARTICLE); return journalArticleLocalService.copyArticle(getUserId(), groupId, oldArticleId, newArticleId, autoArticleId, version); }
From source file:com.liferay.journal.service.impl.JournalArticleServiceImpl.java
License:Open Source License
/** * Moves all versions of the web content article matching the group and * article ID to the folder.//from w ww .java 2 s . co m * * @param groupId the primary key of the web content article's group * @param articleId the primary key of the web content article * @param newFolderId the primary key of the web content article's new * folder * @param serviceContext the service context to be applied. Can set the user * ID, language ID, portlet preferences, portlet request, portlet * response, theme display, and can set whether to add the default * command update for the web content article. With respect to social * activities, by setting the service context's command to {@link * com.liferay.portal.kernel.util.Constants#UPDATE}, the invocation * is considered a web content update activity; otherwise it is * considered a web content add activity. */ @Override public void moveArticle(long groupId, String articleId, long newFolderId, ServiceContext serviceContext) throws PortalException { JournalFolderPermission.check(getPermissionChecker(), groupId, newFolderId, ActionKeys.ADD_ARTICLE); JournalArticle article = journalArticleLocalService.getArticle(groupId, articleId); JournalArticlePermission.check(getPermissionChecker(), article, ActionKeys.UPDATE); journalArticleLocalService.moveArticle(groupId, articleId, newFolderId, serviceContext); }
From source file:com.liferay.journal.web.asset.JournalArticleAssetRendererFactory.java
License:Open Source License
@Override public boolean hasAddPermission(PermissionChecker permissionChecker, long groupId, long classTypeId) throws Exception { if (classTypeId == 0) { return false; }//from w ww . j av a2s. c o m if (!DDMStructurePermission.contains(permissionChecker, classTypeId, ActionKeys.VIEW)) { return false; } return JournalPermission.contains(permissionChecker, groupId, ActionKeys.ADD_ARTICLE); }
From source file:com.liferay.journal.web.internal.upload.ImageJournalUploadFileEntryHandler.java
License:Open Source License
private void _checkPermission(long groupId, PermissionChecker permissionChecker) throws PortalException { boolean containsResourcePermission = ResourcePermissionCheckerUtil.containsResourcePermission( permissionChecker, JournalPermission.RESOURCE_NAME, groupId, ActionKeys.ADD_ARTICLE); if (!containsResourcePermission) { throw new PrincipalException.MustHavePermission(permissionChecker, JournalPermission.RESOURCE_NAME, groupId, ActionKeys.ADD_ARTICLE); }/* ww w. java2 s.c o m*/ }
From source file:com.liferay.journal.web.internal.upload.ImageJournalUploadHandler.java
License:Open Source License
@Override protected void checkPermission(long groupId, long folderId, PermissionChecker permissionChecker) throws PortalException { boolean containsResourcePermission = ResourcePermissionCheckerUtil.containsResourcePermission( permissionChecker, JournalPermission.RESOURCE_NAME, groupId, ActionKeys.ADD_ARTICLE); if (!containsResourcePermission) { throw new PrincipalException.MustHavePermission(permissionChecker, JournalPermission.RESOURCE_NAME, groupId, ActionKeys.ADD_ARTICLE); }/*w w w. j a va 2s .com*/ }