mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 23:49:33 +00:00
Add configuration of user permission for downloading pcap (hidden for the time being)
This commit is contained in:
parent
5b05b06c96
commit
a86aaa61e6
11 changed files with 148 additions and 29 deletions
|
|
@ -9,17 +9,18 @@ require "lua_utils"
|
|||
sendHTTPContentTypeHeader('text/html')
|
||||
|
||||
if(haveAdminPrivileges()) then
|
||||
username = _POST["username"]
|
||||
full_name = _POST["full_name"]
|
||||
password = _POST["password"]
|
||||
confirm_password = _POST["confirm_password"]
|
||||
host_role = _POST["user_role"]
|
||||
networks = _POST["allowed_networks"]
|
||||
allowed_interface = _POST["allowed_interface"]
|
||||
language = _POST["user_language"]
|
||||
host_pool_id = _POST["host_pool_id"]
|
||||
limited_lifetime = _POST["lifetime_limited"]
|
||||
lifetime_secs = tonumber((_POST["lifetime_secs"] or -1))
|
||||
local username = _POST["username"]
|
||||
local full_name = _POST["full_name"]
|
||||
local password = _POST["password"]
|
||||
local confirm_password = _POST["confirm_password"]
|
||||
local host_role = _POST["user_role"]
|
||||
local networks = _POST["allowed_networks"]
|
||||
local allowed_interface = _POST["allowed_interface"]
|
||||
local language = _POST["user_language"]
|
||||
local allow_pcap_download = _POST["allow_pcap_download"]
|
||||
local host_pool_id = _POST["host_pool_id"]
|
||||
local limited_lifetime = _POST["lifetime_limited"]
|
||||
local lifetime_secs = tonumber((_POST["lifetime_secs"] or -1))
|
||||
|
||||
if(username == nil or full_name == nil or password == nil or confirm_password == nil or host_role == nil or networks == nil or allowed_interface == nil) then
|
||||
print ("{ \"result\" : -1, \"message\" : \"Invalid parameters\" }")
|
||||
|
|
@ -34,7 +35,12 @@ if(haveAdminPrivileges()) then
|
|||
local ret = false
|
||||
username = string.lower(username)
|
||||
|
||||
if(ntop.addUser(username, full_name, password, host_role, networks, getInterfaceName(allowed_interface), host_pool_id, language)) then
|
||||
local allow_pcap_download_enabled = false
|
||||
if _POST["allow_pcap_download"] and _POST["allow_pcap_download"] == "1" then
|
||||
allow_pcap_download_enabled = true
|
||||
end
|
||||
|
||||
if(ntop.addUser(username, full_name, password, host_role, networks, getInterfaceName(allowed_interface), host_pool_id, language, allow_pcap_download_enabled)) then
|
||||
ret = true
|
||||
|
||||
if limited_lifetime and not ntop.addUserLifetime(username, lifetime_secs) then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue