Home Assistant Unofficial Reference 2024.12.1
homeassistant.auth.permissions.util Namespace Reference

Functions

Callable[[str, str], bool|None] _gen_dict_test_func (PermissionLookup perm_lookup, LookupFunc lookup_func, SubCategoryDict lookup_dict)
 
Callable[[str, str], bool] compile_policy (CategoryType policy, SubCatLookupType subcategories, PermissionLookup perm_lookup)
 
ValueType lookup_all (PermissionLookup perm_lookup, SubCategoryDict lookup_dict, str object_id)
 
bool test_all (CategoryType policy, str key)
 

Variables

 LookupFunc
 
 SubCatLookupType
 

Detailed Description

Helpers to deal with permissions.

Function Documentation

◆ _gen_dict_test_func()

Callable[[str, str], bool | None] homeassistant.auth.permissions.util._gen_dict_test_func ( PermissionLookup  perm_lookup,
LookupFunc  lookup_func,
SubCategoryDict   lookup_dict 
)
private
Generate a lookup function.

Definition at line 84 of file util.py.

◆ compile_policy()

Callable[[str, str], bool] homeassistant.auth.permissions.util.compile_policy ( CategoryType  policy,
SubCatLookupType  subcategories,
PermissionLookup   perm_lookup 
)
Compile policy into a function that tests policy.

Subcategories are mapping key -> lookup function, ordered by highest
priority first.

Definition at line 25 of file util.py.

◆ lookup_all()

ValueType homeassistant.auth.permissions.util.lookup_all ( PermissionLookup  perm_lookup,
SubCategoryDict  lookup_dict,
str   object_id 
)
Look up permission for all.

Definition at line 17 of file util.py.

◆ test_all()

bool homeassistant.auth.permissions.util.test_all ( CategoryType  policy,
str  key 
)
Test if a policy has an ALL access for a specific key.

Definition at line 103 of file util.py.

Variable Documentation

◆ LookupFunc

homeassistant.auth.permissions.util.LookupFunc

Definition at line 13 of file util.py.

◆ SubCatLookupType

homeassistant.auth.permissions.util.SubCatLookupType

Definition at line 14 of file util.py.