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,
);