예제 #1
0
  public static boolean contains(
      PermissionChecker permissionChecker, ShoppingItem item, String actionId)
      throws PortalException, SystemException {

    if (PropsValues.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;
        }
      }
    }

    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);
  }
  public void addItemResources(
      ShoppingItem item, String[] groupPermissions, String[] guestPermissions)
      throws PortalException, SystemException {

    resourceLocalService.addModelResources(
        item.getCompanyId(),
        item.getGroupId(),
        item.getUserId(),
        ShoppingItem.class.getName(),
        item.getItemId(),
        groupPermissions,
        guestPermissions);
  }
  public void addItemResources(
      ShoppingItem item, boolean addGroupPermissions, boolean addGuestPermissions)
      throws PortalException, SystemException {

    resourceLocalService.addResources(
        item.getCompanyId(),
        item.getGroupId(),
        item.getUserId(),
        ShoppingItem.class.getName(),
        item.getItemId(),
        false,
        addGroupPermissions,
        addGuestPermissions);
  }