• Is admin validator

    Parameters

    • authSecrets: AuthSecrets

      authentication secrets

    • authenticate: AuthenticationFunction

      injected function use to authenticate the user token

    • userService: UserDataService

      injected service use to handle the user related operations

      • getUserById
    • 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 will check if user is admin by applying the following steps in sequence:

    1. Authenticate user token (authenticate)

    2. Check if appId exist in token, if exist return 200 else continue

    3. Get user by id (userService.getUserById)

    4. Check if user is admin

    5. Return check result

    Throws

    401 NBError Unauthorized

    • error parsing user token ${error.message}

    Throws

    403 NBError Forbidden

    • user is not admin user

    Throws

    404 NBError Not Found

    • user not found

Generated using TypeDoc