Move event permissions out of the websocket api into auth (#101975)
This commit is contained in:
parent
3c3f512583
commit
93f10cdce8
9 changed files with 44 additions and 35 deletions
|
@ -12,6 +12,7 @@ import voluptuous as vol
|
|||
|
||||
from homeassistant.auth.models import User
|
||||
from homeassistant.auth.permissions.const import POLICY_READ
|
||||
from homeassistant.auth.permissions.events import SUBSCRIBE_ALLOWLIST
|
||||
from homeassistant.const import (
|
||||
EVENT_STATE_CHANGED,
|
||||
MATCH_ALL,
|
||||
|
@ -128,10 +129,6 @@ def handle_subscribe_events(
|
|||
hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any]
|
||||
) -> None:
|
||||
"""Handle subscribe events command."""
|
||||
# Circular dep
|
||||
# pylint: disable-next=import-outside-toplevel
|
||||
from .permissions import SUBSCRIBE_ALLOWLIST
|
||||
|
||||
event_type = msg["event_type"]
|
||||
|
||||
if event_type not in SUBSCRIBE_ALLOWLIST and not connection.user.is_admin:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue