• Has super admin only field validator

    Parameters

    • userAuth: {
          authSecrets: AuthSecrets;
          authenticate: AuthenticationFunction;
          targetField: TargetField;
          userAPI: UserDefaultAdapterAPI;
      }

      authSecrets authenticate secrets

      • authenticate authenticate function
      • targetField which field to get the fieldValue from context
      • userAPI user api
      • authSecrets: AuthSecrets
      • authenticate: AuthenticationFunction
      • targetField: TargetField
      • 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