• Is user in organization validator

    Parameters

    • authSecrets: AuthSecrets

      authentication secrets

    • authenticate: AuthenticationFunction

      injected function use to authenticate the user token

    • targetField: TargetField

      target field to get the org id

    • organizationAPI: OrganizationDefaultAdapterAPI

      injected api use to handle the organization related operations

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

    1. Get the orgId from context

    2. Authenticate the request

    3. Get the user organizations (organizationAPI.getUserOrganizations)

    4. Check if the user is in the organization

    5. Return the status code

    Throws

    400 NBError Bad Request

    • cannot found parameter in ${targetField.type} ${targetField.name}

    Throws

    401 NBError Unauthorized

    • failed when authenticate

    Throws

    403 NBError Forbidden

    • user role is not match the expected

Generated using TypeDoc