Reolink check for admin (#85570)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com> fixes undefined
This commit is contained in:
parent
d35c4f8d82
commit
b2b6ae417d
7 changed files with 171 additions and 27 deletions
|
@ -19,6 +19,7 @@ from homeassistant.core import HomeAssistant
|
|||
from homeassistant.helpers.device_registry import format_mac
|
||||
|
||||
from .const import CONF_PROTOCOL, CONF_USE_HTTPS, DEFAULT_TIMEOUT
|
||||
from .exceptions import UserNotAdmin
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -68,6 +69,12 @@ class ReolinkHost:
|
|||
if self._api.mac_address is None:
|
||||
return False
|
||||
|
||||
if not self._api.is_admin:
|
||||
await self.stop()
|
||||
raise UserNotAdmin(
|
||||
f"User '{self._api.username}' has authorization level '{self._api.user_level}', only admin users can change camera settings"
|
||||
)
|
||||
|
||||
enable_onvif = None
|
||||
enable_rtmp = None
|
||||
enable_rtsp = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue