Merge branch 'ent-7937-mensaje-this-node-is-configured-with-centralized-mode-de-nodo-sale-en-metaconsola' into 'develop'

Ent 7937 mensaje this node is configured with centralized mode de nodo sale en metaconsola

See merge request artica/pandorafms!4409
This commit is contained in:
Daniel Rodriguez 2021-10-05 09:18:41 +00:00
commit d0e738e8fb
23 changed files with 214 additions and 68 deletions

View File

@ -1081,12 +1081,18 @@ function resource_registration_extension_main()
}
if (is_management_allowed() === false) {
if (is_metaconsole() === false) {
$url = '<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=advanced/policymanager'
).'">'.__('metaconsole').'</a>';
} else {
$url = __('any node');
}
ui_print_warning_message(
__(
'This node is configured with centralized mode. Go to %s to create a policy.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=advanced/policymanager'
).'">'.__('metaconsole').'</a>'
$url
)
);

View File

@ -111,12 +111,18 @@ ui_print_standard_header(
);
if (is_management_allowed() === false) {
if (is_metaconsole() === false) {
$url = '<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=monitoring&sec2=monitoring/wizard/wizard'
).'">'.__('metaconsole').'</a>';
} else {
$url = __('any node');
}
ui_print_warning_message(
__(
'This node is configured with centralized mode. Go to %s to delete an agent',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=monitoring&sec2=monitoring/wizard/wizard'
).'">'.__('metaconsole').'</a>'
$url
)
);
}

View File

@ -215,12 +215,18 @@ if ($delete_action) {
$is_management_allowed = is_management_allowed();
if ($is_management_allowed === false) {
if (is_metaconsole() === false) {
$url = '<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/alerts/alert_actions&tab=action&pure=0'
).'">'.__('metaconsole').'</a>';
} else {
$url = __('any node');
}
ui_print_warning_message(
__(
'This node is configured with centralized mode. All alert actions information is read only. Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/alerts/alert_actions&tab=action&pure=0'
).'">'.__('metaconsole').'</a>'
$url
)
);
}

View File

@ -616,12 +616,18 @@ if ($copy_command) {
$is_management_allowed = is_management_allowed();
if ($is_management_allowed === false) {
if (is_metaconsole() === false) {
$url = '<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/alerts/alert_commands&tab=command&pure=0'
).'">'.__('metaconsole').'</a>';
} else {
$url = __('any node');
}
ui_print_warning_message(
__(
'This node is configured with centralized mode. All alert commands information is read only. Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/alerts/alert_commands&tab=command&pure=0'
).'">'.__('metaconsole').'</a>'
$url
)
);
}

View File

@ -260,12 +260,18 @@ if ($delete_template) {
}
if (is_management_allowed() === false) {
if (is_metaconsole() === false) {
$url = '<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/alerts/alert_templates&tab=template'
).'">'.__('metaconsole').'</a>';
} else {
$url = __('any node');
}
ui_print_warning_message(
__(
'This node is configured with centralized mode. All alert templates information is read only. Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/alerts/alert_templates&tab=template'
).'">'.__('metaconsole').'</a>'
$url
)
);
}

View File

@ -104,12 +104,18 @@ if (!$is_in_group && $al_action['id_group'] != 0) {
$is_management_allowed = is_management_allowed();
if ($is_management_allowed === false) {
if (is_metaconsole() === false) {
$url = '<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/alerts/configure_alert_action&tab=action&pure=0&id='.$id
).'">'.__('metaconsole').'</a>';
} else {
$url = __('any node');
}
ui_print_warning_message(
__(
'This node is configured with centralized mode. All alert actions information is read only. Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/alerts/configure_alert_action&tab=action&pure=0&id='.$id
).'">'.__('metaconsole').'</a>'
$url
)
);
}

View File

@ -159,12 +159,18 @@ if (empty($fields_hidden) === false) {
$is_management_allowed = is_management_allowed();
if ($is_management_allowed === false) {
if (is_metaconsole() === false) {
$url = '<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/alerts/configure_alert_command&pure=0&id='.$id
).'">'.__('metaconsole').'</a>';
} else {
$url = __('any node');
}
ui_print_warning_message(
__(
'This node is configured with centralized mode. All alert commands information is read only. Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/alerts/configure_alert_command&pure=0&id='.$id
).'">'.__('metaconsole').'</a>'
$url
)
);
}

View File

@ -373,12 +373,18 @@ function update_template($step)
$is_management_allowed = is_management_allowed();
if ($is_management_allowed === false) {
if (is_metaconsole() === false) {
$url = '<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/alerts/configure_alert_template&pure=0&id='.$id.'&step='.$step
).'">'.__('metaconsole').'</a>';
} else {
$url = __('any node');
}
ui_print_warning_message(
__(
'This node is configured with centralized mode. All alerts templates information is read only. Go to Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/alerts/configure_alert_template&pure=0&id='.$id.'&step='.$step
).'">'.__('metaconsole').'</a>'
$url
)
);
}

