Skip to content

Commit 767066f

Browse files
authored
Allow connector to use email field from account provisioning schema (#29)
1 parent ca393ea commit 767066f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

pkg/connector/role.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,16 @@ func (r *roleSyncer) CreateAccount(
363363
Name: "password",
364364
Bytes: []byte(plainTextPassword),
365365
}
366-
roleModel, err = r.client.CreateUser(ctx, accountInfo.GetLogin(), plainTextPassword)
366+
// Default to C1 User's login as email
367+
email := accountInfo.GetLogin()
368+
// If the account provisioning schema has been filled, use the calculated email field
369+
if accountInfo.Profile != nil {
370+
profileMap := accountInfo.Profile.GetFields()
371+
if value, ok := profileMap["email"]; ok && value.GetStringValue() != "" {
372+
email = value.GetStringValue()
373+
}
374+
}
375+
roleModel, err = r.client.CreateUser(ctx, email, plainTextPassword)
367376
if err != nil {
368377
return nil, nil, nil, err
369378
}

0 commit comments

Comments
 (0)