-
Notifications
You must be signed in to change notification settings - Fork 4.2k
draft: feat: add an endpoint to create users #37340
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
base: master
Are you sure you want to change the base?
Conversation
Thanks for the pull request, @viadanna! This repository is currently maintained by 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 approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo 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:
🔘 Get a green buildIf 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 PRYour 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:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
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.
Thank you! (I apologize if this wasn't actually ready for review, yet.) |
14ed44d
to
56a7aad
Compare
d5d3391
to
6e731c1
Compare
Hello @deborahgu
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.
No product proposal was written for this api do you want me to write one? Thanks for the quick answer! |
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. |
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 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()) |
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.
data = dict(request.data.items()) | |
data = request.data.copy() |
data['honor_code'] = "True" | ||
data['terms_of_service'] = "True" |
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 don't think these should be True by default.
data['name'] = ( | ||
f"{first_name} {last_name}".strip() | ||
if first_name or last_name | ||
else username | ||
) |
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'm not sure this logic belongs here. The API should only accept a full name and the caller can combine them as needed.
@xitij2000 In that case, I'll reengineer the solution. cc @deborahgu @AhtishamShahid This is currently sitting in a plugin we decided to upstream. |
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