Enforces admin user to always have admin privileges

This commit is contained in:
Simone Mainardi 2020-01-17 17:35:18 +01:00
parent 841667837b
commit 4779f80fa8
2 changed files with 15 additions and 1 deletions

View file

@ -15,12 +15,22 @@ local empty_string_dump = "00000600CB7634C0FA2A9E49"
-- ###########################################
local function set_admin_prefs()
-- User admin is always an administrator, let's make sure serialized values are correct
ntop.setCache("ntopng.user.admin.group", "administrator")
ntop.setCache("ntopng.user.admin.allowed_nets", "0.0.0.0/0,::/0")
end
-- ###########################################
local debug = false
function prefs_dump_utils.savePrefsToDisk()
local dirs = ntop.getDirs()
local where = os_utils.fixPath(dirs.workingdir.."/runtimeprefs.json")
set_admin_prefs()
local patterns = {"ntopng.prefs.*", "ntopng.user.*"}
local out = {}
@ -84,6 +94,8 @@ function prefs_dump_utils.readPrefsFromDisk()
end
end
end
set_admin_prefs()
end
return prefs_dump_utils