Stone.js API
    Preparing search index...

    Interface IAuthorizer<UserType>

    The authorization service contract.

    interface IAuthorizer<UserType = unknown> {
        abilityFor: (user: UserType) => AppAbility;
        authorize: (
            user: UserType,
            action: string,
            subject: Subject,
            field?: string,
        ) => void;
        can: (
            user: UserType,
            action: string,
            subject: Subject,
            field?: string,
        ) => boolean;
        cannot: (
            user: UserType,
            action: string,
            subject: Subject,
            field?: string,
        ) => boolean;
    }

    Type Parameters

    • UserType = unknown

    Implemented by

    Index
    abilityFor: (user: UserType) => AppAbility

    Build the ability for a principal.

    authorize: (
        user: UserType,
        action: string,
        subject: Subject,
        field?: string,
    ) => void

    Assert the principal may perform action on subject, or throw.

    can: (
        user: UserType,
        action: string,
        subject: Subject,
        field?: string,
    ) => boolean

    Whether the principal may perform action on subject.

    cannot: (
        user: UserType,
        action: string,
        subject: Subject,
        field?: string,
    ) => boolean

    Whether the principal may NOT perform action on subject.