diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index e35f15ead9..ab01bbf47f 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -498,10 +498,12 @@ if ($id_agente) { } // Collection. - $collectiontab = enterprise_hook('collection_tab'); + if ((int) $config['license_nms'] !== 1) { + $collectiontab = enterprise_hook('collection_tab'); - if ($collectiontab == -1) { - $collectiontab = ''; + if ($collectiontab == -1) { + $collectiontab = ''; + } } // NetworkConfigManager tab. diff --git a/pandora_console/godmode/servers/modificar_server.php b/pandora_console/godmode/servers/modificar_server.php index 17f2020d13..b7541586b3 100644 --- a/pandora_console/godmode/servers/modificar_server.php +++ b/pandora_console/godmode/servers/modificar_server.php @@ -141,11 +141,13 @@ if (isset($_GET['server'])) { ]; - $buttons['collections'] = [ - 'active' => false, - 'text' => ''.html_print_image('images/collection.png', true, ['title' => __('Collections')]).'', + if ((int) $config['license_nms'] !== 1) { + $buttons['collections'] = [ + 'active' => false, + 'text' => ''.html_print_image('images/collection.png', true, ['title' => __('Collections')]).'', - ]; + ]; + } } $buttons[$tab]['active'] = true; diff --git a/pandora_console/include/class/SatelliteCollection.class.php b/pandora_console/include/class/SatelliteCollection.class.php index 34348fdc7a..769ec5c6f4 100644 --- a/pandora_console/include/class/SatelliteCollection.class.php +++ b/pandora_console/include/class/SatelliteCollection.class.php @@ -84,6 +84,15 @@ class SatelliteCollection extends HTML return; } + if ((int) $config['license_nms'] === 0) { + db_pandora_audit( + AUDIT_LOG_NMS_VIOLATION, + 'Trying to access satellite collections' + ); + include $config['homedir'].'/general/noaccess.php'; + return; + } + // Set the ajax controller. $this->ajaxController = $ajaxController; // Capture all parameters before start. diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 7d4fee1d21..5b13cac83d 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -6397,3 +6397,19 @@ function getBearerToken() return false; } + + +/** + * Check nms license on api. + * + * @return boolean + */ +function nms_check_api() +{ + global $config; + + if ((int) $config['license_nms'] === 1) { + returnError('license_error'); + return true; + } +} diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 540daa64c4..688bdb782f 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -198,6 +198,16 @@ function returnError($typeError, $returnType='string') ); break; + case 'license_error': + returnData( + $returnType, + [ + 'type' => 'string', + 'data' => __('License not allowed for this operation.'), + ] + ); + break; + default: returnData( $returnType, diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index ece6ec2d6c..324c9a6e33 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -1473,9 +1473,11 @@ if ($tab == 'inventory') { } // Collection. -$collectiontab = enterprise_hook('collection_tab'); -if ($collectiontab == -1) { - $collectiontab = ''; +if ((int) $config['license_nms'] !== 1) { + $collectiontab = enterprise_hook('collection_tab'); + if ($collectiontab == -1) { + $collectiontab = ''; + } }