ml-tooling / contaxy

MIT License
10 stars 8 forks source link

Feature: Allow admins to create users even if self registration is disabled. #33

Closed JNKielmann closed 2 years ago

JNKielmann commented 2 years ago

At the moment, even admins cannot create new users when the USER_REGISTRATION_ENABLED variable is set. To fix this, the get_optional_api_token function is introduced, which tries to retrieve the auth token but does not fail if no token is passed. This can be used in the create_user endpoint to check if the user has admin permissions while still allowing to call the endpoint without any token.