Merge branch 'ent-9220-verificar-y-capar-en-su-caso-que-las-colecciones-no-funcionan-en-la-nms-2' into ent-9220-verificar-y-capar-en-su-caso-que-las-colecciones-no-funcionan-en-la-nms

This commit is contained in:
Pablo Aragon 2023-02-07 11:22:20 +01:00
commit 5b538920f0
6 changed files with 51 additions and 10 deletions

View File

@ -498,10 +498,12 @@ if ($id_agente) {
} }
// Collection. // Collection.
$collectiontab = enterprise_hook('collection_tab'); if ((int) $config['license_nms'] !== 1) {
$collectiontab = enterprise_hook('collection_tab');
if ($collectiontab == -1) { if ($collectiontab == -1) {
$collectiontab = ''; $collectiontab = '';
}
} }
// NetworkConfigManager tab. // NetworkConfigManager tab.

View File

@ -141,11 +141,13 @@ if (isset($_GET['server'])) {
]; ];
$buttons['collections'] = [ if ((int) $config['license_nms'] !== 1) {
'active' => false, $buttons['collections'] = [
'text' => '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$id_server.'&ext='.$ext.'&tab=collections&pure='.$pure.'">'.html_print_image('images/collection.png', true, ['title' => __('Collections')]).'</a>', 'active' => false,
'text' => '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$id_server.'&ext='.$ext.'&tab=collections&pure='.$pure.'">'.html_print_image('images/collection.png', true, ['title' => __('Collections')]).'</a>',
]; ];
}
} }
$buttons[$tab]['active'] = true; $buttons[$tab]['active'] = true;

View File

@ -84,6 +84,15 @@ class SatelliteCollection extends HTML
return; 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. // Set the ajax controller.
$this->ajaxController = $ajaxController; $this->ajaxController = $ajaxController;
// Capture all parameters before start. // Capture all parameters before start.

View File

@ -6397,3 +6397,19 @@ function getBearerToken()
return false; 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;
}
}

View File

@ -198,6 +198,16 @@ function returnError($typeError, $returnType='string')
); );
break; break;
case 'license_error':
returnData(
$returnType,
[
'type' => 'string',
'data' => __('License not allowed for this operation.'),
]
);
break;
default: default:
returnData( returnData(
$returnType, $returnType,

View File

@ -1473,9 +1473,11 @@ if ($tab == 'inventory') {
} }
// Collection. // Collection.
$collectiontab = enterprise_hook('collection_tab'); if ((int) $config['license_nms'] !== 1) {
if ($collectiontab == -1) { $collectiontab = enterprise_hook('collection_tab');
$collectiontab = ''; if ($collectiontab == -1) {
$collectiontab = '';
}
} }