If you like BoxMatrix then please contribute Supportdata, Supportdata2, Firmware and/or Hardware (get in touch).
My metamonk@yahoo.com is not reachable by me since years. Please use hippie2000@webnmail.de instead.

0
U

Property:api generic filter.lua

From BoxMatrix


BoxMatrix >> Webinterface >> api_generic_filter.lua @ BoxMatrix   -   IRC-Chat   -   Translate: de es fr it nl pl
News Selectors Models Accessories Components Environment Config Commands System Webif Software Develop Lexicon Community Project Media

UI-Structure UI-Modules HTML-Files XML-Files Lua-Scripts Javascript Browser SSI-Files SSI-Directives HTML-Text Event-Text Help-Pages CSS-Files Graphics Research

Lua-Script

Goto:   Whitelist  -  Functions  -  Dependencies   -   Model-Matrix   -   SMW-Browser

Details

api_generic_filter.lua is the REST-API UI-Modules Webvar Filter. It is included by api_generic.lua and api.lua.

It provides whitelisting of Webvariables in a selection of UI-Modules which are whitelisted by uimod.lua.

Each whitelisted Webvariable is represented by a ResourceProperty object from resource.lua, collected in a table.
Each object has an endpoint it belongs to, a variable name, and a data type which is one of boolean, integer, string,
and array. An array type object links to a subtable of ResourceProperty objects, allowing for nested variable trees.

All root tables are collected per endpoint in the api_generic_filter.resource table, which can be searched by the.
find_resource_by_path(path_list) function for one or more endpoint / webvar pathes, returning a list of
ResourceProperty objects. The purpose is not only filtering, but also finding the datatype of each webvar.
AVM calls this the Resource Data Model of each webvar.

The filtering is enabled in ui-module webui:settings/rest_api_webvar_filter, which defaults to 1.
Tests to set it to 0 using ctlmgr_ctl did not work in fw 7.50.

root@fritz1:/var/media/ftp# ctlmgr_ctl r webui settings/rest_api_webvar_filter
1
root@fritz1:/var/media/ftp# ctlmgr_ctl w webui settings/rest_api_webvar_filter 0
root@fritz1:/var/media/ftp# ctlmgr_ctl r webui settings/rest_api_webvar_filter
1

REST-API:

Whitelist

api_generic_filter.lua contains whitelists of Webvariables in UI-Modules which could be accessed by the API: 7530 fw 7.50:

boxusers (table vars_boxusers => resource.boxusers)
 
  googleauth_enabled
  own_googleauth_devicename
  twofactor_auth_enabled
  myfritz_boxuser_uid
  user/ (array, subtable vars_user)
 
    name
    password
    enabled
    phone_rights
    homeauto_rights
    box_admin_rights
    dial_rights
    nas_rights
    is_myself
    UID
    vpn_access
    email
    googleauth_devicename
    googleauth_setupdate
    googleauth_reset
 
remoteman (table vars_remoteman => resource.remoteman)
  
  enabled
 
connections (table vars_connections => resource.connections)
  
  opmode

umts (table vars_umts => resource.umts)
  
  enabled
 
webui (table vars_webui => resource.webui)
  
  userlist_hidden

apps  (table vars_apps => resource.apps)
 
  app/ (array, subtable vars_applist)
 
    boxuser_UID
    displayname
    UID
    current_internet_rights
    current_app_rights
    current_phone_rights
    current_nas_rights
    current_homeauto_rights
    logins/ (array, subtable vars_app_login)
 
      entry/ (array, subtable vars_app_login_entry)
 
        login_time
 
rights  (table vars_rights => resource.rights)
 
  twofactor_auth_state
  twofactor_auth_active
  twofactor_auth_start_error
  boxuser_UID
  twofactor_auth_start
  twofactor_auth_cancel

Functions

The function names of scripts often help to understand function blocks (and show gaps in the docs). fw 7.50 functions:

$ grep -e '^function' -e '^local function' /usr/rest_api/api_generic_filter.lua

# Convert the given value in its datatype.
local function convert_value(value, datatype)

# Check if the resource data model should be represented or the raw ui-module datamodel.
function api_generic_filter.filter()

# Find the resource model by the given api path and the request method.
function api_generic_filter.find_resource_by_path(path_list)

# Creates a data object by the given backend data and their resource data model.
function api_generic_filter.fill_resource_with_backend_data(backend_data, resource_model)

# Take the given requests body and validates it against the given resource model.
function api_generic_filter.validate_request_body(request_body, resource_model) 

Dependencies

Daily updated index of all dependencies of this script. Last update: 2024-04-20 08:53 GMT.
A * in the Mod column marks info from Supportdata-Probes, which will always stay incomplete.
If an Object includes itself then this is a file with the same name but another Path and the dependencies are merged.

Relation Typ Object Mod Firmware Info Origin
Requires lua avmluamessages.lua 49 7.39 - 7.62 REST-API Debug Message Printer AVM
Requires lua resource.lua 50 7.39 - 7.80 REST-API ResourceProperty Constructor representing one Webvariable AVM
Requires lua uimod.lua 50 7.39 - 7.90 REST-API UI-Modules API AVM
Required by lua api.lua 50 7.39 - 7.90 REST-API Lua-Land root for scgi_server AVM
Required by lua api_generic.lua 50 7.39 - 7.90 REST-API Generic Endpoints AVM
5 dependencies for this script

Model-Matrix

