forked from baron/baron-sso
feat(user): support fixed UUID registration and enhance bulk import results
- Added support for fixed UUIDs during bulk registration (Search-first + ExternalID mapping) - Implemented idempotency and visibility restoration for soft-deleted users - Enhanced bulk upload UI to show 'New/Updated/Unchanged' status and modified fields - Added logic to reclaim identifiers (login_id) from colliding records - Added frontend E2E and backend unit tests for UUID integrity and conflict handling - Fixed i18n, formatting, and mock tests to satisfy code-check - Applied 'go fix' for 'omitzero' tags and general Go standards
This commit is contained in:
@@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
// ValidateIDPCompatibility checks if the provided IDP supports all required fields defined in the BrokerUser model.
|
||||
func ValidateIDPCompatibility(brokerModel interface{}, idp domain.IdentityProvider) error {
|
||||
func ValidateIDPCompatibility(brokerModel any, idp domain.IdentityProvider) error {
|
||||
metadata, err := idp.GetMetadata()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to fetch metadata from IDP %s: %w", idp.Name(), err)
|
||||
@@ -20,12 +20,12 @@ func ValidateIDPCompatibility(brokerModel interface{}, idp domain.IdentityProvid
|
||||
}
|
||||
|
||||
t := reflect.TypeOf(brokerModel)
|
||||
if t.Kind() == reflect.Ptr {
|
||||
if t.Kind() == reflect.Pointer {
|
||||
t = t.Elem()
|
||||
}
|
||||
|
||||
for i := 0; i < t.NumField(); i++ {
|
||||
field := t.Field(i)
|
||||
for field := range t.Fields() {
|
||||
field := field
|
||||
|
||||
// Check "required" tag
|
||||
isRequired := field.Tag.Get("required") == "true"
|
||||
@@ -47,8 +47,8 @@ func ValidateIDPCompatibility(brokerModel interface{}, idp domain.IdentityProvid
|
||||
if fieldName == "attributes" {
|
||||
reqKeys := field.Tag.Get("required_keys")
|
||||
if reqKeys != "" {
|
||||
keys := strings.Split(reqKeys, ",")
|
||||
for _, key := range keys {
|
||||
keys := strings.SplitSeq(reqKeys, ",")
|
||||
for key := range keys {
|
||||
key = strings.TrimSpace(key)
|
||||
if !supportedMap[key] {
|
||||
return fmt.Errorf("IDP %s does not support required custom attribute: %s", idp.Name(), key)
|
||||
|
||||
Reference in New Issue
Block a user