• Is user organization validator

    Parameters

    • authSecrets: AuthSecrets

      authenticate secret

    • authenticate: AuthenticationFunction

      injected authenticate function

    • organizationAPI: Pick<OrganizationDefaultAdapterAPI, "getUserOrganizations">

      injected API use to handle the organization related operations

      • getUserOrganizations
    • options: {
          allowEmpty?: boolean;
          targetField: TargetField;
      }
      • Optional allowEmpty?: boolean

        allow empty orgId (return 200)

      • targetField: TargetField

        which field to get the organization id from

    • 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 checks if the user is in the organization by applying the following steps in sequence:

    1. Authenticate the user (authenticate)

    2. Get user organizations (organizationAPI.getUserOrganizations)

    3. Check if the user is in the organization

    Throws

    401 NBError Unauthorized

    • user do not have permission to use this message template

    Throws

    403 NBError Forbidden

    • user not found

    Throws

    404 NBError Not Found

    • message template not found

Generated using TypeDoc