View File

@ -92,12 +92,18 @@ if (is_metaconsole() === true) {
$is_management_allowed = true;
if (is_management_allowed() === false) {
$is_management_allowed = false;
if (is_metaconsole() === false) {
$url = '<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/category/category&tab=list&pure='.(int) $config['pure']
).'">'.__('metaconsole').'</a>';
} else {
$url = __('any node');
}
ui_print_warning_message(
__(
'This node is configured with centralized mode. All categories information is read only. Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/category/category&tab=list&pure='.(int) $config['pure']
).'">'.__('metaconsole').'</a>'
$url
)
);
}

View File

@ -382,12 +382,18 @@ if (is_metaconsole() === true) {
$is_management_allowed = true;
if (is_management_allowed() === false) {
$is_management_allowed = false;
if (is_metaconsole() === false) {
$url = '<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/groups/group_list&tab=groups'
).'">'.__('metaconsole').'</a>';
} else {
$url = __('any node');
}
ui_print_warning_message(
__(
'This node is configured with centralized mode. All groups information is read only. Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/groups/group_list&tab=groups'
).'">'.__('metaconsole').'</a>'
$url
)
);
}

View File

@ -79,12 +79,18 @@ if (is_metaconsole() === false) {
$is_management_allowed = true;
if (is_management_allowed() === false) {
$is_management_allowed = false;
if (is_metaconsole() === false) {
$url = '<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=advanced/component_management&tab=module_group'
).'">'.__('metaconsole').'</a>';
} else {
$url = __('any node');
}
ui_print_warning_message(
__(
'This node is configured with centralized mode. All module groups information is read only. Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=advanced/component_management&tab=module_group'
).'">'.__('metaconsole').'</a>'
$url
)
);
}

View File

@ -39,12 +39,18 @@ if (!check_acl($config['id_user'], 0, 'UM')) {
}
if (is_management_allowed() === false) {
if (is_metaconsole() === false) {
$url = '<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=advanced/users_setup&tab=profile&pure='.(int) $config['pure']
).'">'.__('metaconsole').'</a>';
} else {
$url = __('any node');
}
ui_print_warning_message(
__(
'This node is configured with centralized mode. All profiles user information is read only. Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=advanced/users_setup&tab=profile&pure=0'
).'">'.__('metaconsole').'</a>'
$url
)
);

View File

@ -39,12 +39,18 @@ if (! check_acl($config['id_user'], 0, 'UM')) {
}
if (is_management_allowed() === false) {
if (is_metaconsole() === false) {
$url = '<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=advanced/users_setup&tab=profile&pure='.(int) $config['pure']
).'">'.__('metaconsole').'</a>';
} else {
$url = __('any node');
}
ui_print_warning_message(
__(
'This node is configured with centralized mode. All profiles user information is read only. Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=advanced/users_setup&tab=profile&pure=0'
).'">'.__('metaconsole').'</a>'
$url
)
);

View File

@ -334,12 +334,18 @@ $agentstab = [
}
if ($tab == 'massive_policies' && is_management_allowed() === false) {
if (is_metaconsole() === false) {
$url = '<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=advanced/policymanager'
).'">'.__('metaconsole').'</a>';
} else {
$url = __('any node');
}
ui_print_warning_message(
__(
'This node is configured with centralized mode. All policies information is read only. Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=advanced/policymanager'
).'">'.__('metaconsole').'</a>'
$url
)
);
return;
@ -401,12 +407,18 @@ $agentstab = [
<?php
if (is_management_allowed() === false && $option == 'delete_agents') {
if (is_metaconsole() === false) {
$url = '<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=monitoring&sec2=monitoring/wizard/wizard'
).'">'.__('metaconsole').'</a>';
} else {
$url = __('any node');
}
ui_print_warning_message(
__(
'This node is configured with centralized mode. To delete agents go to %s',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=monitoring&sec2=monitoring/wizard/wizard'
).'">'.__('metaconsole').'</a>'
$url
)
);
}

View File

@ -271,12 +271,18 @@ foreach ($groups as $group) {
}
if (is_management_allowed() === false && is_metaconsole() === false) {
if (is_metaconsole() === false) {
$url = '<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/modules/manage_nc_groups'
).'">'.__('metaconsole').'</a>';
} else {
$url = __('any node');
}
ui_print_warning_message(
__(
'This node is configured with centralized mode. Component groups are read only. Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/modules/manage_nc_groups'
).'">'.__('metaconsole').'</a>'
$url
)
);
}

View File

@ -297,12 +297,18 @@ if (is_metaconsole() === true) {
}
if ($is_management_allowed === false) {
if (is_metaconsole() === false) {
$url = '<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/modules/manage_network_components&tab=network&pure='.(int) $config['pure']
).'">'.__('metaconsole').'</a>';
} else {
$url = __('any node');
}
ui_print_warning_message(
__(
'This node is configured with centralized mode. All remote components are read only. Go to %s to manage them.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=godmode/modules/manage_network_components&tab=network&pure=0'
).'">'.__('metaconsole').'</a>'
$url
)
);
}

