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

allow users to change github id as well as login #770

Merged
merged 2 commits into from Oct 15, 2019

Conversation

@vvuk
Copy link
Contributor

vvuk commented Oct 12, 2019

Handle the case where a github user changes their username, and then creates a new account with the original name.

Fixes #769

if user.user_xref != gh_user.id do
Logger.debug("Syncer: sync_user: github user #{inspect(gh_user.login)} changed id from #{inspect(user.user_xref)} to #{inspect(gh_user.id)}")
user
|> User.changeset(%{user_xref: gh_user.id})

This comment has been minimized.

Copy link
@notriddle

notriddle Oct 12, 2019

Member

That is not correct. If somebody changed their username, and then I changed my username to match theirs, and then logged in to bors, it would allow me to take over their repositories. How about, instead, making it

Suggested change
|> User.changeset(%{user_xref: gh_user.id})
|> User.changeset(%{login: "#{user.login}/renamed/#{user.id}"})

and then performing the insert as normal afterward. This way, claiming a username after the original user goes away doesn't wreck the database. Since github usernames aren't allowed to have slashes in them, renaming it like this should ensure there's no conflicts. It's called {name}/rename/{id} since github logins never have slashes in them, and the ID numbers themselves are unique, so there's no possibility of conflict.

@vvuk

This comment has been minimized.

Copy link
Contributor Author

vvuk commented Oct 15, 2019

Something like this? I don't know Elixir well enough to know how to better structure this to avoid the case/nesting, I can try to restructure it so it's less nest-y.

Copy link
Member

notriddle left a comment

It's fine. I can restructure it whenever I get around to actually maintaining bors-ng again. There's been a bunch else going on that's kept me busier.

bors r+

bors bot added a commit that referenced this pull request Oct 15, 2019
Merge #770
770: allow users to change github id as well as login r=notriddle a=vvuk

Handle the case where a github user changes their username, and then creates a new account with the original name.

Fixes #769 

Co-authored-by: Vladimir Vukicevic <vladimir@pobox.com>
@bors

This comment has been minimized.

Copy link
Contributor

bors bot commented Oct 15, 2019

Build succeeded

@bors bors bot merged commit b37ce8a into bors-ng:master Oct 15, 2019
3 checks passed
3 checks passed
Taskcluster (pull_request) TaskGroup: success
Details
Travis CI - Pull Request Build Passed
Details
bors Build succeeded
Details
notriddle added a commit to bors-ng/bors-ng.github.io that referenced this pull request Nov 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.