List of usage examples for com.liferay.portal.kernel.util PropsKeys PERMISSIONS_VIEW_DYNAMIC_INHERITANCE
String PERMISSIONS_VIEW_DYNAMIC_INHERITANCE
To view the source code for com.liferay.portal.kernel.util PropsKeys PERMISSIONS_VIEW_DYNAMIC_INHERITANCE.
Click Source Link
From source file:com.cd.learning.hook.MBCategoryPermission.java
License:Open Source License
public static boolean contains(PermissionChecker permissionChecker, MBCategory category, String actionId) throws PortalException, SystemException { if (MBBanLocalServiceUtil.hasBan(category.getGroupId(), permissionChecker.getUserId())) { return false; }/* w w w . j ava 2 s.c om*/ if (actionId.equals(ActionKeys.ADD_CATEGORY)) { actionId = ActionKeys.ADD_SUBCATEGORY; } Boolean hasPermission = StagingPermissionUtil.hasPermission(permissionChecker, category.getGroupId(), MBCategory.class.getName(), category.getCategoryId(), PortletKeys.MESSAGE_BOARDS, actionId); if (hasPermission != null) { return hasPermission.booleanValue(); } if (actionId.equals(ActionKeys.VIEW) && GetterUtil.getBoolean(PropsUtil.get(PropsKeys.PERMISSIONS_VIEW_DYNAMIC_INHERITANCE))) { try { long categoryId = category.getCategoryId(); while (categoryId != MBCategoryConstants.DEFAULT_PARENT_CATEGORY_ID) { category = MBCategoryLocalServiceUtil.getCategory(categoryId); if (!_hasPermission(permissionChecker, category, actionId)) { return false; } categoryId = category.getParentCategoryId(); } } catch (NoSuchCategoryException nsce) { if (!category.isInTrash()) { throw nsce; } } return true; } return _hasPermission(permissionChecker, category, actionId); }
From source file:com.cd.learning.hook.MBMessagePermission.java
License:Open Source License
public static boolean contains(PermissionChecker permissionChecker, MBMessage message, String actionId) throws PortalException, SystemException { if (MBBanLocalServiceUtil.hasBan(message.getGroupId(), permissionChecker.getUserId())) { return false; }//from w ww .j a va 2 s . co m Boolean hasPermission = StagingPermissionUtil.hasPermission(permissionChecker, message.getGroupId(), MBMessage.class.getName(), message.getMessageId(), PortletKeys.MESSAGE_BOARDS, actionId); if (hasPermission != null) { return hasPermission.booleanValue(); } if (message.isDraft() || message.isScheduled()) { if (actionId.equals(ActionKeys.VIEW) && !contains(permissionChecker, message, ActionKeys.UPDATE)) { return false; } } else if (message.isPending()) { hasPermission = WorkflowPermissionUtil.hasPermission(permissionChecker, message.getGroupId(), message.getWorkflowClassName(), message.getMessageId(), actionId); if (hasPermission != null) { return hasPermission.booleanValue(); } } if (actionId.equals(ActionKeys.VIEW) && GetterUtil.getBoolean(PropsUtil.get(PropsKeys.PERMISSIONS_VIEW_DYNAMIC_INHERITANCE))) { long categoryId = message.getCategoryId(); if ((categoryId != MBCategoryConstants.DEFAULT_PARENT_CATEGORY_ID) && (categoryId != MBCategoryConstants.DISCUSSION_CATEGORY_ID)) { try { MBCategory category = MBCategoryLocalServiceUtil.getCategory(categoryId); if (!MBCategoryPermission.contains(permissionChecker, category, actionId)) { return false; } } catch (NoSuchCategoryException nsce) { if (!message.isInTrash()) { throw nsce; } } } } if (permissionChecker.hasOwnerPermission(message.getCompanyId(), MBMessage.class.getName(), message.getRootMessageId(), message.getUserId(), actionId)) { return true; } return permissionChecker.hasPermission(message.getGroupId(), MBMessage.class.getName(), message.getMessageId(), actionId); }
From source file:com.liferay.shopping.service.permission.ShoppingCategoryPermission.java
License:Open Source License
public static boolean contains(PermissionChecker permissionChecker, ShoppingCategory category, String actionId) throws PortalException, SystemException { if (actionId.equals(ActionKeys.ADD_CATEGORY)) { actionId = ActionKeys.ADD_SUBCATEGORY; }//from w w w . java 2s .co m long categoryId = category.getCategoryId(); if (actionId.equals(ActionKeys.VIEW)) { while (categoryId != ShoppingCategoryConstants.DEFAULT_PARENT_CATEGORY_ID) { category = ShoppingCategoryLocalServiceUtil.getCategory(categoryId); categoryId = category.getParentCategoryId(); if (!permissionChecker.hasOwnerPermission(category.getCompanyId(), ShoppingCategory.class.getName(), category.getCategoryId(), category.getUserId(), actionId) && !permissionChecker.hasPermission(category.getGroupId(), ShoppingCategory.class.getName(), category.getCategoryId(), actionId)) { return false; } if (!GetterUtil.getBoolean(PropsUtil.get(PropsKeys.PERMISSIONS_VIEW_DYNAMIC_INHERITANCE))) { break; } } return true; } else { while (categoryId != ShoppingCategoryConstants.DEFAULT_PARENT_CATEGORY_ID) { category = ShoppingCategoryLocalServiceUtil.getCategory(categoryId); categoryId = category.getParentCategoryId(); if (permissionChecker.hasOwnerPermission(category.getCompanyId(), ShoppingCategory.class.getName(), category.getCategoryId(), category.getUserId(), actionId)) { return true; } if (permissionChecker.hasPermission(category.getGroupId(), ShoppingCategory.class.getName(), category.getCategoryId(), actionId)) { return true; } if (actionId.equals(ActionKeys.VIEW)) { break; } } return false; } }
From source file:com.liferay.shopping.service.permission.ShoppingItemPermission.java
License:Open Source License
public static boolean contains(PermissionChecker permissionChecker, ShoppingItem item, String actionId) throws PortalException, SystemException { if (GetterUtil.getBoolean(PropsUtil.get(PropsKeys.PERMISSIONS_VIEW_DYNAMIC_INHERITANCE))) { if (item.getCategoryId() != ShoppingCategoryConstants.DEFAULT_PARENT_CATEGORY_ID) { ShoppingCategory category = item.getCategory(); if (!ShoppingCategoryPermission.contains(permissionChecker, category, ActionKeys.VIEW)) { return false; }/*from w w w .j a v a 2 s .c om*/ } } if (permissionChecker.hasOwnerPermission(item.getCompanyId(), ShoppingItem.class.getName(), item.getItemId(), item.getUserId(), actionId)) { return true; } return permissionChecker.hasPermission(item.getGroupId(), ShoppingItem.class.getName(), item.getItemId(), actionId); }