• Is user in organization roles validator

    Parameters

    • roles: string[]

      organization roles

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

      authenticate config

      • authSecrets: AuthSecrets
      • authenticate: AuthenticationFunction
    • targetField: TargetField

      which field to get the orgId from context

    • organizationAPI: OrganizationDefaultAdapterAPI

      organization api

    • 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 in organization roles by applying the following steps in sequence:

    1. Get the orgId from the context

    2. Authenticate the user token (authenticate)

    3. Get user organization list (organizationAPI.getUserOrganizations)

    4. Check if the user is in the organization roles

    Throws

    401 NBError Unauthorized

    • failed when authenticate

    Throws

    403 NBError Forbidden

    • user role is not match the expected

Generated using TypeDoc