Merge branch '8-tree-view-metaconsola-con-usuario-ad-no-muestra-hiperlink-nodo' into 'develop'
Fixed problems with access a node with user in metaconsole. #8 See merge request !17
This commit is contained in:
commit
0933ccd5a6
|
@ -73,9 +73,6 @@ if (is_ajax ()) {
|
|||
if (is_metaconsole()) {
|
||||
$server_id = (int) get_parameter('serverID');
|
||||
$server = metaconsole_get_servers($server_id);
|
||||
|
||||
if (metaconsole_connect($server) != NOERR)
|
||||
return;
|
||||
}
|
||||
|
||||
ob_clean();
|
||||
|
@ -99,10 +96,6 @@ if (is_ajax ()) {
|
|||
}
|
||||
echo '<br></div>';
|
||||
|
||||
if (!empty($server) && is_metaconsole()) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,13 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head =
|
|||
enterprise_include_once ('meta/include/functions_ui_meta.php');
|
||||
enterprise_include_once ('meta/include/functions_metaconsole.php');
|
||||
|
||||
$user_access_node = can_user_access_node ();
|
||||
|
||||
if (is_metaconsole()) {
|
||||
if (metaconsole_connect($server_data) != NOERR)
|
||||
return;
|
||||
}
|
||||
|
||||
$filter["id_agente_modulo"] = $id_module;
|
||||
|
||||
$module = db_get_row_filter ("tagente_modulo", $filter);
|
||||
|
@ -48,13 +55,6 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head =
|
|||
return;
|
||||
}
|
||||
|
||||
/*if (! check_acl ($config["id_user"], $module["id_grupo"], "AR")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access Module Information");
|
||||
require_once ("general/noaccess.php");
|
||||
return;
|
||||
}*/
|
||||
|
||||
$table = new StdClass();
|
||||
$table->width = "100%";
|
||||
$table->class = "databox data";
|
||||
|
@ -142,7 +142,8 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head =
|
|||
foreach ($tags as $k => $v) {
|
||||
if (!array_key_exists($v, $user_tags)) { //only show user's tags.
|
||||
unset($tags[$k]);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$tag_name = tags_get_name($v);
|
||||
if (empty($tag_name)) {
|
||||
unset($tags[$k]);
|
||||
|
@ -305,7 +306,7 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head =
|
|||
$group_name = db_get_value('nombre', 'tgrupo', 'id_grupo', $id_group);
|
||||
$agent_name = db_get_value('nombre', 'tagente', 'id_agente', $module['id_agente']);
|
||||
|
||||
if (can_user_access_node () && check_acl ($config["id_user"], $id_group, 'AW')) {
|
||||
if ($user_access_node && check_acl ($config["id_user"], $id_group, 'AW')) {
|
||||
// Actions table
|
||||
echo '<div style="width:100%; text-align: right; min-width: 300px;">';
|
||||
echo '<a target=_blank href="' . $console_url . 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=' . $module['id_agente'] . '&tab=module&edit_module=1&id_agent_module=' . $module['id_agente_modulo'] . $url_hash . '">';
|
||||
|
@ -322,6 +323,10 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head =
|
|||
html_print_input_text('server_name', $server_name);
|
||||
echo '</div>';
|
||||
|
||||
if (!empty($server_data) && is_metaconsole()) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -341,6 +346,13 @@ function treeview_printAlertsTable($id_module, $server_data = array(), $no_head
|
|||
$url_hash = metaconsole_get_servers_url_hash($server_data);
|
||||
}
|
||||
|
||||
$user_access_node = can_user_access_node ();
|
||||
|
||||
if (is_metaconsole()) {
|
||||
if (metaconsole_connect($server_data) != NOERR)
|
||||
return;
|
||||
}
|
||||
|
||||
$module_alerts = alerts_get_alerts_agent_module($id_module);
|
||||
$module_name = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $id_module);
|
||||
$agent_id = db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $id_module);
|
||||
|
@ -427,7 +439,7 @@ function treeview_printAlertsTable($id_module, $server_data = array(), $no_head
|
|||
}
|
||||
html_print_table($table2);
|
||||
|
||||
if (can_user_access_node () && check_acl ($config["id_user"], $id_group, 'LW')) {
|
||||
if ($user_access_node && check_acl ($config["id_user"], $id_group, 'LW')) {
|
||||
// Actions table
|
||||
echo '<div style="width:100%; text-align: right; min-width: 300px;">';
|
||||
echo '<a target=_blank href="' . $console_url . 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&search=1&module_name=' . $module_name . '&id_agente=' . $agent_id . $url_hash . '" target="_blank">';
|
||||
|
@ -435,6 +447,12 @@ function treeview_printAlertsTable($id_module, $server_data = array(), $no_head
|
|||
echo '</a>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
if (!empty($server_data) && is_metaconsole()) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
function treeview_printTable($id_agente, $server_data = array(), $no_head = false) {
|
||||
|
@ -468,6 +486,15 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
|
|||
$is_extra = false;
|
||||
}
|
||||
|
||||
$user_access_node = can_user_access_node ();
|
||||
|
||||
if (is_metaconsole()) {
|
||||
if (metaconsole_connect($server_data) != NOERR)
|
||||
return;
|
||||
}
|
||||
|
||||
$agent = db_get_row ("tagente", "id_agente", $id_agente);
|
||||
|
||||
if (! check_acl ($config["id_user"], $agent["id_grupo"], "AR") && ! check_acl ($config["id_user"], $agent["id_grupo"], "AW") && !$is_extra) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access Agent General Information");
|
||||
|
@ -475,8 +502,6 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
|
|||
return;
|
||||
}
|
||||
|
||||
$agent = db_get_row ("tagente", "id_agente", $id_agente);
|
||||
|
||||
if ($agent === false) {
|
||||
ui_print_error_message(__('There was a problem loading agent'));
|
||||
return;
|
||||
|
@ -498,7 +523,7 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
|
|||
$cellName = '';
|
||||
}
|
||||
|
||||
$cellName .= ui_print_agent_name ($agent["id_agente"], true, 500, "text-transform: uppercase;", true, $console_url, $url_hash, false, can_user_access_node ());
|
||||
$cellName .= ui_print_agent_name ($agent["id_agente"], true, 500, "text-transform: uppercase;", true, $console_url, $url_hash, false, $user_access_node);
|
||||
|
||||
if ($agent['disabled']) {
|
||||
$cellName .= ui_print_help_tip(__('Disabled'), true) . "</em>";
|
||||
|
@ -567,7 +592,7 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
|
|||
//End of table
|
||||
$agent_table = html_print_table($table, true);
|
||||
|
||||
if (can_user_access_node () && check_acl ($config["id_user"], $agent["id_grupo"], "AW")) {
|
||||
if ( $user_access_node && check_acl ($config["id_user"], $agent["id_grupo"], "AW")) {
|
||||
$go_to_agent = '<div style="text-align: right;">';
|
||||
$go_to_agent .= '<a target=_blank href="' . $console_url . 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.$url_hash.'">';
|
||||
$go_to_agent .= html_print_submit_button (__('Go to agent edition'), 'upd_button', false, 'class="sub config"', true);
|
||||
|
@ -749,7 +774,10 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
|
|||
ui_toggle($table_interfaces, __('Interface information') . ' (SNMP)');
|
||||
}
|
||||
|
||||
if (!empty($server_data) && is_metaconsole()) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue