function can
can(
payload: AuthPayload,
permission: Permission
): boolean

Checks whether the caller's role grants permission. The role is the live one authenticate put in the payload, not the token's.

Parameters

payload: AuthPayload
permission: Permission

Return Type

boolean

Usage

import { can } from "api/lib/permissions.ts";