Conversation
| @callback | ||
| def _async_is_done(self): | ||
| """Return if this step is done.""" | ||
| print(self.step, self._data) |
There was a problem hiding this comment.
Remember to remove this before merging.
| if self._async_is_done(): | ||
| return self.json_message('User step already done', 403) | ||
|
|
||
| provider = _async_get_hass_provider(hass) |
There was a problem hiding this comment.
Maybe in the future we can allow the first user coming from other provider by adding setup_shema to the provider.
There was a problem hiding this comment.
We could but I don't know if I would want to . If people want to configure their own auth providers, surely they will skip onboarding?
There was a problem hiding this comment.
Then we need to check if owner already created in async_is_onboarded()
There was a problem hiding this comment.
It's not a use case I am currently worried about.
There was a problem hiding this comment.
I am thinking the migration problem for current 'new auth' user, they have the need to skip onboarding user step.
There was a problem hiding this comment.
That's a good point. If an owner exists I'll mark the user step as done.
| }) | ||
| resp2 = client.post('/api/onboarding/users', json={ | ||
| 'name': 'Test 1', | ||
| 'username': '1-user', |
There was a problem hiding this comment.
Maybe add a scenario to use different username to make sure the error not caused by duplicate username
There was a problem hiding this comment.
Good catch. That was my initial intention but somehow forgot to change 1 -> 2. Fixed.
| if not hass.auth.active: | ||
| return True | ||
|
|
||
| return hass.data.get(DOMAIN, True) |
There was a problem hiding this comment.
Should check if owner already created
if hass.auth.has_owner():
return True
There was a problem hiding this comment.
We do those checks inside the async_setup. We're not checking explicitly for owner, but instead check if the user step is done. There can be many steps in the future.
* Add onboarding support * Lint * Address comments * Mark user step as done if owner user already created
Description:
Add an onboarding component.
Will only be activated if the new user system is active. Works together with home-assistant/frontend#1452
Frontend: home-assistant/frontend#1452
Related issue (if applicable): fixes #15198
Example entry for
configuration.yaml(if applicable):frontend:Checklist:
tox. Your PR cannot be merged unless tests passIf the code does not interact with devices: