mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Add current user rights to diagnostics data of FRITZ!Box Tools (#156083)
This commit is contained in:
@@ -826,6 +826,21 @@ class AvmWrapper(FritzBoxTools):
|
||||
NewDisallow="0" if turn_on else "1",
|
||||
)
|
||||
|
||||
async def async_get_current_user_rights(self) -> dict[str, Any]:
|
||||
"""Call X_AVM-DE_GetCurrentUser service."""
|
||||
|
||||
result = await self._async_service_call(
|
||||
"LANConfigSecurity",
|
||||
"1",
|
||||
"X_AVM-DE_GetCurrentUser",
|
||||
)
|
||||
|
||||
user_rights = xmltodict.parse(result["NewX_AVM-DE_CurrentUserRights"])["rights"]
|
||||
|
||||
return {
|
||||
k: user_rights["access"][idx] for idx, k in enumerate(user_rights["path"])
|
||||
}
|
||||
|
||||
async def async_wake_on_lan(self, mac_address: str) -> dict[str, Any]:
|
||||
"""Call X_AVM-DE_WakeOnLANByMACAddress service."""
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ async def async_get_config_entry_diagnostics(
|
||||
"last_update success": avm_wrapper.last_update_success,
|
||||
"last_exception": avm_wrapper.last_exception,
|
||||
"discovered_services": list(avm_wrapper.connection.services),
|
||||
"current_user_rights": await avm_wrapper.async_get_current_user_rights(),
|
||||
"client_devices": [
|
||||
{
|
||||
"connected_to": device.connected_to,
|
||||
|
||||
@@ -72,6 +72,12 @@ MOCK_FB_SERVICES: dict[str, dict] = {
|
||||
"NewBytesReceived": 12045,
|
||||
},
|
||||
},
|
||||
"LANConfigSecurity1": {
|
||||
"X_AVM-DE_GetCurrentUser": {
|
||||
"NewX_AVM-DE_CurrentUsername": "fake_user",
|
||||
"NewX_AVM-DE_CurrentUserRights": "<rights><path>BoxAdmin</path><access>readwrite</access><path>Phone</path><access>readwrite</access><path>Dial</path><access>readwrite</access><path>NAS</path><access>none</access><path>HomeAuto</path><access>readwrite</access><path>App</path><access>readwrite</access></rights>",
|
||||
}
|
||||
},
|
||||
"Layer3Forwarding1": {
|
||||
"GetDefaultConnectionService": {
|
||||
"NewDefaultConnectionService": "1.WANPPPConnection.1"
|
||||
|
||||
@@ -18,10 +18,19 @@
|
||||
67,
|
||||
]),
|
||||
'current_firmware': '7.29',
|
||||
'current_user_rights': dict({
|
||||
'App': 'readwrite',
|
||||
'BoxAdmin': 'readwrite',
|
||||
'Dial': 'readwrite',
|
||||
'HomeAuto': 'readwrite',
|
||||
'NAS': 'none',
|
||||
'Phone': 'readwrite',
|
||||
}),
|
||||
'discovered_services': list([
|
||||
'DeviceInfo1',
|
||||
'Hosts1',
|
||||
'LANEthernetInterfaceConfig1',
|
||||
'LANConfigSecurity1',
|
||||
'Layer3Forwarding1',
|
||||
'UserInterface1',
|
||||
'WANCommonIFC1',
|
||||
|
||||
Reference in New Issue
Block a user