mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 15:39:33 +00:00
Reworking capabilities support
This commit is contained in:
parent
8fd7420b69
commit
7da1395b87
16 changed files with 251 additions and 109 deletions
|
|
@ -13,7 +13,8 @@ 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 allow_historical_flows = _POST["allow_historical_flows"]
|
||||
local allow_alerts = _POST["allow_alerts"]
|
||||
local language = _POST["user_language"]
|
||||
|
||||
-- for captive portal users
|
||||
|
|
@ -60,20 +61,29 @@ local allow_pcap_download_enabled = false
|
|||
if allow_pcap_download and allow_pcap_download == "1" then
|
||||
allow_pcap_download_enabled = true;
|
||||
end
|
||||
if(not ntop.changeUserPermission(username, allow_pcap_download_enabled)) then
|
||||
if(not ntop.changePcapDownloadPermission(username, allow_pcap_download_enabled)) then
|
||||
print ("{ \"result\" : -1, \"message\" : \"Error in changing user permission\" }")
|
||||
return
|
||||
end
|
||||
|
||||
local allow_historical_flow_enabled = false
|
||||
if allow_historical_flow and allow_historical_flow == "1" then
|
||||
allow_historical_flow_enabled = true;
|
||||
local allow_historical_flows_enabled = false
|
||||
if allow_historical_flows and allow_historical_flows == "1" then
|
||||
allow_historical_flows_enabled = true;
|
||||
end
|
||||
if(not ntop.changeHistoricalFlowPermission(username, allow_historical_flow_enabled)) then
|
||||
if(not ntop.changeHistoricalFlowPermission(username, allow_historical_flows_enabled)) then
|
||||
print ("{ \"result\" : -1, \"message\" : \"Error in changing user historical flow permission\" }")
|
||||
return
|
||||
end
|
||||
|
||||
local allow_alerts_enabled = false
|
||||
if allow_alerts and allow_alerts == "1" then
|
||||
allow_alerts_enabled = true;
|
||||
end
|
||||
if(not ntop.changeAlertsPermission(username, allow_alerts_enabled)) then
|
||||
print ("{ \"result\" : -1, \"message\" : \"Error in changing user alerts permission\" }")
|
||||
return
|
||||
end
|
||||
|
||||
if(language ~= nil) then
|
||||
if(not ntop.changeUserLanguage(username, language)) then
|
||||
print ("{ \"result\" : -1, \"message\" : \"Error in changing the user language\" }")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue