Skip to content
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

[RCCA-4684] ignore errors getting user profile when listing invitations #1069

Merged
merged 4 commits into from
Nov 10, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions internal/cmd/iam/command_invitation.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,19 @@ func (c invitationCommand) listInvitations(cmd *cobra.Command, _ []string) error
return err
}
for _, invitation := range invitations {
var firstName, lastName string
userProfile, err := c.Client.User.GetUserProfile(context.Background(), &orgv1.User{
ResourceId: invitation.UserResourceId,
})
if err != nil {
return err
if err == nil {
firstName = userProfile.FirstName
lastName = userProfile.LastName
}
outputWriter.AddElement(&invitationStruct{
Id: invitation.Id,
Email: invitation.Email,
FirstName: userProfile.FirstName,
LastName: userProfile.LastName,
FirstName: firstName,
LastName: lastName,
Comment on lines +91 to +92
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if there's an error, it's going to add a row with a missing first and last name? Is that intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct - which is fine since a user that has not accepted the invite yet (error case) would not yet have a first name / last name associated

UserResourceId: invitation.UserResourceId,
Status: invitation.Status,
})
Expand Down