Class UsersApi

The UsersApi class provides methods for interacting with Permit Users.

Hierarchy

  • BaseFactsPermitAPI
    • UsersApi

Constructors

  • Creates an instance of the UsersApi.

    Parameters

    • config: IPermitConfig

      The configuration object for the Permit SDK.

    • logger: Logger<LoggerOptions>

      The logger instance for logging.

    Returns UsersApi

Methods

  • Creates users in bulk.

    Parameters

    • users: UserCreate[]

      The array of users to create.

    Returns Promise<UserCreateBulkOperation>

    A promise that resolves to the bulk creation result.

    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 users in bulk.

    Parameters

    • userKeys: string[]

      The array of user keys to delete.

    Returns Promise<UserDeleteBulkOperation>

    A promise that resolves to the bulk deletion result.

    Throws

    PermitApiError If the API returns an error HTTP status code.

    Throws

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

  • Replaces users in bulk.

    If a user exists, it will be replaced. Otherwise, it will be created.

    Parameters

    • users: UserCreate[]

      The array of users to replace.

    Returns Promise<UserReplaceBulkOperation>

    A promise that resolves to the bulk replacement result.

    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.

    Parameters

    • userKey: string

      The key of the user to delete.

    Returns Promise<void>

    A promise that resolves when the user 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.

  • 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.

  • Retrieves the roles assigned to a user in a given tenant (if the tenant filter is provided) or across all tenants (if the tenant filter in not provided).

    Parameters

    • roleFilters: IGetUserRoles

      The filters for retrieving role assignments.

    Returns Promise<RoleAssignmentRead[]>

    A promise that resolves with an array of role assignments for the user.

    Throws

    PermitApiError If the API returns an error HTTP status code.

    Throws

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

  • Unassigns a role from a user in the scope of a given tenant.

    Parameters

    Returns Promise<void>

    A promise that resolves when the role is successfully unassigned from the user.

    Throws

    PermitApiError If the API returns an error HTTP status code.

    Throws

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

Generated using TypeDoc