From 96698a9f2d5b8d4c59664de4f2f479cf77c61ba0 Mon Sep 17 00:00:00 2001 From: Alfredo Cardigliano Date: Wed, 7 Jun 2023 09:33:00 +0200 Subject: [PATCH] Add support for cloud license --- httpdocs/dist | 2 +- include/Prefs.h | 1 + scripts/lua/modules/lua_utils_get.lua | 2 ++ src/LuaEngineNtop.cpp | 2 ++ src/Prefs.cpp | 15 ++++++++++++++- 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/httpdocs/dist b/httpdocs/dist index 616f7db77c..6c184e9fb7 160000 --- a/httpdocs/dist +++ b/httpdocs/dist @@ -1 +1 @@ -Subproject commit 616f7db77c6f9fd7fb1748f5af405101c7f0b8c9 +Subproject commit 6c184e9fb77fdd2fc8a83311bcb6e16eb1f02b41 diff --git a/include/Prefs.h b/include/Prefs.h index a482c06122..a4cc5acbd6 100644 --- a/include/Prefs.h +++ b/include/Prefs.h @@ -220,6 +220,7 @@ class Prefs { bool is_enterprise_m_edition(); bool is_enterprise_l_edition(); bool is_enterprise_xl_edition(); + bool is_cloud_edition(); bool is_nedge_pro_edition(); bool is_nedge_enterprise_edition(); diff --git a/scripts/lua/modules/lua_utils_get.lua b/scripts/lua/modules/lua_utils_get.lua index 8ad72ed007..06d5cb0fab 100644 --- a/scripts/lua/modules/lua_utils_get.lua +++ b/scripts/lua/modules/lua_utils_get.lua @@ -1020,6 +1020,8 @@ function getNtopngRelease(ntopng_info, verbose) if ntopng_info.oem or ntopng_info["version.nedge_edition"] then release = "" + elseif (ntopng_info["version.cloud_edition"]) then + release = "Cloud" elseif (ntopng_info["version.enterprise_xl_edition"]) then release = "Enterprise XL" elseif (ntopng_info["version.enterprise_l_edition"]) then diff --git a/src/LuaEngineNtop.cpp b/src/LuaEngineNtop.cpp index dfb2095d42..2f91d3be09 100644 --- a/src/LuaEngineNtop.cpp +++ b/src/LuaEngineNtop.cpp @@ -3637,6 +3637,8 @@ static int ntop_get_info(lua_State *vm) { ntop->getPrefs()->is_enterprise_l_edition()); lua_push_bool_table_entry(vm, "version.enterprise_xl_edition", ntop->getPrefs()->is_enterprise_xl_edition()); + lua_push_bool_table_entry(vm, "version.cloud_edition", + ntop->getPrefs()->is_cloud_edition()); lua_push_bool_table_entry(vm, "version.nedge_edition", ntop->getPrefs()->is_nedge_pro_edition()); diff --git a/src/Prefs.cpp b/src/Prefs.cpp index 698ac74539..b4f24b71bf 100644 --- a/src/Prefs.cpp +++ b/src/Prefs.cpp @@ -2838,7 +2838,20 @@ bool Prefs::is_enterprise_l_edition() { bool Prefs::is_enterprise_xl_edition() { return #ifdef NTOPNG_PRO - ntop->getPro()->has_valid_enterprise_xl_license() + ntop->getPro()->has_valid_enterprise_xl_license() || + is_cloud_edition() /* Cloud edition unlocks Enterprise XL features */ +#else + false +#endif + ; +} + +/* *************************************** */ + +bool Prefs::is_cloud_edition() { + return +#ifdef NTOPNG_PRO + ntop->getPro()->has_valid_cloud_license() #else false #endif