List of usage examples for com.liferay.portal.kernel.security.permission ActionKeys ADD_CATEGORY
String ADD_CATEGORY
To view the source code for com.liferay.portal.kernel.security.permission ActionKeys ADD_CATEGORY.
Click Source Link
From source file:com.liferay.asset.categories.admin.web.internal.display.context.AssetCategoriesDisplayContext.java
License:Open Source License
public boolean isShowCategoriesAddButton() { ThemeDisplay themeDisplay = (ThemeDisplay) _request.getAttribute(WebKeys.THEME_DISPLAY); if (AssetCategoriesPermission.contains(themeDisplay.getPermissionChecker(), AssetCategoriesPermission.RESOURCE_NAME, AssetCategoriesAdminPortletKeys.ASSET_CATEGORIES_ADMIN, themeDisplay.getSiteGroupId(), ActionKeys.ADD_CATEGORY)) { return true; }// w w w . j a va 2 s . co m return false; }
From source file:com.liferay.message.boards.internal.service.permission.MBCategoryPermission.java
License:Open Source License
private boolean _contains(PermissionChecker permissionChecker, long groupId, long categoryId, String actionId) throws PortalException { if (_mbBanLocalService.hasBan(groupId, permissionChecker.getUserId())) { return false; }/* w w w .j a va2s . co m*/ if ((categoryId == MBCategoryConstants.DEFAULT_PARENT_CATEGORY_ID) || (categoryId == MBCategoryConstants.DISCUSSION_CATEGORY_ID)) { return MBPermission.contains(permissionChecker, groupId, actionId); } MBCategory category = _mbCategoryLocalService.getCategory(categoryId); if (actionId.equals(ActionKeys.ADD_CATEGORY)) { actionId = ActionKeys.ADD_SUBCATEGORY; } String portletId = PortletProviderUtil.getPortletId(MBCategory.class.getName(), PortletProvider.Action.EDIT); Boolean hasPermission = _stagingPermission.hasPermission(permissionChecker, category.getGroupId(), MBCategory.class.getName(), category.getCategoryId(), portletId, actionId); if (hasPermission != null) { return hasPermission.booleanValue(); } if (actionId.equals(ActionKeys.VIEW) && PropsValues.PERMISSIONS_VIEW_DYNAMIC_INHERITANCE) { try { while (categoryId != MBCategoryConstants.DEFAULT_PARENT_CATEGORY_ID) { category = _mbCategoryLocalService.getCategory(categoryId); if (!_hasPermission(permissionChecker, category, actionId)) { return false; } categoryId = category.getParentCategoryId(); } } catch (NoSuchCategoryException nsce) { if (!category.isInTrash()) { throw nsce; } } return MBPermission.contains(permissionChecker, category.getGroupId(), actionId); } return _hasPermission(permissionChecker, category, actionId); }
From source file:com.liferay.message.boards.internal.trash.MBCategoryTrashHandler.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 MBCategoryPermission.contains(permissionChecker, groupId, classPK, ActionKeys.ADD_CATEGORY); }/*from ww w . j a v a 2 s. c om*/ return super.hasTrashPermission(permissionChecker, groupId, classPK, trashActionId); }