forked from baron/baron-sso
테넌트 import 규칙 개선
This commit is contained in:
@@ -150,6 +150,27 @@ describe("tenantCsvImport", () => {
|
|||||||
expect(csv).not.toContain("local-tenant-id");
|
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", () => {
|
it("remaps child parent_tenant_id from source ids to selected staging ids", () => {
|
||||||
const rows = parseTenantCSV(
|
const rows = parseTenantCSV(
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -325,12 +325,15 @@ function buildTargetTenantIds(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const sourceTenantId = isUUIDLikeTenantId(preview.row.tenantId)
|
||||||
|
? preview.row.tenantId
|
||||||
|
: "";
|
||||||
const targetTenantId =
|
const targetTenantId =
|
||||||
typeof resolution === "string"
|
typeof resolution === "string"
|
||||||
? resolution || preview.row.tenantId
|
? resolution || sourceTenantId
|
||||||
: resolution.mode === "existing"
|
: resolution.mode === "existing"
|
||||||
? resolution.tenantId
|
? resolution.tenantId
|
||||||
: resolution.tenantId || createTenantImportId();
|
: resolution.tenantId || sourceTenantId || createTenantImportId();
|
||||||
const targetSlug =
|
const targetSlug =
|
||||||
typeof resolution === "object" && resolution.mode === "create"
|
typeof resolution === "object" && resolution.mode === "create"
|
||||||
? resolution.slug || preview.defaultCreateSlug
|
? resolution.slug || preview.defaultCreateSlug
|
||||||
@@ -400,6 +403,13 @@ function createTenantImportId() {
|
|||||||
.padEnd(12, "0")}`;
|
.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(
|
function findTenantImportConflicts(
|
||||||
row: TenantCSVRow,
|
row: TenantCSVRow,
|
||||||
tenants: TenantSummary[],
|
tenants: TenantSummary[],
|
||||||
|
|||||||
@@ -704,3 +704,4 @@ toggle_label = "Show active sessions only"
|
|||||||
|
|
||||||
[msg.userfront.audit.filter]
|
[msg.userfront.audit.filter]
|
||||||
description = "Toggle to view only active sessions."
|
description = "Toggle to view only active sessions."
|
||||||
|
|
||||||
|
|||||||
@@ -807,8 +807,8 @@ action_label = "확인"
|
|||||||
page_title = "로그인 승인"
|
page_title = "로그인 승인"
|
||||||
title = "승인 완료"
|
title = "승인 완료"
|
||||||
action_label_close = "창 닫기"
|
action_label_close = "창 닫기"
|
||||||
title_remote = "로그인 승인 완료"
|
|
||||||
title_pending = "로그인 승인 확인 중"
|
title_pending = "로그인 승인 확인 중"
|
||||||
|
title_remote = "로그인 승인 완료"
|
||||||
|
|
||||||
[ui.userfront.login_success]
|
[ui.userfront.login_success]
|
||||||
later = "나중에 하기 (대시보드로 이동)"
|
later = "나중에 하기 (대시보드로 이동)"
|
||||||
@@ -925,3 +925,4 @@ toggle_label = "활성 세션만 보기"
|
|||||||
|
|
||||||
[msg.userfront.audit.filter]
|
[msg.userfront.audit.filter]
|
||||||
description = "활성화된 세션만 보려면 토글을 켜주세요."
|
description = "활성화된 세션만 보려면 토글을 켜주세요."
|
||||||
|
|
||||||
|
|||||||
@@ -428,6 +428,7 @@ body = ""
|
|||||||
approved = ""
|
approved = ""
|
||||||
approved_local = ""
|
approved_local = ""
|
||||||
approved_remote = ""
|
approved_remote = ""
|
||||||
|
pending_remote = ""
|
||||||
success = ""
|
success = ""
|
||||||
|
|
||||||
[msg.userfront.login_success]
|
[msg.userfront.login_success]
|
||||||
@@ -778,6 +779,7 @@ action_label = ""
|
|||||||
action_label_close = ""
|
action_label_close = ""
|
||||||
page_title = ""
|
page_title = ""
|
||||||
title = ""
|
title = ""
|
||||||
|
title_pending = ""
|
||||||
title_remote = ""
|
title_remote = ""
|
||||||
|
|
||||||
[ui.userfront.login_success]
|
[ui.userfront.login_success]
|
||||||
|
|||||||
Reference in New Issue
Block a user