forked from baron/baron-sso
custom claim 권한체크 확인
This commit is contained in:
@@ -3,6 +3,12 @@ export type OrgChartTenantSelection = {
|
||||
name: string;
|
||||
};
|
||||
|
||||
export type OrgChartUserSelection = {
|
||||
id: string;
|
||||
name: string;
|
||||
email: string;
|
||||
};
|
||||
|
||||
export type TenantFilterTarget = {
|
||||
id?: string;
|
||||
tenantId?: string;
|
||||
@@ -31,6 +37,7 @@ type OrgChartPickerMessage = {
|
||||
type?: unknown;
|
||||
id?: unknown;
|
||||
name?: unknown;
|
||||
email?: unknown;
|
||||
}>;
|
||||
};
|
||||
};
|
||||
@@ -317,6 +324,26 @@ export function buildAuthenticatedOrgChartTenantPickerUrl(
|
||||
return buildAuthenticatedOrgChartUrl(baseUrl, { returnTo: pickerUrl });
|
||||
}
|
||||
|
||||
export function buildOrgChartUserMultiPickerUrl(baseUrl?: string) {
|
||||
const normalizedBase = (baseUrl ?? "").replace(/\/+$/, "");
|
||||
const params = new URLSearchParams({
|
||||
mode: "multiple",
|
||||
select: "user",
|
||||
width: "720",
|
||||
height: "640",
|
||||
});
|
||||
params.set("includeInternal", "true");
|
||||
params.set("includeDescendants", "true");
|
||||
params.set("showDescendantToggle", "true");
|
||||
|
||||
return `${normalizedBase}/embed/picker?${params.toString()}`;
|
||||
}
|
||||
|
||||
export function buildAuthenticatedOrgChartUserMultiPickerUrl(baseUrl?: string) {
|
||||
const pickerUrl = buildOrgChartUserMultiPickerUrl("");
|
||||
return buildAuthenticatedOrgChartUrl(baseUrl, { returnTo: pickerUrl });
|
||||
}
|
||||
|
||||
export function buildAuthenticatedOrgChartUrl(
|
||||
baseUrl?: string,
|
||||
options: OrgChartLoginOptions = { includeInternal: true },
|
||||
@@ -360,3 +387,33 @@ export function parseOrgChartTenantSelection(
|
||||
name: selection.name,
|
||||
};
|
||||
}
|
||||
|
||||
export function parseOrgChartUserSelections(
|
||||
message: unknown,
|
||||
): OrgChartUserSelection[] {
|
||||
const data = message as OrgChartPickerMessage;
|
||||
if (data?.type !== "orgfront:picker:confirm") {
|
||||
return [];
|
||||
}
|
||||
|
||||
return (data.payload?.selections ?? [])
|
||||
.filter(
|
||||
(
|
||||
selection,
|
||||
): selection is {
|
||||
type: "user";
|
||||
id: string;
|
||||
name: string;
|
||||
email?: string;
|
||||
} =>
|
||||
selection?.type === "user" &&
|
||||
typeof selection.id === "string" &&
|
||||
typeof selection.name === "string" &&
|
||||
selection.id.trim() !== "",
|
||||
)
|
||||
.map((selection) => ({
|
||||
id: selection.id,
|
||||
name: selection.name,
|
||||
email: typeof selection.email === "string" ? selection.email : "",
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user