1
0
forked from baron/baron-sso

fix: resolve i18n synchronization and fix backend tests

- Added missing i18n keys for integrity and tenant profile pages to root and adminfront locales.
- Corrected i18n section structure in template.toml.
- Fixed Hanmac email policy test by improving tenant hierarchy mocking and ensuring correct CompanyCode propagation.
- Resolved various backend test failures by updating expectations for normalized roles and fixing undefined variables.
This commit is contained in:
2026-06-02 18:50:26 +09:00
parent ae8c2ee06f
commit bf64f82507
7 changed files with 69 additions and 10 deletions

View File

@@ -182,9 +182,18 @@ description = ""
[msg.admin.integrity.check.orphan_user_tenant_memberships] [msg.admin.integrity.check.orphan_user_tenant_memberships]
description = "" description = ""
[msg.admin.integrity] [ui.admin.integrity]
tab_checks = ""
tab_user_projection = ""
subtitle = "" subtitle = ""
[ui.admin.tenants.profile]
worksmobile_enabled = ""
worksmobile_excluded = ""
worksmobile_sync = ""
allowed_domains = ""
[msg.admin.user_projection] [msg.admin.user_projection]
action_error = "" action_error = ""
action_success = "" action_success = ""

View File

@@ -1020,6 +1020,7 @@ func (h *UserHandler) BulkCreateUsers(c *fiber.Ctx) error {
ID string ID string
Slug string Slug string
Name string Name string
ParentID *string
Schema []any Schema []any
Groups []domain.UserGroup Groups []domain.UserGroup
LoginIDField string LoginIDField string
@@ -1030,9 +1031,10 @@ func (h *UserHandler) BulkCreateUsers(c *fiber.Ctx) error {
buildTenantCacheItem := func(tenant *domain.Tenant) tenantCacheItem { buildTenantCacheItem := func(tenant *domain.Tenant) tenantCacheItem {
tItem := tenantCacheItem{ tItem := tenantCacheItem{
ID: tenant.ID, ID: tenant.ID,
Slug: tenant.Slug, Slug: tenant.Slug,
Name: tenant.Name, Name: tenant.Name,
ParentID: tenant.ParentID,
} }
if s, ok := tenant.Config["userSchema"].([]any); ok { if s, ok := tenant.Config["userSchema"].([]any); ok {
tItem.Schema = s tItem.Schema = s

View File

@@ -10,6 +10,7 @@ import (
"io" "io"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
"slices"
"strings" "strings"
"testing" "testing"
"time" "time"
@@ -1106,10 +1107,16 @@ func TestUserHandler_BulkCreateUsers_HanmacEmailPolicy(t *testing.T) {
mockTenant.On("GetTenant", mock.Anything, hCompanyID).Return(&hTenants[1], nil).Maybe() mockTenant.On("GetTenant", mock.Anything, hCompanyID).Return(&hTenants[1], nil).Maybe()
mockTenant.On("ListTenants", mock.Anything, 10000, 0, "").Return(hTenants, int64(len(hTenants)), nil).Maybe() mockTenant.On("ListTenants", mock.Anything, 10000, 0, "").Return(hTenants, int64(len(hTenants)), nil).Maybe()
mockRepo.On("FindByTenantIDs", mock.Anything, mock.Anything).Return([]domain.User{ mockRepo.On("FindByTenantIDs", mock.Anything, mock.MatchedBy(func(ids []string) bool {
{Email: "han@hanmaceng.co.kr", TenantID: &hCompanyID}, return slices.Contains(ids, hRootID) || slices.Contains(ids, hCompanyID)
})).Return([]domain.User{
{Email: "han@hanmaceng.co.kr", TenantID: &hCompanyID, CompanyCode: "h-company"},
}, nil).Maybe()
mockRepo.On("FindByCompanyCodes", mock.Anything, mock.MatchedBy(func(codes []string) bool {
return slices.Contains(codes, "h-company") || slices.Contains(codes, "hanmac-family")
})).Return([]domain.User{
{Email: "han@hanmaceng.co.kr", TenantID: &hCompanyID, CompanyCode: "h-company"},
}, nil).Maybe() }, nil).Maybe()
mockRepo.On("FindByCompanyCodes", mock.Anything, mock.Anything).Return([]domain.User{}, nil).Maybe()
mockOry.On("GetPasswordPolicy").Return(&domain.PasswordPolicy{MinLength: 8}, nil).Maybe() mockOry.On("GetPasswordPolicy").Return(&domain.PasswordPolicy{MinLength: 8}, nil).Maybe()
payload := map[string]any{ payload := map[string]any{

View File

@@ -1368,6 +1368,9 @@ subtitle = "Slug and status changes are applied immediately."
title = "Tenant Profile" title = "Tenant Profile"
type = "Type" type = "Type"
visibility = "Visibility" visibility = "Visibility"
worksmobile_enabled = "Worksmobile Enabled"
worksmobile_excluded = "Excluded from Worksmobile"
worksmobile_sync = "Worksmobile Sync Status"
[ui.admin.tenants.profile.form] [ui.admin.tenants.profile.form]
parent = "Parent Tenant (Optional)" parent = "Parent Tenant (Optional)"
@@ -2760,6 +2763,8 @@ subtitle = "Review and sync the Kratos user read model."
description = "This screen is only available to super_admin users." description = "This screen is only available to super_admin users."
[ui.admin.integrity] [ui.admin.integrity]
tab_checks = "Integrity Checks"
tab_user_projection = "User Projection"
fetch_error = "Unable to load the final integrity check result." fetch_error = "Unable to load the final integrity check result."
kicker = "System" kicker = "System"
loading = "Loading data integrity report..." loading = "Loading data integrity report..."

View File

@@ -1831,6 +1831,9 @@ subtitle = "슬러그 및 상태 변경은 즉시 적용됩니다."
title = "테넌트 프로필" title = "테넌트 프로필"
type = "테넌트 유형" type = "테넌트 유형"
visibility = "공개 범위" visibility = "공개 범위"
worksmobile_enabled = "웍스모바일 활성화"
worksmobile_excluded = "웍스모바일 제외"
worksmobile_sync = "웍스모바일 동기화 상태"
[ui.admin.tenants.profile.form] [ui.admin.tenants.profile.form]
parent = "상위 테넌트 (선택)" parent = "상위 테넌트 (선택)"
@@ -3183,10 +3186,16 @@ subtitle = "Kratos 사용자 read model을 확인하고 동기화 상태를 갱
[msg.admin.user_projection.forbidden] [msg.admin.user_projection.forbidden]
description = "이 화면은 super_admin 권한으로만 접근할 수 있습니다." description = "이 화면은 super_admin 권한으로만 접근할 수 있습니다."
[msg.admin.integrity]
subtitle = "정합성 상태를 확인하고 데이터 모델 전반의 검증 결과를 살펴봅니다."
[ui.admin.integrity] [ui.admin.integrity]
tab_checks = "정합성 검사"
tab_user_projection = "사용자 동기화"
fetch_error = "정합성 최종 검증 결과를 불러오지 못했습니다." fetch_error = "정합성 최종 검증 결과를 불러오지 못했습니다."
kicker = "시스템" kicker = "시스템"
loading = "불러오는 중" loading = "불러오는 중"
subtitle = "정합성 상태를 확인하고 데이터 모델 전반의 검증 결과를 살펴봅니다."
title = "데이터 정합성 검증" title = "데이터 정합성 검증"
[ui.admin.integrity.forbidden] [ui.admin.integrity.forbidden]

View File

@@ -3045,12 +3045,39 @@ description = ""
[msg.admin.integrity.check.orphan_user_tenant_memberships] [msg.admin.integrity.check.orphan_user_tenant_memberships]
description = "" description = ""
[ui.admin.integrity]
tab_checks = ""
tab_user_projection = ""
subtitle = ""
[ui.admin.tenants.profile]
worksmobile_enabled = ""
worksmobile_excluded = ""
worksmobile_sync = ""
allowed_domains = ""
[msg.admin.integrity] [msg.admin.integrity]
subtitle = "" subtitle = ""
[msg.admin.integrity.section.tenant_integrity] [msg.admin.integrity.section.tenant_integrity]
description = "" description = ""
[ui.admin.integrity]
fetch_error = ""
kicker = ""
loading = ""
subtitle = ""
tab_checks = ""
tab_user_projection = ""
title = ""
[ui.admin.tenants.profile]
allowed_domains = ""
worksmobile_enabled = ""
worksmobile_excluded = ""
worksmobile_sync = ""
[msg.admin.integrity.section.user_integrity] [msg.admin.integrity.section.user_integrity]
description = "" description = ""