2022-01-12 16:01:54 +00:00
|
|
|
import type { LocationDescriptorObject } from "history";
|
|
|
|
import type { RouteDef } from "../../route-config";
|
|
|
|
import { generatePath } from "react-router-dom";
|
|
|
|
import { lazy } from "react";
|
|
|
|
|
|
|
|
export type PermissionType = "resource" | "scope";
|
|
|
|
|
|
|
|
export type NewPermissionParams = {
|
|
|
|
realm: string;
|
|
|
|
id: string;
|
|
|
|
permissionType: PermissionType;
|
2022-03-14 10:17:16 +00:00
|
|
|
selectedId?: string;
|
2022-01-12 16:01:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export const NewPermissionRoute: RouteDef = {
|
2022-03-14 10:17:16 +00:00
|
|
|
path: "/:realm/clients/:id/authorization/permission/new/:permissionType/:selectedId?",
|
2022-01-12 16:01:54 +00:00
|
|
|
component: lazy(() => import("../authorization/PermissionDetails")),
|
|
|
|
breadcrumb: (t) => t("clients:createPermission"),
|
2022-05-30 09:23:24 +00:00
|
|
|
access: "view-clients",
|
2022-01-12 16:01:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export const toNewPermission = (
|
|
|
|
params: NewPermissionParams
|
|
|
|
): LocationDescriptorObject => ({
|
|
|
|
pathname: generatePath(NewPermissionRoute.path, params),
|
|
|
|
});
|