Merge branch 'ent-12286-16465-acceso-a-pandora-a-traves-de-public-link-url-de-consolas-visuales-con-usuario-de-public-2' into 'develop'

Ent 12286 16465 acceso a pandora a traves de public link url de consolas visuales con usuario de public 2

See merge request artica/pandorafms!6578
This commit is contained in:
Matias Didier 2023-10-20 05:51:32 +00:00
commit dcd891eedb
6 changed files with 32 additions and 41 deletions

View File

@ -1627,7 +1627,6 @@ if (check_login()) {
// Uncompress.
try {
ob_start();
$dateNow = get_system_time();
$final = ($dateNow - $period);
$date = ($dateNow - ($time_all_box * $start));
@ -1751,31 +1750,11 @@ if (check_login()) {
'recordsFiltered' => $total_box,
]
);
$response = ob_get_clean();
// Clean output buffer.
while (ob_get_level() !== 0) {
ob_end_clean();
}
} catch (Exception $e) {
echo json_encode(
['error' => $e->getMessage()]
);
}
// If not valid it will throw an exception.
json_decode($response);
if (json_last_error() === JSON_ERROR_NONE) {
// If valid dump.
echo $response;
} else {
echo json_encode(
['error' => $response]
);
}
return;
}
if ($get_cluster_module_detail === true) {

View File

@ -518,6 +518,10 @@ class DataMatrix extends Widget
$column_names = $info_columns['column_names'];
$columns_sort = $info_columns['columns_sort'];
// Public dashboard.
$hash = get_parameter('auth_hash', '');
$id_user = get_parameter('id_user', '');
$tableId = 'dataMatrix_'.$this->dashboardId.'_'.$this->cellId;
// Load datatables user interface.
ui_print_datatable(
@ -535,6 +539,9 @@ class DataMatrix extends Widget
'slice' => $this->values['slice'],
'formatData' => $this->values['formatData'],
'modules' => json_encode($modules),
'auth_hash' => $hash,
'auth_class' => 'PandoraFMS\Dashboard\Manager',
'id_user' => $id_user,
],
'default_pagination' => $this->values['limit'],
'no_sortable_columns' => $columns_sort,

View File

@ -383,6 +383,9 @@ class ITSMIncidences extends Widget
$column_names[] = $fields[$field];
}
$hash = get_parameter('auth_hash', '');
$id_user = get_parameter('id_user', '');
$tableId = 'ITSMIncidence_'.$this->dashboardId.'_'.$this->cellId;
try {
ui_print_datatable(
@ -396,6 +399,9 @@ class ITSMIncidences extends Widget
'ajax_data' => [
'method' => 'getListTickets',
'customSearch' => $this->values['customSearch'],
'auth_hash' => $hash,
'auth_class' => 'PandoraFMS\Dashboard\Manager',
'id_user' => $id_user,
],
'order' => [
'field' => 'updateDate',

View File

@ -431,6 +431,8 @@ class ModulesByStatus extends Widget
$info_columns = $this->columns();
$column_names = $info_columns['column_names'];
$columns = $info_columns['columns'];
$hash = get_parameter('auth_hash', '');
$id_user = get_parameter('id_user', '');
$tableId = 'ModuleByStatus_'.$this->dashboardId.'_'.$this->cellId;
// Load datatables user interface.
@ -449,6 +451,9 @@ class ModulesByStatus extends Widget
'status' => $this->values['status'],
'nodes' => $this->values['nodes'],
'disabled_modules' => $this->values['disabled_modules'],
'auth_hash' => $hash,
'auth_class' => 'PandoraFMS\Dashboard\Manager',
'id_user' => $id_user,
],
'default_pagination' => $this->values['limit'],
'order' => [

View File

@ -354,8 +354,6 @@ if (is_ajax() === true) {
if ($get_events !== 0) {
try {
ob_start();
$fields = [
'te.id_evento',
'te.id_agente',
@ -1223,32 +1221,15 @@ if (is_ajax() === true) {
'recordsFiltered' => $count,
]
);
$response = ob_get_clean();
// Clean output buffer.
while (ob_get_level() !== 0) {
ob_end_clean();
}
} catch (Exception $e) {
echo json_encode(
['error' => $e->getMessage()]
);
}
// If not valid it will throw an exception.
json_decode($response);
if (json_last_error() == JSON_ERROR_NONE) {
// If valid dump.
echo $response;
} else {
echo json_encode(
['error' => $response]
);
}
}
// AJAX section ends.
exit;
return;
}
/*

View File

@ -62,6 +62,12 @@ require_once 'include/functions_visual_map.php';
$hash = (string) get_parameter('hash');
// For public link issue.
$force_instant_logout = true;
if (isset($config['id_user']) === true) {
$force_instant_logout = false;
}
// Check input hash.
// DO NOT move it after of get parameter user id.
if (User::validatePublicHash($hash) !== true) {
@ -316,3 +322,10 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
}
});
</script>
<?php
if ($force_instant_logout === true) {
unset($userAccessMaintenance, $config['id_user'], $hash);
session_destroy();
header_remove('Set-Cookie');
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
}