mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 03:37:07 +00:00
Ensure OpenUV service checks permissions (#22668)
* Create decorator to check service permissions * Ensure OpenUV service has proper user permissions * Reverting strange changes
This commit is contained in:
parent
0a0975b5d9
commit
56b08a6ddb
@ -11,6 +11,7 @@ from homeassistant.exceptions import ConfigEntryNotReady
|
|||||||
from homeassistant.helpers import aiohttp_client, config_validation as cv
|
from homeassistant.helpers import aiohttp_client, config_validation as cv
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
from homeassistant.helpers.service import verify_domain_control
|
||||||
|
|
||||||
from .config_flow import configured_instances
|
from .config_flow import configured_instances
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
@ -130,6 +131,8 @@ async def async_setup_entry(hass, config_entry):
|
|||||||
from pyopenuv import Client
|
from pyopenuv import Client
|
||||||
from pyopenuv.errors import OpenUvError
|
from pyopenuv.errors import OpenUvError
|
||||||
|
|
||||||
|
_verify_domain_control = verify_domain_control(hass, DOMAIN)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
websession = aiohttp_client.async_get_clientsession(hass)
|
websession = aiohttp_client.async_get_clientsession(hass)
|
||||||
openuv = OpenUV(
|
openuv = OpenUV(
|
||||||
@ -155,6 +158,7 @@ async def async_setup_entry(hass, config_entry):
|
|||||||
hass.config_entries.async_forward_entry_setup(
|
hass.config_entries.async_forward_entry_setup(
|
||||||
config_entry, component))
|
config_entry, component))
|
||||||
|
|
||||||
|
@_verify_domain_control
|
||||||
async def update_data(service):
|
async def update_data(service):
|
||||||
"""Refresh OpenUV data."""
|
"""Refresh OpenUV data."""
|
||||||
_LOGGER.debug('Refreshing OpenUV data')
|
_LOGGER.debug('Refreshing OpenUV data')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user