Daily updated index of the presence, path and size of this script for each model. Last update: 2024-04-20 06:28 GMT.
Showing all models using this script. Click any column header (click-wait-click) to sort the list by the respective data.
The (main/scrpn/boot/arm/prx/atom) label in the Model column shows which CPU is meant for models with multiple Linux instances.
Note that this list is merged from Firmware-Probes of all known AVM firmware for a model, including Recovery.exe and Labor-Files.

Model Firmware Path Size/Bytes
FRITZ!Box 4020 7.39 /usr/rest_api 14.8k
FRITZ!Box 4040 7.39 - 7.57 /usr/rest_api 14.8k
FRITZ!Box 4050 7.57 /usr/rest_api 14.8k
FRITZ!Box 4060 7.39 - 7.57 /usr/rest_api 14.8k
FRITZ!Box 5530 Fiber (main) 7.39 - 7.80 /usr/rest_api 14.1k - 14.8k
FRITZ!Box 5590 Fiber (arm) 7.39 - 7.90 /usr/rest_api 8.6k - 14.8k
FRITZ!Box 5590 Fiber (prx) 7.70 - 7.90 /usr/rest_api 8.6k - 14.1k
FRITZ!Box 5690 Pro (arm) 7.59 /usr/rest_api 14.8k
FRITZ!Box 6430 Cable (arm) 7.57 /usr/rest_api 14.8k
FRITZ!Box 6490 Cable (arm) 7.39 - 7.57 /usr/rest_api 14.8k
FRITZ!Box 6490 Cable (atom) 7.39 - 7.51 /usr/rest_api 14.8k
FRITZ!Box 6590 Cable (arm) 7.39 - 7.57 /usr/rest_api 14.8k
FRITZ!Box 6590 Cable (atom) 7.39 - 7.51 /usr/rest_api 14.8k
FRITZ!Box 6591 Cable (arm) 7.39 - 7.57 /usr/rest_api 14.0k - 14.8k
FRITZ!Box 6591 Cable (atom) 7.39 - 7.57 /usr/rest_api 14.0k - 14.8k
FRITZ!Box 6660 Cable (arm) 7.39 - 7.57 /usr/rest_api 14.0k - 14.8k
FRITZ!Box 6660 Cable (atom) 7.39 - 7.57 /usr/rest_api 14.0k - 14.8k
FRITZ!Box 6670 Cable (arm) 7.57 - 7.62 /usr/rest_api 14.8k
FRITZ!Box 6670 Cable (atom) 7.61 - 7.62 /usr/rest_api 14.8k
FRITZ!Box 6690 Cable (arm) 7.39 - 7.57 /usr/rest_api 14.0k - 14.8k
FRITZ!Box 6690 Cable (atom) 7.39 - 7.57 /usr/rest_api 14.0k - 14.8k
FRITZ!Box 6820 LTE v1 7.39 - 7.51 /usr/rest_api 14.8k
FRITZ!Box 6820 LTE v2 7.39 - 7.51 /usr/rest_api 14.8k
FRITZ!Box 6820 LTE v3 7.39 - 7.57 /usr/rest_api 14.8k
FRITZ!Box 6840 LTE 7.39 /usr/rest_api 14.8k
FRITZ!Box 6850 LTE 7.39 - 7.58 /usr/rest_api 14.3k - 14.8k
FRITZ!Box 6850 5G 7.39 - 7.51 /usr/rest_api 14.8k
FRITZ!Box 6890 LTE 7.39 - 7.51 /usr/rest_api 14.0k - 14.8k
FRITZ!Box 6890 LTE v1 7.39 - 7.51 /usr/rest_api 14.0k - 14.8k
FRITZ!Box 6890 LTE v2 7.39 - 7.51 /usr/rest_api 14.0k - 14.8k
FRITZ!Box 7272 7.39 /usr/rest_api 14.8k
FRITZ!Box 7430 7.39 /usr/rest_api 14.8k
FRITZ!Box 7490 (main) 7.39 - 7.57 /usr/rest_api 14.8k
FRITZ!Box 7510 7.39 - 7.57 /usr/rest_api 14.8k
FRITZ!Box 7520 7.39 - 7.51 /usr/rest_api 14.8k
FRITZ!Box 7520 v2 (arm) 7.39 - 7.57 /usr/rest_api 14.8k
FRITZ!Box 7530 7.39 - 7.56 /usr/rest_api 14.0k - 14.8k
FRITZ!Box 7530 AX 7.39 - 7.90 /usr/rest_api 8.4k - 14.8k
FRITZ!Box 7560 7.39 /usr/rest_api 14.8k
FRITZ!Box 7583 7.50 - 7.57 /usr/rest_api 14.8k
FRITZ!Box 7590 7.39 - 7.90 /usr/rest_api 8.3k - 14.8k
FRITZ!Box 7590 AX 7.39 - 7.90 /usr/rest_api 8.3k - 14.8k
FRITZ!Box 7690 7.59 /usr/rest_api 14.8k
FRITZ!Repeater 600 7.39 /usr/rest_api 14.8k
FRITZ!Repeater 1200 7.39 /usr/rest_api 14.8k
FRITZ!WLAN Repeater 1750E 7.39 /usr/rest_api 14.8k
FRITZ!Repeater 2400 7.39 /usr/rest_api 14.8k
FRITZ!Repeater 3000 7.39 /usr/rest_api 14.8k
FRITZ!Repeater 3000 AX 7.39 /usr/rest_api 14.8k
FRITZ!Powerline 1260E 7.39 /usr/rest_api 14.8k
50 models use this script

SMW-Browser

Information is currently being retrieved from the backend.
 

Synonyms

Showing 1 related property.

a