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

[Feature] Webhook URL for user creation #343

Closed
fmigneault opened this issue Jul 24, 2020 · 1 comment
Closed

[Feature] Webhook URL for user creation #343

fmigneault opened this issue Jul 24, 2020 · 1 comment
Assignees
Labels
feature New feature to be developed
Milestone

Comments

@fmigneault
Copy link
Collaborator

fmigneault commented Jul 24, 2020

Add a step just before user-creation completes, but after verification (unique, valid name, etc.) that sends a request to desired location for 'extra-steps'. Should be accomplished in create_user, just before completion, around here :

return ax.valid_http(http_success=HTTPCreated, detail=s.Users_POST_CreatedResponseSchema.description,
content={u"user": uf.format_user(new_user, new_user_groups)})

To avoid race conditions from the webhook response vs other same user-name request, we could commit the changes before waiting for the webhook reply. That username would then be reserved. To keep it as 'pending', set its status=0.

Request:

POST {MAGPIE_WEBHOOK_PRE_USER_CREATION_URL} 
{"user_name": "<the-name>"}

When not provided by config, this step is simply skipped.
Handle response from this request

  • When 2xx (handle OK/Created/NoContent): complete user creation as normal
  • Else: cleanup pending user + return 424 Failed Dependency
@fmigneault fmigneault added the feature New feature to be developed label Jul 24, 2020
@fmigneault fmigneault added this to the 2.x.x milestone Jul 24, 2020
@fmigneault
Copy link
Collaborator Author

resolved by #378

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

No branches or pull requests

2 participants