• Check if user have permission to update the product Some product fields can only be updated by super admin

    Parameters

    • userAuth: {
          adminOnlyFields: string[];
          authSecrets: AuthSecrets;
          authenticate: AuthenticationFunction;
          userAPI: UserDefaultAdapterAPI;
      }

      adminOnlyFields the fields that only super user can edit

      • authSecrets authenticate secrets
      • authenticate authenticate function
      • userAPI user api
      • adminOnlyFields: string[]
      • authSecrets: AuthSecrets
      • authenticate: AuthenticationFunction
      • userAPI: UserDefaultAdapterAPI
    • 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 super admin by applying the following steps in sequence:

    1. if the user is not changing the promotion status, then skip this validation

    2. Authenticate the user token (authenticate)

    3. Get the fieldValue from the context

    4. Check if the user is super admin

    Throws

    401 NBError Unauthorized

    • error parsing user token
    • invalid user token type

    Throws

    403 NBError Forbidden

    • user type is not allowed to edit field

Generated using TypeDoc