UNPKG

pagamio-frontend-commons-lib

Version:

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

45 lines (44 loc) 2.12 kB
import type { RBACOptions, RBACUser } from './types'; /** * Initialize the RBAC system with configuration * @param options - RBAC configuration options */ export declare const initializeRBAC: <P, U extends RBACUser = RBACUser>(options: RBACOptions<P, U>) => void; /** * Check if a user has a specific permission * @param user - The user object to check permissions for * @param permission - The permission to check * @returns boolean indicating if the user has the permission */ export declare const hasPermission: <P, U extends RBACUser = RBACUser>(user: U | null, permission: P) => boolean; /** * Check if a user has any of the specified permissions * @param user - The user object to check permissions for * @param permissions - Array of permissions to check * @returns boolean indicating if the user has any of the permissions */ export declare const hasAnyPermission: <P, U extends RBACUser = RBACUser>(user: U | null, permissions: P[]) => boolean; /** * Check if a user has all of the specified permissions * @param user - The user object to check permissions for * @param permissions - Array of permissions to check * @returns boolean indicating if the user has all of the permissions */ export declare const hasAllPermissions: <P, U extends RBACUser = RBACUser>(user: U | null, permissions: P[]) => boolean; /** * Get all permissions for a user (union of all roles' permissions) * @param user - The user object to get permissions for * @returns Array of permissions the user has */ export declare const getUserPermissions: <P, U extends RBACUser = RBACUser>(user: U | null) => P[]; /** * Check if a user has a specific role (matches any of their roles) * @param user - The user object to check role for * @param roleName - The role name to check against * @returns boolean indicating if the user has the specified role */ export declare const hasRole: <U extends RBACUser = RBACUser>(user: U | null, roleName: string) => boolean; /** * Check if a user has access to IQ Retail */ export declare const hasIQRetailAccess: <P, U extends RBACUser = RBACUser>(user: U | null) => boolean;