From f3c7e43baf41c2800af02f5742b85a3ff7f65889 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 12 Mar 2019 22:09:59 -0700 Subject: [PATCH] Update auth_permissions.md (#197) --- docs/auth_permissions.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/docs/auth_permissions.md b/docs/auth_permissions.md index c791d4d4..4211f3ef 100644 --- a/docs/auth_permissions.md +++ b/docs/auth_permissions.md @@ -203,19 +203,16 @@ Starting Home Assistant 0.90, there is a special decorator to help protect services that require admin access. ```python -from homeassistant.exceptions import Unauthorized, UnknownUser -from homeassistant.helpers import service - # New in Home Assistant 0.90 -@service.require_admin async def handle_admin_service(call): """Handle a service call.""" # Do admin action async def async_setup(hass, config): - hass.services.async_register(DOMAIN, 'my_service', - handle_admin_service(hass)) + hass.helpers.service.async_register_admin_service( + DOMAIN, 'my_service', handle_admin_service, vol.Schema({}) + ) return True ```