1
0
forked from baron/baron-sso

worksmobile 연동 & ory stack 26.2.0으로 업그레이드

This commit is contained in:
2026-05-06 09:30:00 +09:00
parent 3dcdd97882
commit 2495fcb13d
74 changed files with 8698 additions and 212 deletions

View File

@@ -9,6 +9,12 @@ function getUserTenantSlug(user: UserSummary) {
);
}
function isOrgFrontTenantType(tenant: TenantSummary) {
return ["COMPANY_GROUP", "COMPANY", "ORGANIZATION"].includes(
tenant.type.toUpperCase(),
);
}
function getCompanyGroupId(node: TenantNode, allTenants: TenantSummary[]) {
let cursor: TenantSummary | undefined = node;
const byId = new Map(allTenants.map((tenant) => [tenant.id, tenant]));
@@ -73,6 +79,7 @@ export function buildOrgPickerTree({
rootTenantId?: string;
tenantId?: string;
}) {
const visibleTenants = tenants.filter(isOrgFrontTenantType);
const usersBySlug = new Map<string, UserSummary[]>();
for (const user of users) {
if (user.status !== "active") continue;
@@ -84,16 +91,16 @@ export function buildOrgPickerTree({
}
const companyGroup =
tenants.find((tenant) => tenant.id === rootTenantId) ??
tenants.find((tenant) => tenant.type === "COMPANY_GROUP") ??
tenants.find((tenant) => !tenant.parentId);
visibleTenants.find((tenant) => tenant.id === rootTenantId) ??
visibleTenants.find((tenant) => tenant.type === "COMPANY_GROUP") ??
visibleTenants.find((tenant) => !tenant.parentId);
if (!companyGroup) return { roots: [], companies: [], companyGroupId: "" };
const { currentBase } = buildTenantFullTree(tenants, companyGroup.id);
const { currentBase } = buildTenantFullTree(visibleTenants, companyGroup.id);
const groupNode =
currentBase ??
buildTenantFullTree(tenants).subTree.find(
buildTenantFullTree(visibleTenants).subTree.find(
(node) => node.id === companyGroup.id,
);

View File

@@ -297,6 +297,12 @@ function isVisibleOrgChartUser(user: UserSummary) {
);
}
function isOrgFrontTenantType(tenant: TenantSummary) {
return ["COMPANY_GROUP", "COMPANY", "ORGANIZATION"].includes(
tenant.type.toUpperCase(),
);
}
function isSystemGlobalTenant(
tenant?: Pick<TenantSummary, "id" | "slug" | "type" | "name">,
) {
@@ -363,7 +369,9 @@ function filterSystemGlobalTenants(tenants: TenantSummary[]) {
}
}
return tenants.filter((tenant) => !excludedIds.has(tenant.id));
return tenants.filter(
(tenant) => !excludedIds.has(tenant.id) && isOrgFrontTenantType(tenant),
);
}
type TenantIndexes = {
@@ -567,7 +575,7 @@ export function TenantOrgChartPage() {
const companyFilters = React.useMemo(() => {
return (familyRoot?.children ?? [])
.filter((node) => node.type === "COMPANY")
.filter((node) => node.type === "COMPANY" || node.type === "ORGANIZATION")
.map((node) => ({ id: node.id, label: node.name }))
.sort((a, b) => a.label.localeCompare(b.label));
}, [familyRoot]);
@@ -588,7 +596,9 @@ export function TenantOrgChartPage() {
node.slug.toLowerCase() === tenantId.toLowerCase() ||
node.name === tenantId,
);
if (match?.type === "COMPANY") setSelectedTenantFilter(match.id);
if (match?.type === "COMPANY" || match?.type === "ORGANIZATION") {
setSelectedTenantFilter(match.id);
}
}, [familyRoot, rootNodes, tenantId]);
const targetNodes = React.useMemo(() => {