Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Allow new users to be created via the API.
Description of Task to be completed?
It should be possible to create new users via the API. External apps might need to register accounts on behalf of their users without having to send them over to the wger instance. A workflow like this is suggested:
Apps register as a regular user to get an API key
By default, users aren't allowed to create new accounts over the API, this has to be explicitly allowed
Users created with this key are marked somehow so it is later possible to identify them, you should probably think about adding a new OneToOne table to the user table "metadata" or such.
Simple idea for a basic protection against being spammed to death with new users:
REST API consumers that want to create users need a special right that has to be given on demand.
Users generated could have a special flag so that it's possible to see who created them
Note that it's probably easier and faster to add a new command for this (instead of a new element in the GUI). Something like add-user-rest-api and list-user-rest-apiwould be enough
How should this be manually tested?
python manage.py create_api_user.py [username] [email] [creator_name]
python manage.py list_users_rest_api
What are the relevant pivotal tracker stories?
144208785