• Is user normal organization owner or admin for product id field validator

    Parameters

    • config: {
          authSecrets: AuthSecrets;
          authenticate: AuthenticationFunction;
      }

      authenticate config

      • authSecrets: AuthSecrets
      • authenticate: AuthenticationFunction
    • productIdArrayField: TargetField

      which field to get the productIdObjects from context

    • productService: ProductDataService

      injected service used to handle the catalog related operations

    • organizationAPI: OrganizationDefaultAdapterAPI

      injected API used to handle the organization related operations

    • logger: Logger

      injected logger used to handle the logging

    • context: AdapterHandlerContext

      request context [headers, body, params, query].

    Returns Promise<number>

    200 Status Ok

    Description

    This validator is used to check if the user is normal organization owner or admin for product id field by applying the following steps in sequence:

    1. Get the productIdObjects from the context

    2. Extract the productId from the productIdObjects

    3. Check if the user is the owner or admin for the products (isUserNormalOrganizationOwnerOrAdminForProductIds)

    Throws

    500 NBError Internal server error

    • ${productIdArrayField.type} is not an array of objects
    • ProductId cannot be found in ${productIdArrayField.type}.${index}.${productIdArrayField.name}

    Remarks

    There is a potential performance issue if this is performed over many organizations. Limit the amount of organizations per product to guarantee good performance.

Generated using TypeDoc