@pagamio/frontend-commons-lib
Version:
Pagamio library for Frontend reusable components like the form engine and table container
40 lines (39 loc) • 1.79 kB
TypeScript
import type { RBACUser } from './types';
/**
* Hook wrapper for hasPermission
* @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 useHasPermission: <P, U extends RBACUser = RBACUser>(user: U | null, permission: P) => boolean;
/**
* Hook wrapper for hasRole
* @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 useHasRole: <U extends RBACUser = RBACUser>(user: U | null, roleName: string) => boolean;
/**
* Hook wrapper for hasAnyPermission
* @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 useHasAnyPermission: <P, U extends RBACUser = RBACUser>(user: U | null, permissions: P[]) => boolean;
/**
* Hook wrapper for hasAllPermissions
* @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 useHasAllPermissions: <P, U extends RBACUser = RBACUser>(user: U | null, permissions: P[]) => boolean;
/**
* Hook wrapper for getUserPermissions
* @param user - The user object to get permissions for
* @returns Array of permissions the user has
*/
export declare const useGetUserPermissions: <P, U extends RBACUser = RBACUser>(user: U | null) => P[];
/**
* Hook wrapper for IQ Retail access
*/
export declare const useHasIQRetailAccess: <P, U extends RBACUser = RBACUser>(user: U | null) => boolean;