@foal/core
Version:
Full-featured Node.js framework, with no complexity
17 lines (16 loc) • 626 B
TypeScript
import { HookDecorator } from '../../../core';
/**
* Hook factory to check if a user can access a route based on their permissions.
*
* The `ctx.user` object must implement the `IUserWithPermissions` interface.
*
* @export
* @param {string} perm - The name of the permission.
* @param {{ redirect?: string }} [options={}] - Hook options.
* @param {string|undefined} options.redirect - Optional URL path to redirect users that
* do not have the right permission.
* @returns {HookDecorator} - The hook.
*/
export declare function PermissionRequired(perm: string, options?: {
redirect?: string;
}): HookDecorator;