Class TenantsApi

The TenantsApi class provides methods for interacting with Permit Tenants.

Hierarchy

  • BaseFactsPermitAPI
    • TenantsApi

Implements

Constructors

  • Creates an instance of the TenantsApi.

    Parameters

    • config: IPermitConfig

      The configuration object for the Permit SDK.

    • logger: Logger<LoggerOptions>

      The logger instance for logging.

    Returns TenantsApi

Methods

  • Deletes a tenant.

    Parameters

    • tenantKey: string

      The key of the tenant to delete.

    Returns Promise<void>

    A promise that resolves when the tenant is deleted.

    Throws

    PermitApiError If the API returns an error HTTP status code.

    Throws

    PermitContextError If the configured ApiContext does not match the required endpoint context.

  • Deletes a user from a given tenant (also removes all roles granted to the user in that tenant).

    Parameters

    • tenantKey: string

      The key of the tenant from which the user will be deleted.

    • userKey: string

      The key of the user to be deleted.

    Returns Promise<void>

    A promise that resolves when the user is successfully deleted.

    Throws

    PermitApiError If the API returns an error HTTP status code.

    Throws

    PermitContextError If the configured ApiContext does not match the required endpoint context.

  • Ensure that the API Key has the necessary permissions to successfully call the API endpoint. Note that this check is not foolproof, and the API may still throw 401.

    Parameters

    • requiredAccessLevel: ApiKeyLevel

      The required API Key Access level for the endpoint.

    Returns Promise<void>

    Throws

    PermitContextError If the currently set API key access level does not match the required access level.

  • Ensure that the API context matches the required endpoint context.

    Parameters

    • requiredContext: ApiContextLevel

      The required API context level for the endpoint.

    Returns Promise<void>

    Throws

    PermitContextError If the currently set API context level does not match the required context level.

  • Wait for the facts to be synchronized with the PDP. Available only when proxyFactsViaPdp is set to true.

    Parameters

    • timeout: null | number

      The maximum number of seconds to wait for the synchronization to complete. Set to null to wait indefinitely.

    Returns TenantsApi

Generated using TypeDoc