From 39b00bc4a7993976dc528b12508003f7cb9ad11e Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 30 Jul 2026 07:40:04 +0000 Subject: [PATCH] Drop SCIM export userName email fallback Email comes from identity when a profile matches; empty email only when the event has no profile row to join. Signed-off-by: Cursor Agent Co-authored-by: Bryan FRIMIN --- pkg/iam/log_export_csv.go | 21 +-------------------- pkg/iam/log_export_csv_test.go | 8 -------- 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/pkg/iam/log_export_csv.go b/pkg/iam/log_export_csv.go index 7ef3ac714..aac40ee7a 100644 --- a/pkg/iam/log_export_csv.go +++ b/pkg/iam/log_export_csv.go @@ -30,7 +30,6 @@ import ( "go.gearno.de/kit/pg" "go.probo.inc/probo/pkg/coredata" "go.probo.inc/probo/pkg/gid" - "go.probo.inc/probo/pkg/mail" "go.probo.inc/probo/pkg/page" "go.probo.inc/probo/pkg/safecsv" ) @@ -228,11 +227,6 @@ func scimEventCSVRow( ) []string { profile := profilesByUserName[strings.ToLower(event.UserName)] - email := profile.email - if email == "" { - email = scimEmailFromUserName(event.UserName) - } - return []string{ organizationName, event.ID.String(), @@ -240,7 +234,7 @@ func scimEventCSVRow( event.Method, event.Path, event.UserName, - email, + profile.email, profile.fullName, strconv.Itoa(event.StatusCode), stringPtrValue(event.ErrorMessage), @@ -381,19 +375,6 @@ func uniqueNonEmptyStrings(values []string) []string { return out } -func scimEmailFromUserName(userName string) string { - userName = strings.TrimSpace(userName) - if userName == "" { - return "" - } - - if _, err := mail.ParseAddr(userName); err == nil { - return userName - } - - return "" -} - func profileFullName(profile *coredata.MembershipProfile) string { if profile.FormattedName != nil && *profile.FormattedName != "" { return *profile.FormattedName diff --git a/pkg/iam/log_export_csv_test.go b/pkg/iam/log_export_csv_test.go index d6c371660..303061350 100644 --- a/pkg/iam/log_export_csv_test.go +++ b/pkg/iam/log_export_csv_test.go @@ -32,11 +32,3 @@ func TestUniqueNonEmptyStrings(t *testing.T) { got := uniqueNonEmptyStrings([]string{"a", "A", "", "b", "a"}) assert.Equal(t, []string{"a", "b"}, got) } - -func TestScimEmailFromUserName(t *testing.T) { - t.Parallel() - - assert.Equal(t, "user@example.com", scimEmailFromUserName("user@example.com")) - assert.Equal(t, "", scimEmailFromUserName("not-an-email")) - assert.Equal(t, "", scimEmailFromUserName("")) -}