Checks the signed-in user's permissions, for the pages and components that hide what the server would refuse.

Functions

f
can(
user: Pick<PublicUser, "role"> | null | undefined,
permission: Permission
): boolean

Checks whether user has permission. A null user, for the signed out, has none. The server checks again, so this only decides what to show.

Usage

import * as mod from "src/utils/auth/permissions.ts";