• Is user organization owner or admin validator

    Parameters

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

      injected config use to get authSecrets and authenticate

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

      injected targetField use to get orgId

    • organizationAPI: OrganizationDefaultAdapterAPI

      injected API use to handle organization related operations

    • logger: Logger

      injected logger use to handle logging

    • context: AdapterHandlerContext

      request context [headers, body, params, query].

    Returns Promise<number>

    200 Status OK

    Description

    This validator checks if the user is organization owner or admin by applying the following steps in sequence:

    1. Get orgId from targetField context

    2. Check if orgId is provided

    3. Check if user is organization owner or admin

    Throws

    400 NBError Bad Request

    • orgId have to be specified in ${targetField.type} ${targetField.name}

    Throws

    401 NBError Unauthorized

    • authenticate error

    Throws

    403 NBError Forbidden

    • User don't have a proper organization role to execute the operation

Generated using TypeDoc