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:
Aaron Bach 2019-04-13 16:50:19 -06:00 committed by GitHub
parent 0a0975b5d9
commit 56b08a6ddb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,6 +11,7 @@ from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers import aiohttp_client, config_validation as cv
from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.service import verify_domain_control
from .config_flow import configured_instances
from .const import DOMAIN
@ -130,6 +131,8 @@ async def async_setup_entry(hass, config_entry):
from pyopenuv import Client
from pyopenuv.errors import OpenUvError
_verify_domain_control = verify_domain_control(hass, DOMAIN)
try:
websession = aiohttp_client.async_get_clientsession(hass)
openuv = OpenUV(
@ -155,6 +158,7 @@ async def async_setup_entry(hass, config_entry):
hass.config_entries.async_forward_entry_setup(
config_entry, component))
@_verify_domain_control
async def update_data(service):
"""Refresh OpenUV data."""
_LOGGER.debug('Refreshing OpenUV data')