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.
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.