Skip to content

Conversation

@kopiczko
Copy link
Contributor

@kopiczko kopiczko commented Sep 2, 2025

@kopiczko kopiczko force-pushed the kopiczko/bidirectional_sync_escalation branch 3 times, most recently from 49f5f44 to 65b57fe Compare September 5, 2025 10:15
Comment on lines +3282 to 3382
if githubIdentities := user.GetGithubIdentities(); len(githubIdentities) == 0 {
uls, err := a.authServer.Services.GetUserLoginState(ctx, user.GetName())
if trace.IsNotFound(err) {
// Nothing to do.
} else if err != nil {
return nil, trace.Wrap(err, "updating GitHub identities")
} else if githubIdentities := uls.GetGithubIdentities(); len(githubIdentities) > 0 {
user.SetGithubIdentities(githubIdentities)
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For reference the old UpdatePreservedAttributes:

func UpdatePreservedAttributes(ctx context.Context, user services.UserState, ulsService services.UserLoginStates) error {
	// Use the new/existing GitHubIdentities.
	// TODO(greedy52) implement a way to remove the identity or find a way to
	// avoid keeping the identity forever in user login state.
	if len(user.GetGithubIdentities()) > 0 {
		return nil
	}

	// Find the old state if exists.
	old, err := ulsService.GetUserLoginState(ctx, user.GetName())
	if err != nil {
		if trace.IsNotFound(err) {
			return nil
		}
		return trace.Wrap(err)
	}

	if githubIdentities := old.GetGithubIdentities(); len(githubIdentities) > 0 {
		user.SetGithubIdentities(githubIdentities)
	}
	return nil
}

@kopiczko kopiczko force-pushed the kopiczko/bidirectional_sync_escalation branch 2 times, most recently from d990d88 to 6d376e6 Compare October 8, 2025 15:43
@kopiczko kopiczko force-pushed the kopiczko/bidirectional_sync_escalation branch from 6d376e6 to 7d90efc Compare October 14, 2025 14:55
@kopiczko kopiczko force-pushed the kopiczko/bidirectional_sync_escalation branch from 7d90efc to 55deab5 Compare October 15, 2025 18:00
@kopiczko kopiczko marked this pull request as ready for review October 15, 2025 21:38
@github-actions github-actions bot requested review from rudream and tigrato October 15, 2025 21:39
@kopiczko kopiczko requested a review from smallinsky October 16, 2025 22:24
@kopiczko
Copy link
Contributor Author

Friendly ping @smallinsky

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants