• Does organization have any topic permission validator

    Parameters

    • chatService: ChatDataService

      injected service use to handle the chat related operations

      • getOneTopic
      • getSubscriptions
    • options: {
          organizationIdField: TargetField;
          permissions: string[];
          topicIdField: TargetField;
      }

      Option

      • organizationIdField which field to get the organization id from
      • permissions which permissions to check
      • topicIdField which field to get the topic id from
      • organizationIdField: TargetField
      • permissions: string[]
      • topicIdField: TargetField
    • 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 an organizationId has any topic permission by applying the following steps in sequence:

    1. Get organization from context

    2. Get topic by id (chatService.getOneTopic)

    3. Get subscriptions by topicId, organizationId and permissions (chatService.getSubscriptions)

    4. Return 200 if the organization has any topic permission

    Throws

    403 NBError Forbidden

    • organizationId: organizationId not provided.
    • organization not subscribed to the topic: ${topicId}

    Throws

    404 NBError Not Found

    • topic: ${topicId} not found.

Generated using TypeDoc