mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 16:55:05 +02:00
Merge branch 'develop' into feature/NewView
This commit is contained in:
commit
6cec43c5fa
@ -367,7 +367,8 @@ class Tree {
|
|||||||
AND ta.id_grupo = tg.id_grupo
|
AND ta.id_grupo = tg.id_grupo
|
||||||
$group_acl
|
$group_acl
|
||||||
$agent_search_filter
|
$agent_search_filter
|
||||||
$agent_status_filter";
|
$agent_status_filter
|
||||||
|
$module_search_filter";
|
||||||
$counter_columns = $this->getAgentCounterColumnsSql($agent_table);
|
$counter_columns = $this->getAgentCounterColumnsSql($agent_table);
|
||||||
if (!empty($counter_columns))
|
if (!empty($counter_columns))
|
||||||
$columns .= ", $counter_columns";
|
$columns .= ", $counter_columns";
|
||||||
@ -385,6 +386,7 @@ class Tree {
|
|||||||
$group_acl
|
$group_acl
|
||||||
$agent_search_filter
|
$agent_search_filter
|
||||||
$agent_status_filter
|
$agent_status_filter
|
||||||
|
$module_search_filter
|
||||||
GROUP BY tg.id_grupo
|
GROUP BY tg.id_grupo
|
||||||
ORDER BY $order_fields";
|
ORDER BY $order_fields";
|
||||||
}
|
}
|
||||||
@ -407,6 +409,7 @@ class Tree {
|
|||||||
$group_acl
|
$group_acl
|
||||||
$agent_search_filter
|
$agent_search_filter
|
||||||
$agent_status_filter
|
$agent_status_filter
|
||||||
|
$module_search_filter
|
||||||
GROUP BY ta.id_agente
|
GROUP BY ta.id_agente
|
||||||
ORDER BY $order_fields";
|
ORDER BY $order_fields";
|
||||||
}
|
}
|
||||||
|
@ -28,10 +28,6 @@ require_once ('functions_agents.php');
|
|||||||
require_once($config['homedir'] . "/include/functions_modules.php");
|
require_once($config['homedir'] . "/include/functions_modules.php");
|
||||||
require_once($config['homedir'] . "/include/functions_groups.php");
|
require_once($config['homedir'] . "/include/functions_groups.php");
|
||||||
ui_require_css_file ('cluetip');
|
ui_require_css_file ('cluetip');
|
||||||
$hack_metaconsole = '';
|
|
||||||
if (defined('METACONSOLE'))
|
|
||||||
$hack_metaconsole = '../../';
|
|
||||||
ui_require_jquery_file ('cluetip', $hack_metaconsole . 'include/javascript/');
|
|
||||||
|
|
||||||
// Check if a node descends from a given node
|
// Check if a node descends from a given node
|
||||||
function networkmap_is_descendant ($node, $ascendant, $parents) {
|
function networkmap_is_descendant ($node, $ascendant, $parents) {
|
||||||
@ -689,7 +685,6 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0,
|
|||||||
}
|
}
|
||||||
|
|
||||||
$filter['id_grupo'] = $id_groups;
|
$filter['id_grupo'] = $id_groups;
|
||||||
$filter['id_group'] = $id_groups;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($strict_user) {
|
if ($strict_user) {
|
||||||
@ -746,10 +741,12 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0,
|
|||||||
if ($depth != 'group') {
|
if ($depth != 'group') {
|
||||||
if ($strict_user) {
|
if ($strict_user) {
|
||||||
$filter['group_by'] = 'tagente.nombre';
|
$filter['group_by'] = 'tagente.nombre';
|
||||||
|
$filter['id_group'] = $filter['id_grupo'];
|
||||||
$fields = array ('tagente.id_grupo, tagente.nombre, tagente.id_os, tagente.id_agente,
|
$fields = array ('tagente.id_grupo, tagente.nombre, tagente.id_os, tagente.id_agente,
|
||||||
tagente.normal_count, tagente.warning_count, tagente.critical_count,
|
tagente.normal_count, tagente.warning_count, tagente.critical_count,
|
||||||
tagente.unknown_count, tagente.total_count, tagente.notinit_count');
|
tagente.unknown_count, tagente.total_count, tagente.notinit_count');
|
||||||
$agents = tags_get_all_user_agents (false, $config['id_user'], $acltags, $filter, $fields, false, $strict_user, true);
|
$agents = tags_get_all_user_agents (false, $config['id_user'], $acltags, $filter, $fields, false, $strict_user, true);
|
||||||
|
unset($filter['id_group']);
|
||||||
} else {
|
} else {
|
||||||
// Get agents data
|
// Get agents data
|
||||||
$agents = agents_get_agents ($filter,
|
$agents = agents_get_agents ($filter,
|
||||||
@ -1429,12 +1426,13 @@ function networkmap_open_graph ($layout, $nooverlap, $pure, $zoom, $ranksep, $fo
|
|||||||
$size = $size_x . ',' . $size_y;
|
$size = $size_x . ',' . $size_y;
|
||||||
|
|
||||||
// BEWARE: graphwiz DONT use single ('), you need double (")
|
// BEWARE: graphwiz DONT use single ('), you need double (")
|
||||||
$head = "graph networkmap { bgcolor=\"transparent\"; labeljust=l; margin=0; ";
|
$head = "graph networkmap { bgcolor=\"transparent\"; labeljust=l; margin=0; pad=\"0.75,0.75\";";
|
||||||
if ($nooverlap != '') {
|
if ($nooverlap != '') {
|
||||||
$head .= "overlap=\"$overlap\";";
|
$head .= "overlap=\"$overlap\";";
|
||||||
$head .= "ranksep=\"$ranksep\";";
|
$head .= "ranksep=\"$ranksep\";";
|
||||||
$head .= "outputorder=edgesfirst;";
|
$head .= "outputorder=edgesfirst;";
|
||||||
}
|
}
|
||||||
|
|
||||||
$head .= "ratio=fill;";
|
$head .= "ratio=fill;";
|
||||||
$head .= "root=0;";
|
$head .= "root=0;";
|
||||||
$head .= "size=\"$size\";";
|
$head .= "size=\"$size\";";
|
||||||
@ -1491,36 +1489,40 @@ function networkmap_get_filter ($layout) {
|
|||||||
*
|
*
|
||||||
* @return mixed New networkmap id if created. False if it could not be created.
|
* @return mixed New networkmap id if created. False if it could not be created.
|
||||||
*/
|
*/
|
||||||
function networkmap_create_networkmap ($name, $type = 'topology', $layout = 'radial', $nooverlap = true, $simple = false, $regenerate = true, $font_size = 12, $id_group = 0, $id_module_group = 0, $depth = 'all', $only_modules_with_alerts = false, $hide_policy_modules = false, $zoom = 1, $distance_nodes = 2.5, $center = 0, $text_filter = '', $dont_show_subgroups = 0, $show_groups = false, $show_modules = false, $pandoras_children = false) {
|
function networkmap_create_networkmap ($values) {
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$values = array();
|
// The name is required
|
||||||
|
if (! isset($values['name']))
|
||||||
|
return false;
|
||||||
|
|
||||||
$values['name'] = $name;
|
// Set defaults for the empty values
|
||||||
$values['type'] = $type;
|
set_unless_defined ($values['type'], 'topology');
|
||||||
$values['layout'] = $layout;
|
set_unless_defined ($values['layout'], 'radial');
|
||||||
$values['nooverlap'] = $nooverlap;
|
set_unless_defined ($values['nooverlap'], true);
|
||||||
$values['simple'] = $simple;
|
set_unless_defined ($values['simple'], false);
|
||||||
$values['regenerate'] = $regenerate;
|
set_unless_defined ($values['regenerate'], true);
|
||||||
$values['font_size'] = $font_size;
|
set_unless_defined ($values['font_size'], 12);
|
||||||
$values['id_group'] = $id_group;
|
set_unless_defined ($values['store_group'], 0);
|
||||||
$values['id_module_group'] = $id_module_group;
|
set_unless_defined ($values['id_group'], 0);
|
||||||
$values['depth'] = $depth;
|
set_unless_defined ($values['regenerate'], true);
|
||||||
$values['only_modules_with_alerts'] = $only_modules_with_alerts;
|
set_unless_defined ($values['id_module_group'], 0);
|
||||||
$values['hide_policy_modules'] = $hide_policy_modules;
|
set_unless_defined ($values['depth'], 'all');
|
||||||
$values['zoom'] = $zoom;
|
set_unless_defined ($values['only_modules_with_alerts'], false);
|
||||||
$values['distance_nodes'] = $distance_nodes;
|
set_unless_defined ($values['hide_policy_modules'], false);
|
||||||
$values['center'] = $center;
|
set_unless_defined ($values['zoom'], 1);
|
||||||
$values['id_user'] = $config['id_user'];
|
set_unless_defined ($values['distance_nodes'], 2.5);
|
||||||
$values['text_filter'] = $text_filter;
|
set_unless_defined ($values['center'], 0);
|
||||||
$values['dont_show_subgroups'] = $dont_show_subgroups;
|
set_unless_defined ($values['id_user'], $config['id_user']);
|
||||||
|
set_unless_defined ($values['text_filter'], '');
|
||||||
$values['pandoras_children'] = $pandoras_children;
|
set_unless_defined ($values['regenerate'], true);
|
||||||
$values['show_groups'] = $show_groups;
|
set_unless_defined ($values['dont_show_subgroups'], 0);
|
||||||
$values['show_modules'] = $show_modules;
|
set_unless_defined ($values['show_groups'], false);
|
||||||
|
set_unless_defined ($values['pandoras_children'], false);
|
||||||
$values['server_name'] = "";
|
set_unless_defined ($values['show_modules'], false);
|
||||||
|
set_unless_defined ($values['show_snmp_modules'], 0);
|
||||||
|
set_unless_defined ($values['l2_network'], 0);
|
||||||
|
set_unless_defined ($values['server_name'], '');
|
||||||
|
|
||||||
return @db_process_sql_insert('tnetwork_map', $values);
|
return @db_process_sql_insert('tnetwork_map', $values);
|
||||||
}
|
}
|
||||||
@ -1790,14 +1792,41 @@ function networkmap_get_new_nodes_from_ip_mask($ip_mask, $fields = array(), $str
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
<script language="javascript" type="text/javascript">
|
<script language="javascript" type="text/javascript">
|
||||||
/* <![CDATA[ */
|
|
||||||
$(document).ready (function () {
|
$(document).ready (function () {
|
||||||
$("area[title!='<?php echo 'Pandora FMS'; ?>']").cluetip ({
|
// TODO: Implement the jquery tooltip functionality everywhere
|
||||||
arrows: true,
|
// and remove the cluetip code.
|
||||||
attribute: 'title',
|
$("area[title!='<?php echo 'Pandora FMS'; ?>']")
|
||||||
cluetipClass: 'default',
|
.each(function (index, element) {
|
||||||
positionBy: "bottomTop"
|
// Store the title.
|
||||||
|
// The title stores the url into a data property
|
||||||
|
$(element).data('uri', $(element).prop('title'));
|
||||||
|
})
|
||||||
|
.tooltip({
|
||||||
|
track: true,
|
||||||
|
content: '<?php html_print_image("images/spinner.gif"); ?>',
|
||||||
|
open: function (evt, ui) {
|
||||||
|
var elem = $(this);
|
||||||
|
var uri = elem.data('uri');
|
||||||
|
|
||||||
|
if (typeof uri != 'undefined' && uri.length > 0) {
|
||||||
|
var jqXHR = $.ajax(uri).done(function(data) {
|
||||||
|
elem.tooltip('option', 'content', data);
|
||||||
|
});
|
||||||
|
// Store the connection handler
|
||||||
|
elem.data('jqXHR', jqXHR);
|
||||||
|
}
|
||||||
|
|
||||||
|
$(".ui-tooltip>.ui-tooltip-content:not(.cluetip-default)")
|
||||||
|
.addClass("cluetip-default");
|
||||||
|
},
|
||||||
|
close: function (evt, ui) {
|
||||||
|
var elem = $(this);
|
||||||
|
var jqXHR = elem.data('jqXHR');
|
||||||
|
|
||||||
|
// Close the connection handler
|
||||||
|
if (typeof jqXHR != 'undefined')
|
||||||
|
jqXHR.abort();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
/* ]]> */
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -21,16 +21,21 @@ class Networkmap {
|
|||||||
private $id = 0;
|
private $id = 0;
|
||||||
private $network_map = null;
|
private $network_map = null;
|
||||||
|
|
||||||
function __construct() {
|
function __construct($id = false) {
|
||||||
$system = System::getInstance();
|
$system = System::getInstance();
|
||||||
|
|
||||||
if ($system->checkACL($this->acl)) {
|
if ($id === false)
|
||||||
|
$this->getFilters();
|
||||||
|
else
|
||||||
|
$this->id = $id;
|
||||||
|
|
||||||
|
$store_group = db_get_value('store_group',
|
||||||
|
'tnetwork_map', 'id_networkmap', $this->id);
|
||||||
|
|
||||||
|
if ($store_group !== false
|
||||||
|
&& $system->checkACL($this->acl, $store_group))
|
||||||
$this->correct_acl = true;
|
$this->correct_acl = true;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
$this->correct_acl = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function ajax($parameter2 = false) {
|
public function ajax($parameter2 = false) {
|
||||||
$system = System::getInstance();
|
$system = System::getInstance();
|
||||||
|
@ -168,10 +168,10 @@ class Networkmaps {
|
|||||||
$where['order'] = 'type';
|
$where['order'] = 'type';
|
||||||
|
|
||||||
if ($this->group != '0') {
|
if ($this->group != '0') {
|
||||||
$where['id_group'] = $this->group;
|
$where['store_group'] = $this->group;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$where['id_group'] = array_keys(users_get_groups());
|
$where['store_group'] = array_keys(users_get_groups());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->type != '0')
|
if ($this->type != '0')
|
||||||
@ -184,13 +184,17 @@ class Networkmaps {
|
|||||||
}
|
}
|
||||||
$list = array();
|
$list = array();
|
||||||
foreach ($network_maps as $networkmap) {
|
foreach ($network_maps as $networkmap) {
|
||||||
|
// ACL
|
||||||
|
if (! $system->checkACL("AR", $networkmap['store_group']))
|
||||||
|
continue;
|
||||||
|
|
||||||
// If enterprise not loaded then skip this code
|
// If enterprise not loaded then skip this code
|
||||||
if ($networkmap['type'] == 'policies' and (!defined('PANDORA_ENTERPRISE')))
|
if ($networkmap['type'] == 'policies' and (!defined('PANDORA_ENTERPRISE')))
|
||||||
continue;
|
continue;
|
||||||
$row = array();
|
$row = array();
|
||||||
$row[__('Name')] = '<a class="ui-link" data-ajax="false" href="index.php?page=networkmap&id=' . $networkmap['id_networkmap'] . '">' . io_safe_output($networkmap['name']) . '</a>';
|
$row[__('Name')] = '<a class="ui-link" data-ajax="false" href="index.php?page=networkmap&id=' . $networkmap['id_networkmap'] . '">' . io_safe_output($networkmap['name']) . '</a>';
|
||||||
$row[__('Type')] = $networkmap['type'];
|
$row[__('Type')] = $networkmap['type'];
|
||||||
$row[__('Group')] = ui_print_group_icon($networkmap["id_group"], true, "groups_small", "" , false);
|
$row[__('Group')] = ui_print_group_icon($networkmap["store_group"], true, "groups_small", "" , false);
|
||||||
$list[] = $row;
|
$list[] = $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ global $config;
|
|||||||
|
|
||||||
check_login ();
|
check_login ();
|
||||||
|
|
||||||
if (! check_acl ($config['id_user'], 0, "AR")) {
|
if (! check_acl ($config['id_user'], $store_group, "AR")) {
|
||||||
db_pandora_audit("ACL Violation",
|
db_pandora_audit("ACL Violation",
|
||||||
"Trying to access node graph builder");
|
"Trying to access node graph builder");
|
||||||
include ("general/noaccess.php");
|
include ("general/noaccess.php");
|
||||||
|
@ -19,7 +19,7 @@ global $config;
|
|||||||
|
|
||||||
check_login ();
|
check_login ();
|
||||||
|
|
||||||
if (! check_acl ($config['id_user'], 0, "AR")) {
|
if (! check_acl ($config['id_user'], $store_group, "AR")) {
|
||||||
db_pandora_audit("ACL Violation",
|
db_pandora_audit("ACL Violation",
|
||||||
"Trying to access node graph builder");
|
"Trying to access node graph builder");
|
||||||
include ("general/noaccess.php");
|
include ("general/noaccess.php");
|
||||||
|
@ -66,36 +66,45 @@ if ($add_networkmap) {
|
|||||||
$font_size = 12;
|
$font_size = 12;
|
||||||
$text_filter = '';
|
$text_filter = '';
|
||||||
$dont_show_subgroups = false;
|
$dont_show_subgroups = false;
|
||||||
|
$store_group = 0;
|
||||||
$group = 0;
|
$group = 0;
|
||||||
$module_group = 0;
|
$module_group = 0;
|
||||||
$center = 0;
|
$center = 0;
|
||||||
$name = $activeTab;
|
$name = $activeTab;
|
||||||
|
$show_snmp_modules = 0;
|
||||||
|
$l2_network = 0;
|
||||||
$check = db_get_value('name', 'tnetwork_map', 'name', $name);
|
$check = db_get_value('name', 'tnetwork_map', 'name', $name);
|
||||||
$sql = db_get_value_filter('COUNT(name)', 'tnetwork_map',
|
$sql = db_get_value_filter('COUNT(name)', 'tnetwork_map',
|
||||||
array('name' => "%$name"));
|
array('name' => "%$name"));
|
||||||
|
|
||||||
if ($check) {
|
$values = array(
|
||||||
$id_networkmap = networkmap_create_networkmap("($sql) ".$name,
|
'name' => ($check ? "($sql) $name" : $name),
|
||||||
$activeTab, $layout, $nooverlap, $simple, $regen,
|
'type' => $activeTab,
|
||||||
$font_size, $group, $module_group, $depth, $modwithalerts,
|
'layout' => $layout,
|
||||||
$hidepolicymodules, $zoom, $ranksep, $center, $text_filter,
|
'nooverlap' => $nooverlap,
|
||||||
$dont_show_subgroups);
|
'simple' => $simple,
|
||||||
|
'regenerate' => $regen,
|
||||||
|
'font_size' => $font_size,
|
||||||
|
'store_group' => $store_group,
|
||||||
|
'id_group' => $group,
|
||||||
|
'id_module_group' => $module_group,
|
||||||
|
'depth' => $depth,
|
||||||
|
'only_modules_with_alerts' => $modwithalerts,
|
||||||
|
'hide_policy_modules' => $hidepolicymodules,
|
||||||
|
'zoom' => $zoom,
|
||||||
|
'distance_nodes' => $ranksep,
|
||||||
|
'text_filter' => $text_filter,
|
||||||
|
'dont_show_subgroups' => $dont_show_subgroups,
|
||||||
|
'center' => $center,
|
||||||
|
'show_snmp_modules' => $show_snmp_modules,
|
||||||
|
'l2_network' => $l2_network
|
||||||
|
);
|
||||||
|
$id_networkmap = networkmap_create_networkmap($values);
|
||||||
|
|
||||||
$message = ui_print_result_message ($id_networkmap,
|
$message = ui_print_result_message ($id_networkmap,
|
||||||
__('Network map created successfully'),
|
__('Network map created successfully'),
|
||||||
__('Could not create network map'), '', true);
|
__('Could not create network map'), '', true);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
$id_networkmap = networkmap_create_networkmap($name, $activeTab,
|
|
||||||
$layout, $nooverlap, $simple, $regen, $font_size, $group,
|
|
||||||
$module_group, $depth, $modwithalerts, $hidepolicymodules,
|
|
||||||
$zoom, $ranksep, $center, $text_filter, $dont_show_subgroups);
|
|
||||||
|
|
||||||
$message = ui_print_result_message ($id_networkmap,
|
|
||||||
__('Network map created successfully'),
|
|
||||||
__('Could not create network map'), '', true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($save_networkmap || $update_networkmap) {
|
if ($save_networkmap || $update_networkmap) {
|
||||||
// Load variables
|
// Load variables
|
||||||
@ -112,6 +121,7 @@ if ($save_networkmap || $update_networkmap) {
|
|||||||
$font_size = (int) get_parameter ('font_size', 12);
|
$font_size = (int) get_parameter ('font_size', 12);
|
||||||
$text_filter = get_parameter ('text_filter', '');
|
$text_filter = get_parameter ('text_filter', '');
|
||||||
$dont_show_subgroups = (bool)get_parameter ('dont_show_subgroups', 0);
|
$dont_show_subgroups = (bool)get_parameter ('dont_show_subgroups', 0);
|
||||||
|
$store_group = (int) get_parameter ('store_group', 0);
|
||||||
$group = (int) get_parameter ('group', 0);
|
$group = (int) get_parameter ('group', 0);
|
||||||
$module_group = (int) get_parameter ('module_group', 0);
|
$module_group = (int) get_parameter ('module_group', 0);
|
||||||
$center = (int) get_parameter ('center', 0);
|
$center = (int) get_parameter ('center', 0);
|
||||||
@ -127,6 +137,7 @@ if ($save_networkmap || $update_networkmap) {
|
|||||||
'simple' => $simple,
|
'simple' => $simple,
|
||||||
'regenerate' => $regen,
|
'regenerate' => $regen,
|
||||||
'font_size' => $font_size,
|
'font_size' => $font_size,
|
||||||
|
'store_group' => $store_group,
|
||||||
'id_group' => $group,
|
'id_group' => $group,
|
||||||
'id_module_group' => $module_group,
|
'id_module_group' => $module_group,
|
||||||
'depth' => $depth,
|
'depth' => $depth,
|
||||||
@ -177,6 +188,7 @@ if (!$update_networkmap && !$save_networkmap && $id_networkmap != 0) {
|
|||||||
$font_size = $networkmap_data['font_size'];
|
$font_size = $networkmap_data['font_size'];
|
||||||
$text_filter = $networkmap_data['text_filter'];
|
$text_filter = $networkmap_data['text_filter'];
|
||||||
$dont_show_subgroups = $networkmap_data['dont_show_subgroups'];
|
$dont_show_subgroups = $networkmap_data['dont_show_subgroups'];
|
||||||
|
$store_group = $networkmap_data['store_group'];
|
||||||
$group = $networkmap_data['id_group'];
|
$group = $networkmap_data['id_group'];
|
||||||
$module_group = $networkmap_data['id_module_group'];
|
$module_group = $networkmap_data['id_module_group'];
|
||||||
$center = $networkmap_data['center'];
|
$center = $networkmap_data['center'];
|
||||||
@ -252,6 +264,7 @@ if (check_acl ($config['id_user'], 0, "RW") || check_acl ($config['id_user'], 0,
|
|||||||
'tab=' . $activeTab . '&' .
|
'tab=' . $activeTab . '&' .
|
||||||
'save_networkmap=1&' .
|
'save_networkmap=1&' .
|
||||||
'name=' . $name . '&' .
|
'name=' . $name . '&' .
|
||||||
|
'store_group=' . $store_group . '&' .
|
||||||
'group=' . $group . '&' .
|
'group=' . $group . '&' .
|
||||||
'layout=' . $layout . '&' .
|
'layout=' . $layout . '&' .
|
||||||
'nooverlap=' . $nooverlap . '&' .
|
'nooverlap=' . $nooverlap . '&' .
|
||||||
@ -328,84 +341,88 @@ $layout_array = array (
|
|||||||
|
|
||||||
$options_form = '<form action="index.php?sec=network&sec2=operation/agentes/networkmap&id_networkmap='.$id_networkmap.'&tab='.$activeTab.'&pure='.$pure.'&center='.$center.'" method="post">';
|
$options_form = '<form action="index.php?sec=network&sec2=operation/agentes/networkmap&id_networkmap='.$id_networkmap.'&tab='.$activeTab.'&pure='.$pure.'&center='.$center.'" method="post">';
|
||||||
|
|
||||||
|
// Fill an array with the form inputs
|
||||||
|
$form_elems = array();
|
||||||
|
|
||||||
|
// Name
|
||||||
unset($table);
|
$element = __('Name') . ' ' .
|
||||||
$table->width = '98%';
|
|
||||||
$table->class = 'databox';
|
|
||||||
$table->data = array();
|
|
||||||
$table->data[0][] = __('Name:') . ' ' .
|
|
||||||
html_print_input_text ('name', $name, '', 25, 50, true);
|
html_print_input_text ('name', $name, '', 25, 50, true);
|
||||||
if ($activeTab == 'groups'){
|
if ($activeTab == 'groups')
|
||||||
$table->data[0][0] .= clippy_context_help("topology_group");
|
$element .= clippy_context_help("topology_group");
|
||||||
}
|
$form_elems[] = $element;
|
||||||
$table->data[0][] = __('Group:') . ' ' .
|
|
||||||
|
// Store group
|
||||||
|
$form_elems[] = __('Store group') . ' ' .
|
||||||
|
html_print_select_groups(false, 'AR', false, 'store_group', $store_group, '', 'All', 0, true);
|
||||||
|
|
||||||
|
// Group
|
||||||
|
$form_elems[] = __('Group') . ' ' .
|
||||||
html_print_select_groups(false, 'AR', false, 'group', $group, '', 'All', 0, true);
|
html_print_select_groups(false, 'AR', false, 'group', $group, '', 'All', 0, true);
|
||||||
|
|
||||||
|
// Module group
|
||||||
if ($activeTab == 'groups' || $activeTab == 'policies' || $activeTab == 'radial_dynamic') {
|
if ($activeTab == 'groups' || $activeTab == 'policies' || $activeTab == 'radial_dynamic') {
|
||||||
$table->data[0][] = __('Module group') . ' ' .
|
$form_elems[] = __('Module group') . ' ' .
|
||||||
html_print_select_from_sql ('
|
html_print_select_from_sql ('
|
||||||
SELECT id_mg, name
|
SELECT id_mg, name
|
||||||
FROM tmodule_group', 'module_group', $module_group, '', 'All', 0, true);
|
FROM tmodule_group', 'module_group', $module_group, '', 'All', 0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Interfaces
|
||||||
if ($activeTab == 'topology') {
|
if ($activeTab == 'topology') {
|
||||||
$table->data[0][] = __('Show interfaces') . ' ' .
|
$form_elems[] = __('Show interfaces') . ' ' .
|
||||||
html_print_checkbox ('show_snmp_modules', '1', $show_snmp_modules, true);
|
html_print_checkbox ('show_snmp_modules', '1', $show_snmp_modules, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Layout
|
||||||
if ($activeTab != 'dinamic' && $activeTab != 'radial_dynamic') {
|
if ($activeTab != 'dinamic' && $activeTab != 'radial_dynamic') {
|
||||||
$table->data[0][] = __('Layout') . ' ' .
|
$form_elems[] = __('Layout') . ' ' .
|
||||||
html_print_select ($layout_array, 'layout', $layout, '', '', '', true);
|
html_print_select ($layout_array, 'layout', $layout, '', '', '', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Depth
|
||||||
if ($activeTab == 'groups') {
|
if ($activeTab == 'groups') {
|
||||||
$depth_levels = array(
|
$depth_levels = array(
|
||||||
'all' => __('All'),
|
'all' => __('All'),
|
||||||
'agent' => __('Agents'),
|
'agent' => __('Agents'),
|
||||||
'group' => __('Groups'));
|
'group' => __('Groups'));
|
||||||
$table->data[0][] = __('Depth') . ' ' .
|
$form_elems[] = __('Depth') . ' ' .
|
||||||
html_print_select ($depth_levels, 'depth', $depth, '', '', '', true, false, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($activeTab == 'policies') {
|
|
||||||
$depth_levels = array(
|
|
||||||
'all' => __('All'),
|
|
||||||
'agent' => __('Agents'),
|
|
||||||
'policy' => __('Policies'));
|
|
||||||
$table->data[0][] = __('Depth') . ' ' .
|
|
||||||
html_print_select ($depth_levels, 'depth', $depth, '', '', '', true, false, false);
|
html_print_select ($depth_levels, 'depth', $depth, '', '', '', true, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// No overlap
|
||||||
if ($activeTab != 'dinamic' && $activeTab != 'radial_dynamic') {
|
if ($activeTab != 'dinamic' && $activeTab != 'radial_dynamic') {
|
||||||
$table->data[1][] = __('No Overlap') . ' ' .
|
$form_elems[] = __('No Overlap') . ' ' .
|
||||||
html_print_checkbox ('nooverlap', '1', $nooverlap, true);
|
html_print_checkbox ('nooverlap', '1', $nooverlap, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($activeTab == 'groups' || $activeTab == 'policies') &&
|
// Modules with alerts
|
||||||
$depth == 'all') {
|
if (($activeTab == 'groups' || $activeTab == 'policies') && $depth == 'all') {
|
||||||
$table->data[1][] = __('Only modules with alerts') . ' ' .
|
$form_elems[] = __('Only modules with alerts') . ' ' .
|
||||||
html_print_checkbox ('modwithalerts', '1', $modwithalerts, true);
|
html_print_checkbox ('modwithalerts', '1', $modwithalerts, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hide policy modules
|
||||||
if ($activeTab == 'groups') {
|
if ($activeTab == 'groups') {
|
||||||
if ($config['enterprise_installed']) {
|
if ($config['enterprise_installed']) {
|
||||||
$table->data[1][] = __('Hide policy modules') . ' ' .
|
$form_elems[] = __('Hide policy modules') . ' ' .
|
||||||
html_print_checkbox ('hidepolicymodules', '1', $hidepolicymodules, true);
|
html_print_checkbox ('hidepolicymodules', '1', $hidepolicymodules, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
// Simple
|
||||||
if ($activeTab != 'dinamic' && $activeTab != 'radial_dynamic') {
|
if ($activeTab != 'dinamic' && $activeTab != 'radial_dynamic') {
|
||||||
$table->data[1][] = __('Simple') . ' ' .
|
$form_elems[] = __('Simple') . ' ' .
|
||||||
html_print_checkbox ('simple', '1', $simple, true);
|
html_print_checkbox ('simple', '1', $simple, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Regenerate
|
||||||
if ($activeTab != 'dinamic' && $activeTab != 'radial_dynamic') {
|
if ($activeTab != 'dinamic' && $activeTab != 'radial_dynamic') {
|
||||||
$table->data[1][] = __('Regenerate') . ' ' .
|
$form_elems[] = __('Regenerate') . ' ' .
|
||||||
html_print_checkbox ('regen', '1', $regen, true);
|
html_print_checkbox ('regen', '1', $regen, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($pure == "1") {
|
|
||||||
// Zoom
|
// Zoom
|
||||||
|
if ($pure == "1") {
|
||||||
$zoom_array = array (
|
$zoom_array = array (
|
||||||
'1' => 'x1',
|
'1' => 'x1',
|
||||||
'1.2' => 'x2',
|
'1.2' => 'x2',
|
||||||
@ -415,38 +432,62 @@ if ($pure == "1") {
|
|||||||
'5' => 'x10',
|
'5' => 'x10',
|
||||||
);
|
);
|
||||||
|
|
||||||
$table->data[1][] = __('Zoom') . ' ' .
|
$form_elems[] = __('Zoom') . ' ' .
|
||||||
html_print_select ($zoom_array, 'zoom', $zoom, '', '', '', true, false, false, false);
|
html_print_select ($zoom_array, 'zoom', $zoom, '', '', '', true, false, false, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Font
|
||||||
if ($activeTab != 'dinamic' && $activeTab != 'radial_dynamic') {
|
if ($activeTab != 'dinamic' && $activeTab != 'radial_dynamic') {
|
||||||
$table->data[1][] = __('Font') . ' ' .
|
$form_elems[] = __('Font') . ' ' .
|
||||||
html_print_input_text ('font_size', $font_size, $alt = 'Font size (in pt)', 2, 4, true);
|
html_print_input_text ('font_size', $font_size, $alt = 'Font size (in pt)', 2, 4, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Free text
|
||||||
if ($activeTab != 'radial_dynamic') {
|
if ($activeTab != 'radial_dynamic') {
|
||||||
$table->data[2][] = __('Free text for search (*):') . ' ' .
|
$form_elems[] = __('Free text for search (*):') . ' ' .
|
||||||
html_print_input_text('text_filter', $text_filter, '', 30, 100, true);
|
html_print_input_text('text_filter', $text_filter, '', 30, 100, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't show subgroups
|
||||||
if (($activeTab == 'groups') || ($activeTab == 'topology')) {
|
if (($activeTab == 'groups') || ($activeTab == 'topology')) {
|
||||||
$table->data[2][] = __('Don\'t show subgroups:') .
|
$form_elems[] = __('Don\'t show subgroups:') .
|
||||||
ui_print_help_tip(__('Only run with it is filter for any group'), true) .
|
ui_print_help_tip(__('Only run with it is filter for any group'), true) .
|
||||||
' ' .
|
' ' .
|
||||||
html_print_checkbox ('dont_show_subgroups', '1', $dont_show_subgroups, true);
|
html_print_checkbox ('dont_show_subgroups', '1', $dont_show_subgroups, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// L2 network
|
||||||
if ($activeTab == 'topology') {
|
if ($activeTab == 'topology') {
|
||||||
$table->data[2][] = __('L2 network interfaces') . ' ' .
|
$form_elems[] = __('L2 network interfaces') . ' ' .
|
||||||
html_print_checkbox ('l2_network', '1', $l2_network, true);
|
html_print_checkbox ('l2_network', '1', $l2_network, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Distance between nodes
|
||||||
if ($nooverlap == 1) {
|
if ($nooverlap == 1) {
|
||||||
$table->data[2][] = __('Distance between nodes') . ' ' .
|
$form_elems[] = __('Distance between nodes') . ' ' .
|
||||||
html_print_input_text ('ranksep', $ranksep, __('Separation between elements in the map (in Non-overlap mode)'), 3, 4, true);
|
html_print_input_text ('ranksep', $ranksep, __('Separation between elements in the map (in Non-overlap mode)'), 3, 4, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unset($table);
|
||||||
|
$table->width = '98%';
|
||||||
|
$table->class = 'databox';
|
||||||
|
$table->data = array();
|
||||||
|
|
||||||
|
$max_col = 5;
|
||||||
|
$col = 0;
|
||||||
|
$row = 0;
|
||||||
|
|
||||||
|
foreach ($form_elems as $key => $element) {
|
||||||
|
if ($col >= $max_col) {
|
||||||
|
$col = 0;
|
||||||
|
$row++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$table->data[$row][$col] = $element;
|
||||||
|
$col++;
|
||||||
|
}
|
||||||
|
|
||||||
$options_form .= html_print_input_hidden('update_networkmap',1, true) .
|
$options_form .= html_print_input_hidden('update_networkmap',1, true) .
|
||||||
html_print_input_hidden('hidden_options',0, true);
|
html_print_input_hidden('hidden_options',0, true);
|
||||||
$options_form .= html_print_table ($table, true);
|
$options_form .= html_print_table ($table, true);
|
||||||
|
@ -19,7 +19,7 @@ global $config;
|
|||||||
|
|
||||||
check_login ();
|
check_login ();
|
||||||
|
|
||||||
if (! check_acl ($config['id_user'], 0, "AR")) {
|
if (! check_acl ($config['id_user'], $store_group, "AR")) {
|
||||||
db_pandora_audit("ACL Violation",
|
db_pandora_audit("ACL Violation",
|
||||||
"Trying to access node graph builder");
|
"Trying to access node graph builder");
|
||||||
include ("general/noaccess.php");
|
include ("general/noaccess.php");
|
||||||
|
@ -38,36 +38,30 @@ if (is_ajax()) {
|
|||||||
|
|
||||||
$delete_networkmaps = (bool) get_parameter('delete_networkmaps');
|
$delete_networkmaps = (bool) get_parameter('delete_networkmaps');
|
||||||
if ($delete_networkmaps) {
|
if ($delete_networkmaps) {
|
||||||
if ( check_acl ($config['id_user'], 0, "RW") || check_acl ($config['id_user'], 0, "RM") ) {
|
|
||||||
if (check_acl ($config['id_user'], 0, "RM")) {
|
|
||||||
$result = false;
|
|
||||||
$results = array();
|
$results = array();
|
||||||
$ids_networkmap = (array) get_parameter('ids_networkmap');
|
$ids_networkmap = (array) get_parameter('ids_networkmap');
|
||||||
|
|
||||||
foreach ($ids_networkmap as $id) {
|
foreach ($ids_networkmap as $id) {
|
||||||
|
$store_group = (int) db_get_value('store_group', 'tnetwork_map', 'id_networkmap',$id_networkmap);
|
||||||
|
|
||||||
|
if (check_acl ($config['id_user'], $store_group, "RM")) {
|
||||||
$results[$id] = (bool) networkmap_delete_networkmap($id);
|
$results[$id] = (bool) networkmap_delete_networkmap($id);
|
||||||
}
|
}
|
||||||
echo json_encode($results);
|
else if (check_acl ($config['id_user'], $store_group, "RW")) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if (check_acl ($config['id_user'], 0, "RW")) {
|
|
||||||
$result = false;
|
|
||||||
$results = array();
|
|
||||||
$ids_networkmap = (array) get_parameter ('ids_networkmap');
|
|
||||||
foreach ($ids_networkmap as $id) {
|
|
||||||
$results[$id] = (bool) networkmap_delete_user_networkmap($config['id_user'], $id);
|
$results[$id] = (bool) networkmap_delete_user_networkmap($config['id_user'], $id);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// None permission
|
||||||
|
if (!empty($ids_networkmap) && empty($results)) {
|
||||||
|
db_pandora_audit("ACL Violation", "Trying to access Networkmap deletion");
|
||||||
|
$results = -1;
|
||||||
|
}
|
||||||
|
|
||||||
echo json_encode($results);
|
echo json_encode($results);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}else{
|
|
||||||
db_pandora_audit("ACL Violation",
|
|
||||||
"Trying to access Networkmap deletion");
|
|
||||||
echo json_encode(-1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,12 +164,12 @@ $id_groups = array_keys(users_get_groups());
|
|||||||
|
|
||||||
// Create filter
|
// Create filter
|
||||||
$where = array();
|
$where = array();
|
||||||
$where['id_group'] = $id_groups;
|
$where['store_group'] = $id_groups;
|
||||||
// Order by type field
|
// Order by type field
|
||||||
$where['order'] = 'type';
|
$where['order'] = 'type';
|
||||||
|
|
||||||
if (!empty($group_search))
|
if (!empty($group_search))
|
||||||
$where['id_group'] = $group_search;
|
$where['store_group'] = $group_search;
|
||||||
|
|
||||||
if ($type_search != '0')
|
if ($type_search != '0')
|
||||||
$where['type'] = $type_search;
|
$where['type'] = $type_search;
|
||||||
@ -183,11 +177,6 @@ if ($type_search != '0')
|
|||||||
//Check for maps only visible for this user
|
//Check for maps only visible for this user
|
||||||
$user_info = users_get_user_by_id($config['id_user']);
|
$user_info = users_get_user_by_id($config['id_user']);
|
||||||
|
|
||||||
//If the user is not admin only user map are shown.
|
|
||||||
//if (!$user_info['is_admin']) {
|
|
||||||
// $where['id_user'] = $config['id_user'];
|
|
||||||
//}
|
|
||||||
|
|
||||||
$network_maps = db_get_all_rows_filter('tnetwork_map', $where);
|
$network_maps = db_get_all_rows_filter('tnetwork_map', $where);
|
||||||
|
|
||||||
if ($network_maps === false) {
|
if ($network_maps === false) {
|
||||||
@ -197,6 +186,10 @@ if ($network_maps === false) {
|
|||||||
else {
|
else {
|
||||||
$table->data = array();
|
$table->data = array();
|
||||||
foreach ($network_maps as $network_map) {
|
foreach ($network_maps as $network_map) {
|
||||||
|
// ACL
|
||||||
|
if (!check_acl ($config['id_user'], $network_map['store_group'], "RR"))
|
||||||
|
continue;
|
||||||
|
|
||||||
// If enterprise not loaded then skip this code
|
// If enterprise not loaded then skip this code
|
||||||
if ($network_map['type'] == 'policies' and (!defined('PANDORA_ENTERPRISE')))
|
if ($network_map['type'] == 'policies' and (!defined('PANDORA_ENTERPRISE')))
|
||||||
continue;
|
continue;
|
||||||
@ -208,14 +201,19 @@ else {
|
|||||||
$data = array();
|
$data = array();
|
||||||
$data[0] = '<b><a href="index.php?sec=network&sec2=operation/agentes/networkmap&tab=view&id_networkmap=' . $network_map['id_networkmap'] . '">' . $network_map['name'] . '</a></b>';
|
$data[0] = '<b><a href="index.php?sec=network&sec2=operation/agentes/networkmap&tab=view&id_networkmap=' . $network_map['id_networkmap'] . '">' . $network_map['name'] . '</a></b>';
|
||||||
$data[1] = $network_map['type'];
|
$data[1] = $network_map['type'];
|
||||||
|
$data[2] = ui_print_group_icon ($network_map['store_group'], true);
|
||||||
|
|
||||||
$data[2] = ui_print_group_icon ($network_map['id_group'], true);
|
if (check_acl ($config['id_user'], $network_map['store_group'], "RW") || check_acl ($config['id_user'], $network_map['store_group'], "RM")) {
|
||||||
if (check_acl ($config['id_user'], 0, "RW") || check_acl ($config['id_user'], 0, "RM")) {
|
|
||||||
$data[3] = '<a href="index.php?sec=network&sec2=operation/agentes/networkmap&tab=edit&edit_networkmap=1&id_networkmap=' . $network_map['id_networkmap'] . '" alt="' . __('Config') . '">' . html_print_image("images/config.png", true) . '</a>';
|
$data[3] = '<a href="index.php?sec=network&sec2=operation/agentes/networkmap&tab=edit&edit_networkmap=1&id_networkmap=' . $network_map['id_networkmap'] . '" alt="' . __('Config') . '">' . html_print_image("images/config.png", true) . '</a>';
|
||||||
$data[4] = '<a href="index.php?sec=network&sec2=operation/agentes/networkmap_list&delete_networkmap=1&id_networkmap=' . $network_map['id_networkmap'] . '" alt="' . __('Delete') . '" onclick="javascript: if (!confirm(\'' . __('Are you sure?') . '\')) return false;">' . html_print_image('images/cross.png', true) . '</a>';
|
$data[4] = '<a href="index.php?sec=network&sec2=operation/agentes/networkmap_list&delete_networkmap=1&id_networkmap=' . $network_map['id_networkmap'] . '" alt="' . __('Delete') . '" onclick="javascript: if (!confirm(\'' . __('Are you sure?') . '\')) return false;">' . html_print_image('images/cross.png', true) . '</a>';
|
||||||
// The value of the checkbox will be the networkmap id to recover it in js to perform the massive deletion
|
// The value of the checkbox will be the networkmap id to recover it in js to perform the massive deletion
|
||||||
$data[5] = html_print_checkbox('check_delete', $network_map['id_networkmap'], false, true);
|
$data[5] = html_print_checkbox('check_delete', $network_map['id_networkmap'], false, true);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$data[3] = '';
|
||||||
|
$data[4] = '';
|
||||||
|
$data[5] = '';
|
||||||
|
}
|
||||||
|
|
||||||
$table->data[] = $data;
|
$table->data[] = $data;
|
||||||
}
|
}
|
||||||
|
@ -235,7 +235,8 @@ enterprise_hook('close_meta_frame');
|
|||||||
|
|
||||||
$("form#tree_search").submit(function(e) {
|
$("form#tree_search").submit(function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
$(".tree-element-detail-content").hide();
|
||||||
|
$(".tree-controller-detail-recipient").hide();
|
||||||
processTreeSearch();
|
processTreeSearch();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user