コード例 #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);
  }
コード例 #2
0
  public ShoppingItem[] getItemsPrevAndNext(long itemId, OrderByComparator obc)
      throws PortalException, SystemException {

    ShoppingItem item = shoppingItemPersistence.findByPrimaryKey(itemId);

    return shoppingItemPersistence.findByG_C_PrevAndNext(
        item.getItemId(), item.getGroupId(), item.getCategoryId(), obc);
  }
コード例 #3
0
  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);
  }
コード例 #4
0
  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);
  }
コード例 #5
0
  protected long getCategory(ShoppingItem item, long categoryId) throws SystemException {

    if ((item.getCategoryId() != categoryId)
        && (categoryId != ShoppingCategoryConstants.DEFAULT_PARENT_CATEGORY_ID)) {

      ShoppingCategory newCategory = shoppingCategoryPersistence.fetchByPrimaryKey(categoryId);

      if ((newCategory == null) || (item.getGroupId() != newCategory.getGroupId())) {

        categoryId = item.getCategoryId();
      }
    }

    return categoryId;
  }