Interface IBaseActionContext

GraphQL base action context Used for mutations and queries

interface IBaseActionContext {
    requestId: string;
    user: CurrentUser;
    isGranted(
        action: string,
        actionScopes?: ActionScopes | ActionScopesArray,
    ): boolean;
    validateAccess(
        action: string,
        scopes?: ActionScopes | ActionScopesArray,
    ): void;
}

Properties

requestId: string

Request ID Used for logging to track request

Current user who executes action

Methods

  • Check if current user from context has permission

    Parameters

    • action: string

      action string

    • OptionalactionScopes: ActionScopes | ActionScopesArray

      scopes where action was executed

    Returns boolean

  • 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