1
0
forked from baron/baron-sso

테넌트 import 규칙 개선

This commit is contained in:
2026-05-22 18:00:58 +09:00
parent dc68b7da41
commit 0eb6dabdc1
5 changed files with 38 additions and 3 deletions

View File

@@ -150,6 +150,27 @@ describe("tenantCsvImport", () => {
expect(csv).not.toContain("local-tenant-id");
});
it("preserves source tenant_id when a create resolution does not override it", () => {
const exportedTenantId = "11111111-2222-4333-8444-555555555555";
const rows = parseTenantCSV(
`tenant_id,name,type,parent_tenant_id,parent_tenant_slug,slug,memo,email_domain
${exportedTenantId},Tenant With UUID,COMPANY,,,tenant-with-uuid,Memo,tenant-with-uuid.example.com
`,
);
const preview = buildTenantImportPreview(rows, tenants);
const csv = serializeTenantImportCSV(preview, {
2: {
mode: "create",
slug: "tenant-with-uuid",
},
});
expect(csv).toContain(
`${exportedTenantId},Tenant With UUID,COMPANY,,,tenant-with-uuid,Memo,tenant-with-uuid.example.com`,
);
});
it("remaps child parent_tenant_id from source ids to selected staging ids", () => {
const rows = parseTenantCSV(
[

View File

@@ -325,12 +325,15 @@ function buildTargetTenantIds(
continue;
}
const sourceTenantId = isUUIDLikeTenantId(preview.row.tenantId)
? preview.row.tenantId
: "";
const targetTenantId =
typeof resolution === "string"
? resolution || preview.row.tenantId
? resolution || sourceTenantId
: resolution.mode === "existing"
? resolution.tenantId
: resolution.tenantId || createTenantImportId();
: resolution.tenantId || sourceTenantId || createTenantImportId();
const targetSlug =
typeof resolution === "object" && resolution.mode === "create"
? resolution.slug || preview.defaultCreateSlug
@@ -400,6 +403,13 @@ function createTenantImportId() {
.padEnd(12, "0")}`;
}
function isUUIDLikeTenantId(value: string) {
return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(
value,
);
}
function findTenantImportConflicts(
row: TenantCSVRow,
tenants: TenantSummary[],

View File

@@ -704,3 +704,4 @@ toggle_label = "Show active sessions only"
[msg.userfront.audit.filter]
description = "Toggle to view only active sessions."

View File

@@ -807,8 +807,8 @@ action_label = "확인"
page_title = "로그인 승인"
title = "승인 완료"
action_label_close = "창 닫기"
title_remote = "로그인 승인 완료"
title_pending = "로그인 승인 확인 중"
title_remote = "로그인 승인 완료"
[ui.userfront.login_success]
later = "나중에 하기 (대시보드로 이동)"
@@ -925,3 +925,4 @@ toggle_label = "활성 세션만 보기"
[msg.userfront.audit.filter]
description = "활성화된 세션만 보려면 토글을 켜주세요."

View File

@@ -428,6 +428,7 @@ body = ""
approved = ""
approved_local = ""
approved_remote = ""
pending_remote = ""
success = ""
[msg.userfront.login_success]
@@ -778,6 +779,7 @@ action_label = ""
action_label_close = ""
page_title = ""
title = ""
title_pending = ""
title_remote = ""
[ui.userfront.login_success]