This PR allows the /api/my-user endpoint to be used for updating a user's fields.
It is now possible to use the following workflow:
A prospecting user visits the keycloak realm registration page (either by visiting the URL directly or by being redirected to keycloak from the portal's register link)
The user completes the keycloak registration form - this means that the user is known to keycloak, but is not known to the portal yet
The user can now interact with the backend code by either:
Visiting the portal. The user will need to complete its profile page before gaining access to most sections of the profile;
making a PATCH request to /api/my-user (most likely by using the goodgo mobile app, which does this on the user's behalf) with information to complete the user's profile
After the user's profile is complete with the minimum fields (age, accepted_terms_of_service, occupation), the user may use all of the platform's functionalities
Creating/updating the user's profile via the API may be done with a request like the following:
Upon receiving a request to update a profile for a user that does not exist yet on django, the code proceeds to:
validate that the user exists on keycloak (by using the provided access token in order to query keycloak for the user's information)
create the new django user
create a user profile for the new user
depending on the type of profile being created, either communicate with keycloak in order to assign the correct group memberships (and then sync them with the django code) or notify an administrator that a new user wants access as a special user profile
This PR allows the
/api/my-user
endpoint to be used for updating a user's fields.It is now possible to use the following workflow:
A prospecting user visits the keycloak realm registration page (either by visiting the URL directly or by being redirected to keycloak from the portal's
register
link)The user completes the keycloak registration form - this means that the user is known to keycloak, but is not known to the portal yet
The user can now interact with the backend code by either:
PATCH
request to/api/my-user
(most likely by using the goodgo mobile app, which does this on the user's behalf) with information to complete the user's profileAfter the user's profile is complete with the minimum fields (
age
,accepted_terms_of_service
,occupation
), the user may use all of the platform's functionalitiesCreating/updating the user's profile via the API may be done with a request like the following:
Implementation details
Upon receiving a request to update a profile for a user that does not exist yet on django, the code proceeds to:
fixes #153