@jay-js/system
Version:
A powerful and flexible TypeScript library for UI, state management, lazy loading, routing and managing draggable elements in modern web applications.
25 lines (24 loc) • 763 B
TypeScript
/**
* Permission definition functionality
*
* Provides utilities for defining permissions in a structured way.
*
* @module @jay-js/system/guard/core/define
*/
import type { TDefinePermission } from "../types";
/**
* Defines permissions for a role and subject
*
* @param role - The role or roles that the permissions apply to
* @param subject - The subject that the permissions apply to
* @returns A permission definition object with methods to allow or forbid actions
*
* @example
* ```ts
* const userPermissions = definePermissions('user', 'articles')
* .allow(['read', 'comment'])
* .forbid(['edit', 'delete'])
* .save();
* ```
*/
export declare function definePermissions(role: string | string[], subject: string): TDefinePermission;