nuxt-authorization
Version:
Authorization module for managing permissions on the Nuxt app and the Nitro server.
15 lines (14 loc) • 866 B
TypeScript
import type { H3Event } from 'h3';
import type { BouncerAbility, BouncerArgs } from '../../../utils/index.js';
/**
* Allows a user to perform an action based on their role and the data.
*/
export declare function allows<Event extends H3Event, Ability extends BouncerAbility<any>>(event: Event, ability: Ability, ...args: BouncerArgs<Ability>): Promise<boolean>;
/**
* Denies a user to perform an action based on their role and the data.
*/
export declare function denies<Event extends H3Event, Ability extends BouncerAbility<any>>(event: Event, ability: Ability, ...args: BouncerArgs<Ability>): Promise<boolean>;
/**
* Throws an error if the user is not allowed to perform an action.
*/
export declare function authorize<Event extends H3Event, Ability extends BouncerAbility<any>>(event: Event, ability: Ability, ...args: BouncerArgs<Ability>): Promise<void>;