@Override
  public void addCategoryResources(
      ShoppingCategory category, String[] groupPermissions, String[] guestPermissions)
      throws PortalException, SystemException {

    resourceLocalService.addModelResources(
        category.getCompanyId(),
        category.getGroupId(),
        category.getUserId(),
        ShoppingCategory.class.getName(),
        category.getCategoryId(),
        groupPermissions,
        guestPermissions);
  }
  @Override
  public void addCategoryResources(
      ShoppingCategory category, boolean addGroupPermissions, boolean addGuestPermissions)
      throws PortalException, SystemException {

    resourceLocalService.addResources(
        category.getCompanyId(),
        category.getGroupId(),
        category.getUserId(),
        ShoppingCategory.class.getName(),
        category.getCategoryId(),
        false,
        addGroupPermissions,
        addGuestPermissions);
  }
コード例 #3
0
  public static JSONObject toJSONObject(ShoppingCategory model) {
    JSONObject jsonObj = new JSONObject();

    JSONUtil.put(jsonObj, "categoryId", model.getCategoryId());
    JSONUtil.put(jsonObj, "groupId", model.getGroupId());
    JSONUtil.put(jsonObj, "companyId", model.getCompanyId());
    JSONUtil.put(jsonObj, "userId", model.getUserId());
    JSONUtil.put(jsonObj, "userName", model.getUserName());
    JSONUtil.put(jsonObj, "createDate", model.getCreateDate());
    JSONUtil.put(jsonObj, "modifiedDate", model.getModifiedDate());
    JSONUtil.put(jsonObj, "parentCategoryId", model.getParentCategoryId());
    JSONUtil.put(jsonObj, "name", model.getName());
    JSONUtil.put(jsonObj, "description", model.getDescription());

    return jsonObj;
  }
コード例 #4
0
  private static boolean _hasPermission(
      PermissionChecker permissionChecker, ShoppingCategory category, String actionId) {

    if (permissionChecker.hasOwnerPermission(
            category.getCompanyId(),
            ShoppingCategory.class.getName(),
            category.getCategoryId(),
            category.getUserId(),
            actionId)
        || permissionChecker.hasPermission(
            category.getGroupId(),
            ShoppingCategory.class.getName(),
            category.getCategoryId(),
            actionId)) {

      return true;
    }

    return false;
  }