-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add First and Last name to the user identity object #3832
Conversation
Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>
88b83d0
to
e4b684a
Compare
ret := &auth.Identity{ | ||
UserID: *user.Id, | ||
HumanName: *user.Username, | ||
Provider: k, | ||
} | ||
// If the user has a first and last name, return them too | ||
if user.FirstName != nil { | ||
ret.FirstName = *user.FirstName | ||
} | ||
if user.LastName != nil { | ||
ret.LastName = *user.LastName | ||
} | ||
return ret |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can take advantage of proto3's empty-field behavior and simplify:
ret := &auth.Identity{ | |
UserID: *user.Id, | |
HumanName: *user.Username, | |
Provider: k, | |
} | |
// If the user has a first and last name, return them too | |
if user.FirstName != nil { | |
ret.FirstName = *user.FirstName | |
} | |
if user.LastName != nil { | |
ret.LastName = *user.LastName | |
} | |
return ret | |
ret := &auth.Identity{ | |
UserID: *user.Id, | |
HumanName: *user.Username, | |
Provider: k, | |
FirstName: *user.FirstName, | |
LastName: *user.LastName, | |
} | |
return ret |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I did try it like that but for users where this was missing, it was failing because of the nil reference.
Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>
Summary
The following PR adds First and Last name to the user
identity
object and to theListRoleAssignments
response.Fixes #3831
Change Type
Mark the type of change your PR introduces:
Testing
Outline how the changes were tested, including steps to reproduce and any relevant configurations.
Attach screenshots if helpful.
Review Checklist: