Keycloak
1import { lazy } from "react";
2import type { Path } from "react-router-dom";
3import { generateEncodedPath } from "../../utils/generateEncodedPath";
4import type { AppRouteObject } from "../../routes";
5
6export type NewPolicyParams = { realm: string; id: string; policyType: string };
7
8const PolicyDetails = lazy(
9() => import("../authorization/policy/PolicyDetails"),
10);
11
12export const NewPolicyRoute: AppRouteObject = {
13path: "/:realm/clients/:id/authorization/policy/new/:policyType",
14element: <PolicyDetails />,
15breadcrumb: (t) => t("createPolicy"),
16handle: {
17access: (accessChecker) =>
18accessChecker.hasAny("manage-clients", "manage-authorization"),
19},
20};
21
22export const toCreatePolicy = (params: NewPolicyParams): Partial<Path> => ({
23pathname: generateEncodedPath(NewPolicyRoute.path, params),
24});
25