mirror of
https://github.com/home-assistant/core.git
synced 2025-07-30 02:38:10 +02:00
Move event permissions out of the websocket api into auth (#101975)
This commit is contained in:
@ -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:
|
||||
|
Reference in New Issue
Block a user