Restrict access to collections with nms license

This commit is contained in:
Pablo Aragon 2023-01-12 12:28:40 +01:00
parent 2fb7acc871
commit c503836634
6 changed files with 39 additions and 7 deletions

View File

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

View File

@ -26,7 +26,8 @@
* GNU General Public License for more details.
* ============================================================================
*/
$config['license_nms'] = 1;
// ! Eliminar!
// Begin.
require_once 'include/config.php';
require_once 'include/functions_menu.php';

View File

@ -805,6 +805,7 @@ define('AUDIT_LOG_DASHBOARD_MANAGEMENT', 'Dashboard management');
define('AUDIT_LOG_SERVICE_MANAGEMENT', 'Service management');
define('AUDIT_LOG_INCIDENT_MANAGEMENT', 'Incident management');
define('AUDIT_LOG_UMC', 'Warp Manager');
define('AUDIT_LOG_NMS_VIOLATION', 'NMS Violation');
// MIMEs.
define(

View File

@ -6342,3 +6342,19 @@ function setDownloadCookieToken()
);
}
}
/**
* Check nms license on api.
*
* @return boolean
*/
function nms_check_api()
{
global $config;
if ($config['license_nms'] === 1) {
returnError('license_error');
return true;
}
}

View File

@ -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,

View File

@ -1461,9 +1461,11 @@ if ($inventorytab == -1 || $inventoryCount === 0) {
}
// Collection.
$collectiontab = enterprise_hook('collection_tab');
if ($collectiontab == -1) {
$collectiontab = '';
if ($config['license_nms'] !== 1) {
$collectiontab = enterprise_hook('collection_tab');
if ($collectiontab == -1) {
$collectiontab = '';
}
}