Skip to content

Conversation

viadanna
Copy link
Contributor

@viadanna viadanna commented Sep 9, 2025

Description

This PR adds an /api/user/v1/create endpoint that allows the creation of new user accounts.

Testing instructions

Please provide detailed step-by-step instructions for testing this change.

Deadline

None

@viadanna viadanna requested a review from a team as a code owner September 9, 2025 18:49
@openedx-webhooks
Copy link

openedx-webhooks commented Sep 9, 2025

Thanks for the pull request, @viadanna!

This repository is currently maintained by @openedx/wg-maintenance-edx-platform.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

🔘 Update the status of your PR

Your PR is currently marked as a draft. After completing the steps above, update its status by clicking "Ready for Review", or removing "WIP" from the title, as appropriate.


Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Sep 9, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in Contributions Sep 9, 2025
@deborahgu
Copy link
Member

deborahgu commented Sep 9, 2025

Thanks for the PR, @viadanna! I see that in the name of this PR you call it "draft" but you didn't mark it as a draft PR in github, so forgive me if I'm asking questions where the answer is just "this is still a draft PR, why are you asking me questions about it?" 😅

Assuming that you did actually mean to make it a real PR, could you link more to the context for why this was created? If anything, there's an ongoing goal to simplify user API and get rid of the replicated endpoints.

  • What in this endpoint is different from /user/v1/account/registration/ and /user/v2/account/registration/?
  • Is it different enough that it's appropriate to make a completely different endpoint, instead of a different way of calling those endpoints?
  • If it is different enough that it's appropriate to make a completely different endpoint, is there a logic to the different verb used on the URL? Is there anything to make it intuitive which endpoint does what?
  • I see that there are a fair number of serializers; do they all need to be unique and original?
  • Was there a product review process I can read about?

Thank you! (I apologize if this wasn't actually ready for review, yet.)

@deborahgu deborahgu moved this to Todo in Aperture-Maintained Sep 9, 2025
@deborahgu deborahgu added the waiting for eng review PR is ready for review. Review and merge it, or suggest changes. label Sep 9, 2025
@viadanna viadanna force-pushed the viadanna/create-user-endpoint branch from 14ed44d to 56a7aad Compare September 9, 2025 19:39
@viadanna viadanna force-pushed the viadanna/create-user-endpoint branch from d5d3391 to 6e731c1 Compare September 9, 2025 20:20
@deborahgu deborahgu added waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. and removed waiting for eng review PR is ready for review. Review and merge it, or suggest changes. labels Sep 10, 2025
@viadanna viadanna marked this pull request as draft September 10, 2025 19:50
@viadanna viadanna self-assigned this Sep 10, 2025
@viadanna
Copy link
Contributor Author

viadanna commented Sep 10, 2025

Hello @deborahgu

What in this endpoint is different from /user/v1/account/registration/ and /user/v2/account/registration/?
Is it different enough that it's appropriate to make a completely different endpoint, instead of a different way of calling those endpoints?
If it is different enough that it's appropriate to make a completely different endpoint, is there a logic to the different verb used on the URL? Is there anything to make it intuitive which endpoint does what?

The reasoning for this endpoint is to add users to the platform that will log on via SSO, so they don't have a password and have a related UID for Social Auth. It's a very specific use case that didn't fit the already existing endpoints. One alternative is reworking the solution to make it possible to do so with the existing endpoints, but I'm unsure that will lead to a simpler solution.

I see that there are a fair number of serializers; do they all need to be unique and original?
For the current endpoint implementation, yes.
Was there a product review process I can read about?

No product proposal was written for this api do you want me to write one?

Thanks for the quick answer!

@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Sep 10, 2025
@AhtishamShahid
Copy link
Contributor

Hi, although I don't fully understand this use case, it seems like a very niche use case. You can always create a plugin to handle these cases.

A simpler version of this could work.
https://github.com/cookiecutter-openedx/openedx-plugin-example/tree/main/openedx_plugin_api

Copy link
Contributor

@xitij2000 xitij2000 left a comment

Choose a reason for hiding this comment

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

I too feel this should be part of an existing endpoint. Perhaps as part of AccountViewSet. I also feel it's doing too much, particularly in creating UserSocialAuth entries.

I think these need to be two separate APIs. One to create the user (which could be part of the existing API or an extension of the registration API) and the other for the UserSocialAuth linkingg.

"""
Create a user by the email and the username.
"""
data = dict(request.data.items())
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
data = dict(request.data.items())
data = request.data.copy()

Comment on lines +215 to +216
data['honor_code'] = "True"
data['terms_of_service'] = "True"
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think these should be True by default.

Comment on lines +241 to +245
data['name'] = (
f"{first_name} {last_name}".strip()
if first_name or last_name
else username
)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure this logic belongs here. The API should only accept a full name and the caller can combine them as needed.

@viadanna
Copy link
Contributor Author

@xitij2000 In that case, I'll reengineer the solution. cc @deborahgu

@AhtishamShahid This is currently sitting in a plugin we decided to upstream.

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

Labels

open-source-contribution PR author is not from Axim or 2U waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc.

Projects

Status: Todo
Status: Waiting on Author

Development

Successfully merging this pull request may close these issues.

5 participants