From 11e6c49e87419fba8547c0838b55a42adf95765e Mon Sep 17 00:00:00 2001 From: Alejandro Visiedo Date: Wed, 15 May 2024 18:39:20 +0200 Subject: [PATCH] feat(HMS-2721): add rbac to AppContext This change add the rbac checks to the app context, making them broadly available on the frontend application. Signed-off-by: Alejandro Visiedo --- src/AppContext.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/AppContext.tsx b/src/AppContext.tsx index b55b3eb..36c45c3 100644 --- a/src/AppContext.tsx +++ b/src/AppContext.tsx @@ -2,6 +2,7 @@ import { ReactNode, createContext, useState } from 'react'; import { Domain } from './Api/idmsvc'; import { VerifyState } from './Routes/WizardPage/Components/VerifyRegistry/VerifyRegistry'; import React from 'react'; +import useIdmPermissions, { IdmPermissions } from './Hooks/useIdmPermissions'; /** * It represents the application context so common events and properties @@ -50,6 +51,7 @@ export interface AppContextType { /** Set the ephemeral domain information. */ setDomain: (value: Domain) => void; }; + rbac: IdmPermissions; } /** @@ -76,6 +78,7 @@ export const AppContext = createContext({ domain: {} as Domain, setDomain: () => undefined, }, + rbac: {} as IdmPermissions, }); /** @@ -179,6 +182,7 @@ export const AppContextProvider: React.FC = ({ children domain: wizardDomain || ({} as Domain), setDomain: _setWizardDomain, }, + rbac: useIdmPermissions(), }} > {children}