diff --git a/pandora_console/extensions/resource_registration.php b/pandora_console/extensions/resource_registration.php index 2de29b4935..1d6ae952a7 100755 --- a/pandora_console/extensions/resource_registration.php +++ b/pandora_console/extensions/resource_registration.php @@ -1081,12 +1081,18 @@ function resource_registration_extension_main() } if (is_management_allowed() === false) { + if (is_metaconsole() === false) { + $url = ''.__('metaconsole').''; + } else { + $url = __('any node'); + } + ui_print_warning_message( __( 'This node is configured with centralized mode. Go to %s to create a policy.', - ''.__('metaconsole').'' + $url ) ); diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index cfb7211a1b..34c9481f58 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -111,12 +111,18 @@ ui_print_standard_header( ); if (is_management_allowed() === false) { + if (is_metaconsole() === false) { + $url = ''.__('metaconsole').''; + } else { + $url = __('any node'); + } + ui_print_warning_message( __( 'This node is configured with centralized mode. Go to %s to delete an agent', - ''.__('metaconsole').'' + $url ) ); } diff --git a/pandora_console/godmode/alerts/alert_actions.php b/pandora_console/godmode/alerts/alert_actions.php index c72195862e..584e52f59b 100644 --- a/pandora_console/godmode/alerts/alert_actions.php +++ b/pandora_console/godmode/alerts/alert_actions.php @@ -215,12 +215,18 @@ if ($delete_action) { $is_management_allowed = is_management_allowed(); if ($is_management_allowed === false) { + if (is_metaconsole() === false) { + $url = ''.__('metaconsole').''; + } 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.', - ''.__('metaconsole').'' + $url ) ); } diff --git a/pandora_console/godmode/alerts/alert_commands.php b/pandora_console/godmode/alerts/alert_commands.php index 40d8f91d1f..a480f86651 100644 --- a/pandora_console/godmode/alerts/alert_commands.php +++ b/pandora_console/godmode/alerts/alert_commands.php @@ -616,12 +616,18 @@ if ($copy_command) { $is_management_allowed = is_management_allowed(); if ($is_management_allowed === false) { + if (is_metaconsole() === false) { + $url = ''.__('metaconsole').''; + } 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.', - ''.__('metaconsole').'' + $url ) ); } diff --git a/pandora_console/godmode/alerts/alert_templates.php b/pandora_console/godmode/alerts/alert_templates.php index 9147742986..3f6d8625b5 100644 --- a/pandora_console/godmode/alerts/alert_templates.php +++ b/pandora_console/godmode/alerts/alert_templates.php @@ -260,12 +260,18 @@ if ($delete_template) { } if (is_management_allowed() === false) { + if (is_metaconsole() === false) { + $url = ''.__('metaconsole').''; + } 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.', - ''.__('metaconsole').'' + $url ) ); } diff --git a/pandora_console/godmode/alerts/configure_alert_action.php b/pandora_console/godmode/alerts/configure_alert_action.php index a49e1b53ce..e486ccc06b 100644 --- a/pandora_console/godmode/alerts/configure_alert_action.php +++ b/pandora_console/godmode/alerts/configure_alert_action.php @@ -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 = ''.__('metaconsole').''; + } 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.', - ''.__('metaconsole').'' + $url ) ); } diff --git a/pandora_console/godmode/alerts/configure_alert_command.php b/pandora_console/godmode/alerts/configure_alert_command.php index 38f4c4451b..a84aaf5467 100644 --- a/pandora_console/godmode/alerts/configure_alert_command.php +++ b/pandora_console/godmode/alerts/configure_alert_command.php @@ -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 = ''.__('metaconsole').''; + } 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.', - ''.__('metaconsole').'' + $url ) ); } diff --git a/pandora_console/godmode/alerts/configure_alert_template.php b/pandora_console/godmode/alerts/configure_alert_template.php index 86c9057845..36767a3e72 100644 --- a/pandora_console/godmode/alerts/configure_alert_template.php +++ b/pandora_console/godmode/alerts/configure_alert_template.php @@ -373,12 +373,18 @@ function update_template($step) $is_management_allowed = is_management_allowed(); if ($is_management_allowed === false) { + if (is_metaconsole() === false) { + $url = ''.__('metaconsole').''; + } 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.', - ''.__('metaconsole').'' + $url ) ); } diff --git a/pandora_console/godmode/category/category.php b/pandora_console/godmode/category/category.php index 56af4022a8..39683df3ae 100755 --- a/pandora_console/godmode/category/category.php +++ b/pandora_console/godmode/category/category.php @@ -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 = ''.__('metaconsole').''; + } 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.', - ''.__('metaconsole').'' + $url ) ); } diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php index 6781311766..862b923f59 100644 --- a/pandora_console/godmode/groups/group_list.php +++ b/pandora_console/godmode/groups/group_list.php @@ -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 = ''.__('metaconsole').''; + } 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.', - ''.__('metaconsole').'' + $url ) ); } diff --git a/pandora_console/godmode/groups/modu_group_list.php b/pandora_console/godmode/groups/modu_group_list.php index 107f6b4703..24818de618 100644 --- a/pandora_console/godmode/groups/modu_group_list.php +++ b/pandora_console/godmode/groups/modu_group_list.php @@ -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 = ''.__('metaconsole').''; + } 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.', - ''.__('metaconsole').'' + $url ) ); } diff --git a/pandora_console/godmode/massive/massive_add_profiles.php b/pandora_console/godmode/massive/massive_add_profiles.php index bed8e6264a..f1903b83de 100644 --- a/pandora_console/godmode/massive/massive_add_profiles.php +++ b/pandora_console/godmode/massive/massive_add_profiles.php @@ -39,12 +39,18 @@ if (!check_acl($config['id_user'], 0, 'UM')) { } if (is_management_allowed() === false) { + if (is_metaconsole() === false) { + $url = ''.__('metaconsole').''; + } 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.', - ''.__('metaconsole').'' + $url ) ); diff --git a/pandora_console/godmode/massive/massive_delete_profiles.php b/pandora_console/godmode/massive/massive_delete_profiles.php index 6930aa29ed..bfa490f3cd 100644 --- a/pandora_console/godmode/massive/massive_delete_profiles.php +++ b/pandora_console/godmode/massive/massive_delete_profiles.php @@ -39,12 +39,18 @@ if (! check_acl($config['id_user'], 0, 'UM')) { } if (is_management_allowed() === false) { + if (is_metaconsole() === false) { + $url = ''.__('metaconsole').''; + } 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.', - ''.__('metaconsole').'' + $url ) ); diff --git a/pandora_console/godmode/massive/massive_operations.php b/pandora_console/godmode/massive/massive_operations.php index e77d471d32..23693a5d4b 100755 --- a/pandora_console/godmode/massive/massive_operations.php +++ b/pandora_console/godmode/massive/massive_operations.php @@ -334,12 +334,18 @@ $agentstab = [ } if ($tab == 'massive_policies' && is_management_allowed() === false) { + if (is_metaconsole() === false) { + $url = ''.__('metaconsole').''; + } 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.', - ''.__('metaconsole').'' + $url ) ); return; @@ -401,12 +407,18 @@ $agentstab = [ '.__('metaconsole').''; + } else { + $url = __('any node'); + } + ui_print_warning_message( __( 'This node is configured with centralized mode. To delete agents go to %s', - ''.__('metaconsole').'' + $url ) ); } diff --git a/pandora_console/godmode/modules/manage_nc_groups.php b/pandora_console/godmode/modules/manage_nc_groups.php index e30e76e5ae..bfac159d4e 100644 --- a/pandora_console/godmode/modules/manage_nc_groups.php +++ b/pandora_console/godmode/modules/manage_nc_groups.php @@ -271,12 +271,18 @@ foreach ($groups as $group) { } if (is_management_allowed() === false && is_metaconsole() === false) { + if (is_metaconsole() === false) { + $url = ''.__('metaconsole').''; + } 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.', - ''.__('metaconsole').'' + $url ) ); } diff --git a/pandora_console/godmode/modules/manage_network_components.php b/pandora_console/godmode/modules/manage_network_components.php index f66afbab0b..8089c2799d 100644 --- a/pandora_console/godmode/modules/manage_network_components.php +++ b/pandora_console/godmode/modules/manage_network_components.php @@ -297,12 +297,18 @@ if (is_metaconsole() === true) { } if ($is_management_allowed === false) { + if (is_metaconsole() === false) { + $url = ''.__('metaconsole').''; + } 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.', - ''.__('metaconsole').'' + $url ) ); } diff --git a/pandora_console/godmode/setup/os.list.php b/pandora_console/godmode/setup/os.list.php index f74346ecd9..7ee3bc8093 100644 --- a/pandora_console/godmode/setup/os.list.php +++ b/pandora_console/godmode/setup/os.list.php @@ -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 = ''.__('metaconsole').''; + } 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.', - ''.__('metaconsole').'' + $url ) ); } diff --git a/pandora_console/godmode/tag/tag.php b/pandora_console/godmode/tag/tag.php index b49de6268a..b38e536e74 100644 --- a/pandora_console/godmode/tag/tag.php +++ b/pandora_console/godmode/tag/tag.php @@ -171,12 +171,18 @@ if ($delete !== 0) { $is_management_allowed = is_management_allowed(); if ($is_management_allowed === false) { + if (is_metaconsole() === false) { + $url = ''.__('metaconsole').''; + } 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.', - ''.__('metaconsole').'' + $url ) ); } diff --git a/pandora_console/godmode/users/profile_list.php b/pandora_console/godmode/users/profile_list.php index c85ec25a27..87b0c9c35d 100644 --- a/pandora_console/godmode/users/profile_list.php +++ b/pandora_console/godmode/users/profile_list.php @@ -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 = ''.__('metaconsole').''; + } 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.', - ''.__('metaconsole').'' + $url ) ); } diff --git a/pandora_console/godmode/users/user_list.php b/pandora_console/godmode/users/user_list.php index fc4564e0e8..aca2686e59 100644 --- a/pandora_console/godmode/users/user_list.php +++ b/pandora_console/godmode/users/user_list.php @@ -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 = ''.__('metaconsole').''; + } 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.', - ''.__('metaconsole').'' + $url ) ); } diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php index 68c60905f9..f6e6da12d7 100644 --- a/pandora_console/include/class/ConsoleSupervisor.php +++ b/pandora_console/include/class/ConsoleSupervisor.php @@ -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) ).'

'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator'), 'url' => $url, ] diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index f0d99f2886..2e1deab192 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -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()); } diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php index 40b898fae2..b97cb6d83a 100644 --- a/pandora_console/operation/users/user_edit.php +++ b/pandora_console/operation/users/user_edit.php @@ -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 = ''.__('metaconsole').''; + } 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.', - ''.__('metaconsole').'' + $url ) ); }