forked from baron/baron-sso
fix(user): preserve multi-tenant companyCodes and fix Kratos code parsing
- UpdateUser: Implement 'Preserve & Merge' logic to fetch existing joined tenants from Keto and merge them with UI requests, preventing the loss of multi-tenant affiliations. - Keto Sync: Expand the self-healing background job to iterate over all companyCodes, ensuring 'members' relations are created for every joined tenant (fixes #554). - AuthHandler: Update extractFirstString to gracefully handle numeric JSON types, fixing an issue where Kratos login codes were lost during Courier webhook processing.
This commit is contained in:
@@ -3767,6 +3767,13 @@ func extractFirstString(data map[string]interface{}, keys ...string) string {
|
||||
if str, ok := val.(string); ok && str != "" {
|
||||
return str
|
||||
}
|
||||
// Handle numeric types by converting to string
|
||||
if num, ok := val.(float64); ok {
|
||||
return fmt.Sprint(num)
|
||||
}
|
||||
if num, ok := val.(int); ok {
|
||||
return fmt.Sprint(num)
|
||||
}
|
||||
}
|
||||
}
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user