diff --git a/pandora_console/general/first_task/cluster_builder.php b/pandora_console/general/first_task/cluster_builder.php index e80d4e4b15..1b67906aa7 100644 --- a/pandora_console/general/first_task/cluster_builder.php +++ b/pandora_console/general/first_task/cluster_builder.php @@ -52,7 +52,7 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no cluster if (check_acl($config['id_user'], 0, 'AW')) { ?> -
+
diff --git a/pandora_console/include/class/CredentialStore.class.php b/pandora_console/include/class/CredentialStore.class.php index 3acaf66d41..64d7c7c1a8 100644 --- a/pandora_console/include/class/CredentialStore.class.php +++ b/pandora_console/include/class/CredentialStore.class.php @@ -161,14 +161,15 @@ class CredentialStore extends Wizard if (! check_acl($config['id_user'], 0, 'AR')) { db_pandora_audit( 'ACL Violation', - 'Trying to access event viewer' + 'Trying to access credential store' ); if (is_ajax()) { echo json_encode(['error' => 'noaccess']); + } else { + include 'general/noaccess.php'; } - include 'general/noaccess.php'; exit; } diff --git a/pandora_console/include/class/HTML.class.php b/pandora_console/include/class/HTML.class.php index 9ebf241377..c76c991766 100644 --- a/pandora_console/include/class/HTML.class.php +++ b/pandora_console/include/class/HTML.class.php @@ -342,7 +342,7 @@ class HTML * * @return string */ - public function error($message) + public static function error($message) { if (is_ajax()) { echo json_encode( @@ -363,7 +363,7 @@ class HTML * * @return string HTML code for desired input. */ - public function printInput($data) + public static function printInput($data) { global $config; @@ -398,7 +398,7 @@ class HTML * * @return void */ - public function printGoBackButton($url=null) + public static function printGoBackButton($url=null) { if (isset($url) === false) { $url = ui_get_full_url( @@ -425,7 +425,7 @@ class HTML ], ]; - $this->printForm($form); + self::printForm($form); } @@ -467,7 +467,7 @@ class HTML * * @return string HTML content. */ - public function printBlock( + public static function printBlock( array $input, bool $return=false, bool $direct=false @@ -502,7 +502,7 @@ class HTML $html = ''; foreach ($input['block_content'] as $in) { - $html .= $this->printBlock( + $html .= self::printBlock( $in, $return, (bool) $direct @@ -549,14 +549,14 @@ class HTML } $output .= ''; - $output .= $this->printInput($input['arguments']); + $output .= self::printInput($input['arguments']); // Allow dynamic content. $output .= $input['extra']; if (!$direct) { $output .= ''; } } else { - $output .= $this->printInput($input['arguments']); + $output .= self::printInput($input['arguments']); // Allow dynamic content. $output .= $input['extra']; } @@ -578,7 +578,7 @@ class HTML * * @return string HTML content. */ - public function printBlockAsGrid(array $input, bool $return=false) + public static function printBlockAsGrid(array $input, bool $return=false) { $output = ''; if ($input['hidden'] == 1) { @@ -596,7 +596,7 @@ class HTML $output .= '
  • '; $output .= '
  • '; @@ -635,7 +635,7 @@ class HTML if ($input['arguments']['type'] == 'text' || $input['arguments']['type'] == 'text_extended') { $output .= '
    '; - $output .= $this->printInput($input['arguments']); + $output .= self::printInput($input['arguments']); $output .= '
    '; } else if ($input['arguments']['inline'] == 'true') { if (isset($input['extra'])) { @@ -646,7 +646,7 @@ class HTML $output .= '
    '; } - $output .= $this->printInput($input['arguments']); + $output .= self::printInput($input['arguments']); $output .= '
    '; $output .= ''; @@ -654,14 +654,14 @@ class HTML $output .= ''; } } else { - $output .= $this->printInput($input['arguments']); + $output .= self::printInput($input['arguments']); } // Allow dynamic content. $output .= $input['extra']; $output .= ''; } else { - $output .= $this->printInput($input['arguments']); + $output .= self::printInput($input['arguments']); // Allow dynamic content. $output .= $input['extra']; } @@ -683,7 +683,7 @@ class HTML * * @return string HTML content. */ - public function printBlockAsList(array $input, bool $return=false) + public static function printBlockAsList(array $input, bool $return=false) { $output = ''; if ($input['hidden'] == 1) { @@ -701,7 +701,7 @@ class HTML $output .= '
  • '; $output .= '
  • '; @@ -711,12 +711,12 @@ class HTML ) { $output .= '
  • '; $output .= ''; - $output .= $this->printInput($input['arguments']); + $output .= self::printInput($input['arguments']); // Allow dynamic content. $output .= $input['extra']; $output .= '
  • '; } else { - $output .= $this->printInput($input['arguments']); + $output .= self::printInput($input['arguments']); // Allow dynamic content. $output .= $input['extra']; } @@ -739,7 +739,7 @@ class HTML * * @return string HTML code. */ - public function printForm( + public static function printForm( array $data, bool $return=false, bool $print_white_box=false @@ -781,9 +781,9 @@ class HTML foreach ($inputs as $input) { if ($input['arguments']['type'] != 'submit') { - $output .= $this->printBlock($input, true); + $output .= self::printBlock($input, true); } else { - $output_submit .= $this->printBlock($input, true); + $output_submit .= self::printBlock($input, true); } } @@ -822,7 +822,7 @@ class HTML * * @return string HTML code. */ - public function printFormAsGrid(array $data, bool $return=false) + public static function printFormAsGrid(array $data, bool $return=false) { $form = $data['form']; @@ -886,9 +886,9 @@ class HTML foreach ($column['inputs'] as $input) { if (is_array($input)) { if ($input['arguments']['type'] != 'submit') { - $output .= $this->printBlockAsGrid($input, true); + $output .= self::printBlockAsGrid($input, true); } else { - $output_submit .= $this->printBlockAsGrid($input, true); + $output_submit .= self::printBlockAsGrid($input, true); } } else { $output .= $input; @@ -933,7 +933,7 @@ class HTML * * @return string HTML code. */ - public function printFormAsList(array $data, bool $return=false) + public static function printFormAsList(array $data, bool $return=false) { $form = $data['form']; $inputs = $data['inputs']; @@ -966,9 +966,9 @@ class HTML foreach ($inputs as $input) { if ($input['arguments']['type'] != 'submit') { - $output .= $this->printBlockAsList($input, true); + $output .= self::printBlockAsList($input, true); } else { - $output_submit .= $this->printBlockAsList($input, true); + $output_submit .= self::printBlockAsList($input, true); } } diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index e6c4108615..25674080d0 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -356,6 +356,9 @@ define('MODULE_PREDICTION_CLUSTER', 5); define('MODULE_PREDICTION_CLUSTER_AA', 6); define('MODULE_PREDICTION_CLUSTER_AP', 7); +// Forced agent OS ID for cluster agents. +define('CLUSTER_OS_ID', 100); + // Type of Webserver Modules. define('MODULE_WEBSERVER_CHECK_LATENCY', 30); define('MODULE_WEBSERVER_CHECK_SERVER_RESPONSE', 31); diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index fdb12fac59..2f2f7500bc 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -19,7 +19,29 @@ require_once $config['homedir'].'/include/functions.php'; require_once $config['homedir'].'/include/functions_modules.php'; -require_once $config['homedir'].'/include/functions_users.php'; +require_once $config['homedir'].'/include/functions_users.php';/** + * Return the agent if exists in the DB. + * + * @param integer $id_agent The agent id. + * @param boolean $show_disabled Show the agent found althought it is disabled. By default false. + * @param boolean $force_meta + * + * @return boolean The result to check if the agent is in the DB. + */ + + +function agents_get_agent($id_agent, $show_disabled=true, $force_meta=false) +{ + $agent = db_get_row_filter( + $force_meta ? 'tmetaconsole_agent' : 'tagente', + [ + 'id_agente' => $id_agent, + 'disabled' => !$show_disabled, + ] + ); + + return $agent; +} /** diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index be1ecac492..1a2277f9ac 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -605,22 +605,24 @@ function html_print_select( $output .= '