Skip to content

Commit

Permalink
feat(HMS-2721): add rbac to AppContext
Browse files Browse the repository at this point in the history
This change add the rbac checks to the app context,
making them broadly available on the frontend
application.

Signed-off-by: Alejandro Visiedo <[email protected]>
  • Loading branch information
avisiedo committed May 20, 2024
1 parent ebf668e commit 810d0c9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/AppContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -50,6 +51,7 @@ export interface AppContextType {
/** Set the ephemeral domain information. */
setDomain: (value: Domain) => void;
};
rbac: IdmPermissions;
}

/**
Expand All @@ -76,6 +78,7 @@ export const AppContext = createContext<AppContextType>({
domain: {} as Domain,
setDomain: () => undefined,
},
rbac: {} as IdmPermissions,
});

/**
Expand Down Expand Up @@ -179,6 +182,7 @@ export const AppContextProvider: React.FC<AppContextProviderProps> = ({ children
domain: wizardDomain || ({} as Domain),
setDomain: _setWizardDomain,
},
rbac: useIdmPermissions(),
}}
>
{children}
Expand Down

0 comments on commit 810d0c9

Please sign in to comment.