UNPKG

@pagamio/frontend-commons-lib

Version:

Pagamio library for Frontend reusable components like the form engine and table container

40 lines (39 loc) 976 B
/** * Role-Based Access Control (RBAC) types */ /** * Configuration mapping roles to permissions */ export interface RBACConfig<P> { [role: string]: P[]; } /** * Generic user interface that can be extended by specific applications. * Optionally supports multiple roles via the `roleNames` property. */ export interface RBACUser { [key: string]: unknown; roleNames?: string[]; } /** * RBAC configuration options. * Supports both single-role and multi-role users. */ export interface RBACOptions<P, U extends RBACUser = RBACUser> { /** * Configuration mapping roles to permissions */ rbacConfig: RBACConfig<P>; /** * The permission value that represents "ALL permissions" */ allPermissionValue: P; /** * Array of all available permissions */ allPermissions: P[]; /** * The key in the user object that contains the role(s) - can be a string or array of strings */ roleKey?: keyof U; }