Interface IPermitClient

Hierarchy

  • IEnforcer
    • IPermitClient

Implemented by

Properties

Access the Permit REST API using this property.

Access the SDK configuration using this property. Once the SDK is initialized, the configuration is read-only.

Access the Permit Elements API using this property.

Methods

  • Checks multiple requests within the specified context.

    Parameters

    • checks: ICheckQuery[]

      The check requests.

    • Optional context: Context

      The context object representing the context in which the action is performed.

    • Optional config: CheckConfig

    Returns Promise<boolean[]>

    array containing true if the user is authorized, false otherwise for each check request.

    Throws

    PermitConnectionError if an error occurs while sending the authorization request to the PDP.

    Throws

    PermitPDPStatusError if received a response with unexpected status code from the PDP.

  • Checks if a user is authorized to perform an action on a resource within the specified context.

    Parameters

    • user: string | IUser

      The user object representing the user.

    • action: string

      The action to be performed on the resource.

    • resource: string | IResource

      The resource object representing the resource.

    • Optional context: Context

      The context object representing the context in which the action is performed.

    • Optional config: CheckConfig

    Returns Promise<boolean>

    true if the user is authorized, false otherwise.

    Throws

    PermitConnectionError if an error occurs while sending the authorization request to the PDP.

    Throws

    PermitPDPStatusError if received a response with unexpected status code from the PDP.

  • Get all tenants available in the system.

    Parameters

    • user: string | IUser
    • action: string
    • resource: string | IResource
    • context: undefined | Context
    • sdk: undefined | string

    Returns Promise<TenantDetails[]>

    An array of TenantDetails representing all tenants.

  • Get all permissions for the specified user.

    Parameters

    • user: string | IUser

      The user object representing the user.

    • Optional tenants: string[]

      The list of tenants to filter the permissions on ( given by roles ).

    • Optional resources: string[]

      The list of resources to filter the permissions on ( given by resource roles ).

    • Optional resource_types: string[]

      The list of resource types to filter the permissions on ( given by resource roles ).

    • Optional config: CheckConfig

    Returns Promise<IUserPermissions>

    object with key as the resource identifier and value as the resource details and permissions.

    Throws

    PermitConnectionError if an error occurs while sending the authorization request to the PDP.

    Throws

    PermitPDPStatusError if received a response with unexpected status code from the PDP.

Generated using TypeDoc