Check admin permission before able to manage config entries
This commit is contained in:
parent
6766d25e62
commit
90df932fe1
4 changed files with 190 additions and 0 deletions
|
@ -47,12 +47,18 @@ class Unauthorized(HomeAssistantError):
|
|||
def __init__(self, context: Optional['Context'] = None,
|
||||
user_id: Optional[str] = None,
|
||||
entity_id: Optional[str] = None,
|
||||
config_entry_id: Optional[str] = None,
|
||||
perm_category: Optional[str] = None,
|
||||
permission: Optional[Tuple[str]] = None) -> None:
|
||||
"""Unauthorized error."""
|
||||
super().__init__(self.__class__.__name__)
|
||||
self.context = context
|
||||
self.user_id = user_id
|
||||
self.entity_id = entity_id
|
||||
self.config_entry_id = config_entry_id
|
||||
# Not all actions have an ID (like adding config entry)
|
||||
# We then use this fallback to know what category was unauth
|
||||
self.perm_category = perm_category
|
||||
self.permission = permission
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue