1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

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:
J. Nick Koston
2024-01-13 10:10:50 -10:00
committed by GitHub
parent d7910841ef
commit b1d0c6a4f1
5 changed files with 72 additions and 30 deletions

View File

@@ -669,7 +669,7 @@ class MockUser(auth_models.User):
def mock_policy(self, policy):
"""Mock a policy for a user."""
self._permissions = auth_permissions.PolicyPermissions(policy, self.perm_lookup)
self.permissions = auth_permissions.PolicyPermissions(policy, self.perm_lookup)
async def register_auth_provider(