1
0
forked from baron/baron-sso

ef286330a2 반영 code-check 오류 수정

This commit is contained in:
2026-05-08 15:23:15 +09:00
parent e78b2bea50
commit 8307f65f6a
6 changed files with 62 additions and 46 deletions

View File

@@ -911,6 +911,8 @@ export_with_ids = ""
export_without_ids = "" export_without_ids = ""
import = "" import = ""
title = "" title = ""
view.hierarchy = ""
view.list = ""
view_org_chart = "" view_org_chart = ""
[ui.admin.tenants.domain_conflict] [ui.admin.tenants.domain_conflict]

View File

@@ -2,9 +2,10 @@ package main
import ( import (
"fmt" "fmt"
"log"
"gorm.io/driver/postgres" "gorm.io/driver/postgres"
"gorm.io/gorm" "gorm.io/gorm"
"log"
) )
type User struct { type User struct {

View File

@@ -1620,54 +1620,55 @@ func (h *UserHandler) UpdateUser(c *fiber.Ctx) error {
} }
} }
} else { } else {
// Normal update (Move): replace primary company code and remove the old one from existingCodes // Normal update (Move): replace primary company code and remove the old one from existingCodes
currentPrimary := extractTraitString(traits, "companyCode") currentPrimary := extractTraitString(traits, "companyCode")
if currentPrimary != "" && currentPrimary != code { if currentPrimary != "" && currentPrimary != code {
// Remove old primary from existingCodes // Remove old primary from existingCodes
var newCodes []string var newCodes []string
for _, existing := range existingCodes { for _, existing := range existingCodes {
if existing != currentPrimary { if existing != currentPrimary {
newCodes = append(newCodes, existing) newCodes = append(newCodes, existing)
} }
} }
existingCodes = newCodes existingCodes = newCodes
// [Keto Sync] Remove membership for the old tenant // [Keto Sync] Remove membership for the old tenant
if h.TenantService != nil && h.KetoOutboxRepo != nil { if h.TenantService != nil && h.KetoOutboxRepo != nil {
go func(removedSlug string) { go func(removedSlug string) {
bgCtx := context.Background() bgCtx := context.Background()
if t, err := h.TenantService.GetTenantBySlug(bgCtx, removedSlug); err == nil && t != nil { if t, err := h.TenantService.GetTenantBySlug(bgCtx, removedSlug); err == nil && t != nil {
_ = h.KetoOutboxRepo.Create(bgCtx, &domain.KetoOutbox{ _ = h.KetoOutboxRepo.Create(bgCtx, &domain.KetoOutbox{
Namespace: "Tenant", Namespace: "Tenant",
Object: t.ID, Object: t.ID,
Relation: "members", Relation: "members",
Subject: "User:" + userID, Subject: "User:" + userID,
Action: domain.KetoOutboxActionDelete, Action: domain.KetoOutboxActionDelete,
}) })
} }
}(currentPrimary) }(currentPrimary)
} }
} }
traits["companyCode"] = code traits["companyCode"] = code
// Resolve TenantID for Kratos Trait // Resolve TenantID for Kratos Trait
if h.TenantService != nil && code != "" { if h.TenantService != nil && code != "" {
if tenant, err := h.TenantService.GetTenantBySlug(c.Context(), code); err == nil && tenant != nil { if tenant, err := h.TenantService.GetTenantBySlug(c.Context(), code); err == nil && tenant != nil {
traits["tenant_id"] = tenant.ID traits["tenant_id"] = tenant.ID
} }
} }
found := false found := false
for _, existing := range existingCodes { for _, existing := range existingCodes {
if existing == code { if existing == code {
found = true found = true
break break
} }
} }
if !found && code != "" { if !found && code != "" {
existingCodes = append(existingCodes, code) existingCodes = append(existingCodes, code)
} }
} } }
}
// Deduplicate and save back companyCodes // Deduplicate and save back companyCodes
var codesToSave []string var codesToSave []string

View File

@@ -1112,6 +1112,10 @@ seed_badge = "Seed"
title = "Tenant Registry" title = "Tenant Registry"
view_org_chart = "View Full Org Chart" view_org_chart = "View Full Org Chart"
[ui.admin.tenants.view]
hierarchy = "Hierarchy"
list = "List"
[ui.admin.tenants.domain_conflict] [ui.admin.tenants.domain_conflict]
description = "" description = ""
title = "Domain conflict" title = "Domain conflict"

View File

@@ -1587,6 +1587,10 @@ seed_badge = "초기 설정"
title = "테넌트 목록" title = "테넌트 목록"
view_org_chart = "전체 조직도 보기" view_org_chart = "전체 조직도 보기"
[ui.admin.tenants.view]
hierarchy = "계층 구조"
list = "평면 목록"
[ui.admin.tenants.admins] [ui.admin.tenants.admins]
add_button = "관리자 추가" add_button = "관리자 추가"
already_admin = "이미 관리자" already_admin = "이미 관리자"

View File

@@ -1456,6 +1456,10 @@ seed_badge = ""
title = "" title = ""
view_org_chart = "" view_org_chart = ""
[ui.admin.tenants.view]
hierarchy = ""
list = ""
[ui.admin.tenants.admins] [ui.admin.tenants.admins]
add_button = "" add_button = ""
already_admin = "" already_admin = ""