-
Notifications
You must be signed in to change notification settings - Fork 2
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
Adds management command to find possible username conflicts #629
Conversation
Is it correct that the process will be:
Note that the steps to update an MITx Online username are:
|
@briangrossman yes, that'll be exactly the process I had in mind and should prevent #627 from failing to deploy successfully. (One of the migrations in there will automatically normalize the incoming usernames and it'll fail if it hits a conflict.) |
@arslanashraf7 this actually needs to be reviewed/merged before #627 |
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 tested it with the following cases:
- Create normal users (No results)
- Create a user with a normal username and then a user with some accented character in the same username (Outputs usernames & ids)
- Create a user with accented characters based username & then a new user with a normal username without accented chars (Prints ids of the conflicts)
- Above step with multiple users with the same username but different accented chars (Prints multiple IDs of those users)
For more readability, we could print email ids too for the conflicted users because even the usernames would be the same considering accents the email ids might be different. But I'm okay with this since this looks more like a one-timer.
Looks good 👍
41bbb10
to
fedef4b
Compare
Pre-Flight checklist
What are the relevant tickets?
#259
What's this PR do?
Adds a management command to identify usernames that would conflict after normalization. This is step one of the process for resolving #259.
The management command is
find_username_conflicts
and running it will load all user IDs and usernames from the database and run through them to see if a normalized username would be generated more than once. If the normalized username would be generated more than once, it outputs that normalized username with the IDs of the users that would cause a conflict. These can then be manually edited (in Django Admin or in the database directly).The command does not change usernames at all and the standard caveats apply to modifying usernames manually - they will need to be modified on the Open edX side as well.
This command will need to be run and the affected accounts adjusted before #627 can be merged, as it adds a uniqued
normalized_username
field and automatically normalizes existing usernames.How should this be manually tested?
Create two users: their usernames should share spelling but one should contain accented characters where the other doesn't. (For example,
taylor
andtâylör
.) Then, run thefind_username_conflicts
command. It should identify those two accounts specifically as accounts that may conflict after normalization.