mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-02 00:40:10 +00:00
Added ability to set historical flow permission to users (#6330)
This commit is contained in:
parent
297b5d4edb
commit
61f74ce0a1
16 changed files with 454 additions and 290 deletions
|
|
@ -13,6 +13,7 @@ local host_role = _POST["user_role"]
|
|||
local networks = _POST["allowed_networks"]
|
||||
local allowed_interface = _POST["allowed_interface"]
|
||||
local allow_pcap_download = _POST["allow_pcap_download"]
|
||||
local allow_historical_flow = _POST["allow_historical_flow"]
|
||||
local language = _POST["user_language"]
|
||||
|
||||
-- for captive portal users
|
||||
|
|
@ -64,6 +65,15 @@ if(not ntop.changeUserPermission(username, allow_pcap_download_enabled)) then
|
|||
return
|
||||
end
|
||||
|
||||
local allow_historical_flow_enabled = false
|
||||
if allow_historical_flow and allow_historical_flow == "1" then
|
||||
allow_historical_flow_enabled = true;
|
||||
end
|
||||
if(not ntop.changeHistoricalFlowPermission(username, allow_historical_flow_enabled)) then
|
||||
print ("{ \"result\" : -1, \"message\" : \"Error in changing user historical flow permission\" }")
|
||||
return
|
||||
end
|
||||
|
||||
if(language ~= nil) then
|
||||
if(not ntop.changeUserLanguage(username, language)) then
|
||||
print ("{ \"result\" : -1, \"message\" : \"Error in changing the user language\" }")
|
||||
|
|
|
|||
|
|
@ -44,12 +44,18 @@ if(isAdministratorOrPrintErr()) then
|
|||
value["language"] = locales_utils.default_locale
|
||||
end
|
||||
end
|
||||
print(' "language": "'..value["language"]..'",\n')
|
||||
if value["allow_pcap_download"] then
|
||||
print(' "allow_pcap_download": true,\n')
|
||||
end
|
||||
print(' "language": "'..value["language"]..'",\n')
|
||||
if value["allow_pcap_download"] then
|
||||
print(' "allow_pcap_download": true,\n')
|
||||
end
|
||||
|
||||
local api_token = ntop.getUserAPIToken(key) or ""
|
||||
|
||||
print(' "language": "'..value["language"]..'",\n')
|
||||
if value["allow_historical_flow"] then
|
||||
print(' "allow_historical_flow": true,\n')
|
||||
end
|
||||
|
||||
local api_token = ntop.getUserAPIToken(key) or ""
|
||||
|
||||
print(' "username": "'..key..'",\n')
|
||||
print(' "api_token": "' ..api_token.. '",\n')
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
--
|
||||
-- (C) 2013 - ntop.org
|
||||
-- (C) 2022 - ntop.org
|
||||
--
|
||||
|
||||
dirs = ntop.getDirs()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue