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-11-14 08:31 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 31 7.39 - 7.63 REST-API Debug Message Printer AVM
Requires lua resource.lua 32 7.39 - 7.81 REST-API ResourceProperty Constructor representing one Webvariable AVM
Requires lua uimod.lua 36 7.39 - 8.00 REST-API UI-Modules API AVM
Required by lua api.lua 36 7.39 - 8.00 REST-API Lua-Land root for scgi_server AVM
Required by lua api_generic.lua 36 7.39 - 8.00 REST-API Generic Endpoints AVM
Required by lua configflags.lua 26 7.90 - 8.00 TODO AVM
6 dependencies for this script

Model-Matrix

Daily updated index of the presence, path and size of this script for each model. Last update: 2024-11-14 06:51 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/rtl) label in the Model column shows which CPU is meant for Multi-Linux models.
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 4040 7.39 - 8.00 /usr/rest_api 9.9k - 14.8k
FRITZ!Box 4050 7.58 - 7.90 /usr/rest_api 9.9k - 14.8k
FRITZ!Box 4060 7.39 - 7.90 /usr/rest_api 9.9k - 14.8k
FRITZ!Box 5530 Fiber (main) 7.39 - 8.00 /usr/rest_api 9.9k - 14.8k
FRITZ!Box 5590 Fiber (main) 7.39 - 8.00 /usr/rest_api 9.9k - 14.8k
FRITZ!Box 5590 Fiber (prx) 7.70 - 8.00 /usr/rest_api 9.9k - 14.1k
FRITZ!Box 5690 Pro (main) 7.62 - 7.90 /usr/rest_api 9.9k - 14.8k
FRITZ!Box 6490 Cable (atom) 7.39 - 7.51 /usr/rest_api 14.8k
FRITZ!Box 6590 Cable (atom) 7.39 - 7.51 /usr/rest_api 14.8k
FRITZ!Box 6591 Cable (arm) 8.00 /usr/rest_api 9.9k
FRITZ!Box 6591 Cable (atom) 7.39 - 8.00 /usr/rest_api 9.9k - 14.8k
FRITZ!Box 6660 Cable (arm) 7.90 - 8.00 /usr/rest_api 9.9k
FRITZ!Box 6660 Cable (atom) 7.39 - 8.00 /usr/rest_api 9.9k - 14.8k
FRITZ!Box 6670 Cable (arm) 7.90 /usr/rest_api 9.9k
FRITZ!Box 6670 Cable (atom) 7.61 - 7.90 /usr/rest_api 9.9k - 14.8k
FRITZ!Box 6690 Cable (arm) 7.90 /usr/rest_api 9.9k
FRITZ!Box 6690 Cable (atom) 7.39 - 7.90 /usr/rest_api 9.9k - 14.8k
FRITZ!Box 6820 LTE v1 (main) 7.51 /usr/rest_api 14.8k
FRITZ!Box 6820 LTE v2 (main) 7.51 /usr/rest_api 14.8k
FRITZ!Box 6820 LTE v3 (main) 7.51 - 7.57 /usr/rest_api 14.8k
FRITZ!Box 6850 LTE 7.39 - 7.90 /usr/rest_api 9.9k - 14.8k
FRITZ!Box 6850 5G 7.39 - 7.90 /usr/rest_api 9.9k - 14.8k
FRITZ!Box 6890 LTE (main) 7.39 - 7.57 /usr/rest_api 14.0k - 14.8k
FRITZ!Box 6890 LTE v1 (main) 7.39 - 7.57 /usr/rest_api 14.0k - 14.8k
FRITZ!Box 6890 LTE v2 (main) 7.39 - 7.57 /usr/rest_api 14.0k - 14.8k
FRITZ!Box 7490 (main) 7.51 /usr/rest_api 14.8k
FRITZ!Box 7510 7.39 - 8.00 /usr/rest_api 9.9k - 14.8k
FRITZ!Box 7520 7.39 - 8.00 /usr/rest_api 9.9k - 14.8k
FRITZ!Box 7520 v2 (main) 7.39 - 8.00 /usr/rest_api 9.9k - 14.8k
FRITZ!Box 7530 7.39 - 8.00 /usr/rest_api 9.9k - 14.8k
FRITZ!Box 7530 AX 7.39 - 8.00 /usr/rest_api 9.9k - 14.8k
FRITZ!Box 7583 (main) 7.50 - 7.59 /usr/rest_api 14.8k
FRITZ!Box 7583 VDSL (main) 7.59 - 8.00 /usr/rest_api 9.9k - 14.8k
FRITZ!Box 7590 (main) 7.39 - 8.00 /usr/rest_api 9.9k - 14.8k
FRITZ!Box 7590 AX (main) 7.39 - 8.00 /usr/rest_api 9.9k - 14.8k
FRITZ!Box 7690 7.61 - 7.90 /usr/rest_api 9.9k - 14.8k
36 models use this script

SMW-Browser

Information is currently being retrieved from the backend.
 

Synonyms

Showing 1 related property.

a