Interface BaseJobWorkerContext<J>

Context object for base service methods.

interface BaseJobWorkerContext<J extends Job = Job> {
    isSilent?: boolean;
    job: J;
    requestId?: string;
    transaction?: EntityManager;
    user: CurrentUser;
    isGranted(
        action: string,
        actionScopes?: ActionScopes | ActionScopesArray,
    ): boolean;
    validateAccess(
        action: string,
        scopes?: ActionScopes | ActionScopesArray,
    ): void;
}

Type Parameters

Hierarchy (View Summary)

Properties

isSilent?: boolean

Make the request silent, meaning no notifications and actions will be sent.

job: J
requestId?: string

An optional request ID.

transaction?: EntityManager

Check permission and throw AccessDenied error if user doesn't have permission

action string

scopes where action was executed

AccessDenied error if the user doesn't have the permission

The current user making the request.

Methods

  • Checks if the user has permission to perform the specified action.

    Parameters

    • action: string

      The action to check permission for.

    • OptionalactionScopes: ActionScopes | ActionScopesArray

      Optional scopes to check permission against.

    Returns boolean

    True if the user has permission, false otherwise.

  • Check permission and throw AccessDenied error if user doesn't have permission

    Parameters

    • action: string

      action string

    • Optionalscopes: ActionScopes | ActionScopesArray

      scopes where action was executed

    Returns void

    AccessDenied error if the user doesn't have the permission