Merge branch 'ent-10815-operaciones-masivas-permiten-cambiar-parametros-que-deberian-estar-bloqueados-de-modulos-de' into 'develop'

Ent 10815 operaciones masivas permiten cambiar parametros que deberian estar bloqueados de modulos de

See merge request artica/pandorafms!5823
This commit is contained in:
Rafael Ameijeiras 2023-06-27 12:07:15 +00:00
commit d0f33605e0
3 changed files with 36 additions and 7 deletions

View File

@ -114,8 +114,10 @@ if ($update) {
foreach ($agents_ as $id_agent) {
$filter = [
'id_agente' => $id_agent,
'delete_pending' => 0,
'id_agente' => $id_agent,
'delete_pending' => 0,
'id_policy_module' => 0,
'policy_linked' => 0,
];
if ($module_type != 0) {
$filter['id_tipo_modulo'] = $module_type;
@ -141,8 +143,10 @@ if ($update) {
foreach ($agents_ as $id_agent) {
$filter = [
'id_agente' => $id_agent,
'delete_pending' => 0,
'id_agente' => $id_agent,
'delete_pending' => 0,
'id_policy_module' => 0,
'policy_linked' => 0,
];
$module_name = db_get_all_rows_filter('tagente_modulo', $filter, 'nombre');
if ($module_name === false) {
@ -1262,6 +1266,8 @@ $table->data['edit1'][1] = '<table width="100%">';
$preload
);
$table->data['exclude_policy_modules'][0] = html_print_input_hidden('exclude_policy_modules', 1);
echo '<form method="post" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=edit_modules" id="form_edit">';
html_print_table($table);
@ -1399,7 +1405,8 @@ $(document).ready (function () {
"truncate_module_names": 1,
"get_distinct_name" : 1,
"indexed" : 0,
"safe_name" : 1
"safe_name" : 1,
"exclude_policy_modules" : 1
};
if (this.value != '0')
@ -2248,7 +2255,11 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
// Any module.
$modules = db_get_all_rows_filter(
'tagente_modulo',
['id_agente' => $agents_select],
[
'id_agente' => $agents_select,
'id_policy_module' => 0,
'policy_linked' => 0,
],
[
'id_agente_modulo',
'id_tipo_modulo',

View File

@ -232,6 +232,11 @@ function agent_changed_by_multiple_agents(event, id_agent, selected) {
}
}
var exclude_policy_modules = 0;
if ($("#hidden-exclude_policy_modules").val() === "1") {
exclude_policy_modules = 1;
}
jQuery.post(
homedir + "/ajax.php",
{
@ -248,7 +253,8 @@ function agent_changed_by_multiple_agents(event, id_agent, selected) {
status_module: module_status,
id_group: id_group,
pendingdelete:
event.target != undefined ? event.target.dataset.pendingdelete : 0 // Get pendingdelete attribute from target
event.target != undefined ? event.target.dataset.pendingdelete : 0, // Get pendingdelete attribute from target
exclude_policy_modules
},
function(data) {
$("#module").empty();

View File

@ -483,6 +483,7 @@ if (is_ajax()) {
$status_modulo = (int) get_parameter('status_module', -1);
$id_group_selected = (int) get_parameter('id_group', 0);
$metaconsole_server_name = null;
$exclude_policy_modules = (bool) get_parameter('exclude_policy_modules', false);
if (!empty($id_server)) {
$metaconsole_server_name = db_get_value(
'server_name',
@ -767,6 +768,10 @@ if (is_ajax()) {
}
}
if ($exclude_policy_modules === true) {
$sql .= ' AND t1.id_policy_module = 0 AND t1.policy_linked = 0';
}
$sql .= ' ORDER BY nombre';
$nameModules = db_get_all_rows_sql($sql);
if ($tags != null) {
@ -836,6 +841,8 @@ if (is_ajax()) {
$truncate_module_names = (bool) get_parameter('truncate_module_names');
$exclude_policy_modules = (bool) get_parameter('exclude_policy_modules', false);
// Filter.
$filter = [];
if ($disabled !== -1) {
@ -927,6 +934,11 @@ if (is_ajax()) {
$filter['ttag_module.id_tag IN '] = '('.implode(',', $tags).')';
}
if ($exclude_policy_modules === true) {
$filter['id_policy_module'] = 0;
$filter['policy_linked'] = 0;
}
if (is_metaconsole() && !$force_local_modules) {
if (enterprise_include_once('include/functions_metaconsole.php') !== ENTERPRISE_NOT_HOOK) {
$connection = metaconsole_get_connection($server_name);