@orchestrator-ui/orchestrator-ui-components
Version:
Library of UI Components used to display the workflow orchestrator frontend
14 lines (11 loc) • 331 B
text/typescript
export const menuItemIsAllowed = (
url: string | undefined,
urlPolicyMap: Map<string, string>,
isAllowedHandler: (resource?: string) => boolean,
) => {
if (!url) {
return true;
}
const policyResource = urlPolicyMap.get(url);
return policyResource ? isAllowedHandler(policyResource) : true;
};