Refactor User attribute caching to be safer and more efficient (#96723)
* Cache construction of is_admin This has to be checked for a lot of api calls and the websocket every time the call is made * Cache construction of is_admin This has to be checked for a lot of api calls and the websocket every time the call is made * Cache construction of is_admin This has to be checked for a lot of api calls and the websocket every time the call is made * modernize * coverage * coverage * verify caching * verify caching * fix type * fix mocking
This commit is contained in:
parent
d7910841ef
commit
b1d0c6a4f1
5 changed files with 72 additions and 30 deletions
|
@ -684,6 +684,8 @@ async def test_get_entity_state_read_perm(
|
|||
) -> None:
|
||||
"""Test getting a state requires read permission."""
|
||||
hass_admin_user.mock_policy({})
|
||||
hass_admin_user.groups = []
|
||||
assert hass_admin_user.is_admin is False
|
||||
resp = await mock_api_client.get("/api/states/light.test")
|
||||
assert resp.status == HTTPStatus.UNAUTHORIZED
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue