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

Create add-on library that supports username changes #237

Closed
gsidebo opened this issue Feb 1, 2021 · 10 comments
Closed

Create add-on library that supports username changes #237

gsidebo opened this issue Feb 1, 2021 · 10 comments
Assignees

Comments

@gsidebo
Copy link

gsidebo commented Feb 1, 2021

We have a project that allows us to hack our way through username changes across xPRO and edX (https://github.com/mitodl/edx-username-updater). The reason this library exists is that changing a user's username in edX requires more than just an update to their Django User record. We auto-generate usernames in xPRO (which then become the edX username as well), and as a result, we've had a lot of requests to change those usernames. Those requests are frequent enough that it makes sense to add support for changing usernames directly. We can do this by creating a very small Django plugin that will be installed in our edX instances. It basically needs to perform the exact same steps as the edx-username-updater scripts (obviously excluding the xPRO steps).

The exact method for changing the username is TBD, but one option might be to alter the Django admin for Users and add some logic to the save method

@HamzaIbnFarooq HamzaIbnFarooq self-assigned this Feb 10, 2021
@HamzaIbnFarooq
Copy link

HamzaIbnFarooq commented Feb 10, 2021

I have the following questions on this:

  1. Define how we want to run username update scripts?
    • Through management commands
    • Through Admin Panel (as proposed by Gavin)
    • Through some front-end interface (like sys-admin)
  2. What is the scope of plugin? means should it be generic enough to change usernames for any edX instance or only for xPRO bound instances?
  3. If we change username of an account on edX, we must update that account on xPRO as well, is this scenario under the scope of this plugin? and how are we thinking to cater this scenario (manually via xPRO's admin-panel or automated via some API in xPRO)?

Update:
What if we create a plugin having just an API endpoint in to change a user's username?
In this way, a generic solution of username change can be achieved and that feature can be easily handled via any third-party application like xPRO.

@gsidebo
Copy link
Author

gsidebo commented Feb 10, 2021

@HamzaIbnFarooq

  1. If this was one of our heroku apps, I would suggest a management command, but unfortunately it's not easy for anyone outside of devops to run them. If it's possible to override the User Django admin class to (a) allow username updates, and (b) override the save method to make the forum username update and recreate the index, then I'm thinking we should go with that. It doesn't come with any added security concerns like an API endpoint would, and it builds off of a familiar existing UI. I don't know enough about Django admin to say whether that's possible or not. If that doesn't work, we can look into an API endpoint or a simple UI on sysadmin etc.
  2. I don't think this plugin needs to be aware of xPro in any way. Username updates are relevant to any edX instance
  3. To keep it simple right now, we will be manually updating the username on xPro via Django admin. We don't necessarily need this plugin to do anything when that xPro update is applied. A 2-step process will be fine for now

@briangrossman
Copy link

@HamzaIbnFarooq and @gsidebo
Just adding to this discussion...

I like Hamza's point about looking into the potential of implementing this functionality as an API call. That path provides the opportunity to potentially open this up to eventually be exposed to the end user for self-service, and could conceivably be used in other products.

Is this something we could consider?

@gsidebo
Copy link
Author

gsidebo commented Feb 11, 2021

The username update on the edX side involves a rebuild of the forum index. If it was as simple as changing a few database values in edX, I'd say the self-service route would be great and not too risky, but the index rebuild step makes me think we should tread a little more carefully. If we want a self-service option down the road, that could reuse some of the same code we write for the admin-only approach

@briangrossman
Copy link

Thanks for the details, @gsidebo.

Good to know that the code will be leverageable. Given that... this sounds like a fine first step.

@HamzaIbnFarooq
Copy link

Can anyone please suggest a name for this plugin? (i.e: edx-username-changer or something similar) so I can create a repo for it.

@gsidebo
Copy link
Author

gsidebo commented Feb 12, 2021

@HamzaIbnFarooq That sounds good to me

@pdpinch
Copy link
Member

pdpinch commented Feb 17, 2021

@HamzaIbnFarooq you might want to read this open edX proposal for django app patterns. It hasn't been approved yet, but if the suggestions make sense I think we should adopt them.

@HamzaIbnFarooq
Copy link

Thanks for the suggestion @pdpinch, The document seems to be primarily focusing on a default pattern for inter-plugin communication, the Django specific structure has kept intact. In our app, we are just using some signals and the document only says to put them in signals.py which we are already doing. Can't see any distinct feature otherwise.

@gsidebo can you please have a look into the document as well, so we can be on the same page.

@HamzaIbnFarooq
Copy link

This issue has been closed by mitodl/edx-username-changer#1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants