Documentation
    Preparing search index...

    Interface RbacRequestContext

    Scoped helper context exposed to controllers and request handlers.

    interface RbacRequestContext {
        canAccessRoute: (
            uri: string,
            action?:
                | "READ"
                | "WRITE"
                | "CREATE"
                | "UPDATE"
                | "DELETE"
                | "EXECUTE"
                | "MANAGE"
                | "*"
                | "GET"
                | "POST"
                | "PUT"
                | "PATCH"
                | "OPTIONS"
                | "HEAD",
        ) => boolean;
        getFieldMode: (entity: string, property: string) => FieldAccessMode;
        isFieldEditable: (entity: string, property: string) => boolean;
        isFieldVisible: (entity: string, property: string) => boolean;
        sanitizeRead: <T extends Record<string, any>>(
            entity: string,
            data: T,
        ) => Partial<T>;
        sanitizeWrite: <T extends Record<string, any>>(
            entity: string,
            data: T,
        ) => Partial<T>;
        user: RbacUserContext | null;
    }
    Index

    Properties

    canAccessRoute: (
        uri: string,
        action?:
            | "READ"
            | "WRITE"
            | "CREATE"
            | "UPDATE"
            | "DELETE"
            | "EXECUTE"
            | "MANAGE"
            | "*"
            | "GET"
            | "POST"
            | "PUT"
            | "PATCH"
            | "OPTIONS"
            | "HEAD",
    ) => boolean

    Evaluates route permission for a given URI and action/method

    getFieldMode: (entity: string, property: string) => FieldAccessMode

    Returns the calculated field access mode ('hidden' | 'readonly' | 'readwrite')

    isFieldEditable: (entity: string, property: string) => boolean

    Returns true if the field is editable ('readwrite')

    isFieldVisible: (entity: string, property: string) => boolean

    Returns true if the field is visible (not 'hidden')

    sanitizeRead: <T extends Record<string, any>>(
        entity: string,
        data: T,
    ) => Partial<T>

    Strips 'hidden' fields from outgoing read payloads

    sanitizeWrite: <T extends Record<string, any>>(
        entity: string,
        data: T,
    ) => Partial<T>

    Strips 'hidden' and 'readonly' fields from incoming write payloads

    user: RbacUserContext | null

    Current authenticated user context (null if unauthenticated)