View File

@ -40,12 +40,18 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user
$is_management_allowed = true;
if (is_management_allowed() === false) {
$is_management_allowed = false;
if (is_metaconsole() === false) {
$url = '<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2=list&pure='.(int) $config['pure']
).'">'.__('metaconsole').'</a>';
} else {
$url = __('any node');
}
ui_print_warning_message(
__(
'This node is configured with centralized mode. All OS definitions are read only. Go to %s to manage them.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2=list&pure=0'
).'">'.__('metaconsole').'</a>'
$url
)
);
}

View File

@ -171,12 +171,18 @@ if ($delete !== 0) {
$is_management_allowed = is_management_allowed();
if ($is_management_allowed === false) {
if (is_metaconsole() === false) {
$url = '<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=advanced/component_management'
).'">'.__('metaconsole').'</a>';
} else {
$url = __('any node');
}
ui_print_warning_message(
__(
'This node is configured with centralized mode. All tags information is read only. Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=advanced/component_management'
).'">'.__('metaconsole').'</a>'
$url
)
);
}

View File

@ -102,12 +102,18 @@ $id_profile = (int) get_parameter('id');
$is_management_allowed = true;
if (is_metaconsole() === false && is_management_allowed() === false) {
$is_management_allowed = false;
if (is_metaconsole() === false) {
$url = '<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=advanced/users_setup&tab=profile&pure='.(int) $config['pure']
).'">'.__('metaconsole').'</a>';
} else {
$url = __('any node');
}
ui_print_warning_message(
__(
'This node is configured with centralized mode. All profiles information is read only. Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=advanced/users_setup&tab=profile&pure=0'
).'">'.__('metaconsole').'</a>'
$url
)
);
}

View File

@ -397,12 +397,18 @@ $table->data[0][4] = html_print_submit_button(
$is_management_allowed = true;
if (is_metaconsole() === false && is_management_allowed() === false) {
$is_management_allowed = false;
if (is_metaconsole() === false) {
$url = '<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=advanced/users_setup&tab=user&pure='.(int) $config['pure']
).'">'.__('metaconsole').'</a>';
} else {
$url = __('any node');
}
ui_print_warning_message(
__(
'This node is configured with centralized mode. All users information is read only. Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=advanced/users_setup&tab=user&pure=0'
).'">'.__('metaconsole').'</a>'
$url
)
);
}

View File

@ -1400,6 +1400,10 @@ class ConsoleSupervisor
$PHPmemory_limit_min = config_return_in_bytes('800M');
$PHPSerialize_precision = ini_get('serialize_precision');
if (is_metaconsole() === true) {
$PHPmemory_limit_min = config_return_in_bytes('-1');
}
// PhantomJS status.
$phantomjs_dir = io_safe_output($config['phantomjs_bin']);
$result_ejecution = exec($phantomjs_dir.'/phantomjs --version');
@ -1504,6 +1508,11 @@ class ConsoleSupervisor
$url = 'http://php.net/manual/es/ini.core.php#ini.memory-limit';
}
$recommended_memory = '800M';
if (is_metaconsole() === true) {
$recommended_memory = '-1';
}
$this->notify(
[
'type' => 'NOTIF.PHP.MEMORY_LIMIT',
@ -1513,7 +1522,7 @@ class ConsoleSupervisor
),
'message' => sprintf(
__('Recommended value is: %s'),
sprintf(__('%s or greater'), '800M')
sprintf(__('%s or greater'), $recommended_memory)
).'<br><br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator'),
'url' => $url,
]

View File

@ -1753,7 +1753,12 @@ function has_metaconsole()
*/
function is_management_allowed($hkey='')
{
return ( (is_metaconsole() && is_centrallised())
$nodes = db_get_value('count(*) as n', 'tmetaconsole_setup');
if ($nodes !== false) {
$nodes = (int) $nodes;
}
return ( (is_metaconsole() && (is_centrallised() || $nodes === 0))
|| (!is_metaconsole() && !is_centrallised())
|| (!is_metaconsole() && is_centrallised()) && $hkey == generate_hash_to_api());
}

View File

@ -237,12 +237,18 @@ if (is_metaconsole() === true) {
$is_management_allowed = true;
if (is_metaconsole() === false && is_management_allowed() === false) {
$is_management_allowed = false;
if (is_metaconsole() === false) {
$url = '<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=advanced/users_setup&tab=user&pure='.(int) $config['pure']
).'">'.__('metaconsole').'</a>';
} else {
$url = __('any node');
}
ui_print_warning_message(
__(
'This node is configured with centralized mode. All users information is read only. Go to %s to manage it.',
'<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=advanced/users_setup&tab=user&pure=0'
).'">'.__('metaconsole').'</a>'
$url
)
);
}