2013-10-07 Ramon Novoa <rnovoa@artica.es>

* include/functions_networkmap.php,
	  operation/agentes/networkmap_list.php,
	  operation/agentes/networkmap.php: Fixed ACL related problems.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8862 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
ramonn 2013-10-07 10:52:24 +00:00
parent 4b9c4b3743
commit 4e4961d280
4 changed files with 42 additions and 52 deletions

View File

@ -1,3 +1,9 @@
2013-10-07 Ramon Novoa <rnovoa@artica.es>
* include/functions_networkmap.php,
operation/agentes/networkmap_list.php,
operation/agentes/networkmap.php: Fixed ACL related problems.
2013-10-07 Sergio Martin <sergio.martin@artica.es>
* include/graphs/functions_pchart.php: Disabled

View File

@ -1228,40 +1228,24 @@ function networkmap_get_networkmaps ($id_user = '', $type = '', $optgrouped = tr
if ($id_user == '') {
$id_user = $config['id_user'];
}
$type_cond = '';
if ($type != '') {
switch ($config["dbtype"]) {
case "mysql":
$type_cond = ' AND type = "'.$type.'"';
break;
case "postgresql":
case "oracle":
$type_cond = ' AND type = \''.$type.'\'';
break;
}
// Configure filters
$where = array ();
$where['id_group'] = array_keys (users_get_groups($id_user));
if ($type != '') {
$where['type'] = $type;
}
switch ($config["dbtype"]) {
case "mysql":
$networkmaps_raw = db_get_all_rows_filter(
'tnetwork_map', 'id_user = "' . $id_user . '" ' .
$type_cond . ' ORDER BY type DESC, name ASC',
array('id_networkmap','name', 'type'));
break;
case "postgresql":
case "oracle":
$networkmaps_raw = db_get_all_rows_filter(
'tnetwork_map', 'id_user = \'' . $id_user . '\' ' .
$type_cond . ' ORDER BY type DESC, name ASC',
array('id_networkmap','name', 'type'));
break;
}
$where['order'][0]['field'] = 'type';
$where['order'][0]['order'] = 'DESC';
$where['order'][1]['field'] = 'name';
$where['order'][1]['order'] = 'ASC';
$networkmaps_raw = db_get_all_rows_filter('tnetwork_map', $where);
if ($networkmaps_raw === false) {
return false;
}
$networkmaps = array();
foreach ($networkmaps_raw as $key => $networkmapitem) {
if ($optgrouped) {

View File

@ -223,16 +223,17 @@ $combolist .= '</form>';
$buttons['combolist'] = $combolist;
$buttons['addmap'] = array('active' => $activeTab == false,
if (check_acl ($config['id_user'], 0, "AW")) {
$buttons['addmap'] = array('active' => $activeTab == false,
'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;add_networkmap=1&amp;tab='.$activeTab.'&amp;pure='.$pure.'">' .
html_print_image("images/add_mc.png", true, array ("title" => __('Add map'))) .'</a>');
if (!$nomaps && $id_networkmap != 0) {
$buttons['deletemap'] = array('active' => $activeTab == false,
if (!$nomaps && $id_networkmap != 0) {
$buttons['deletemap'] = array('active' => $activeTab == false,
'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;id_networkmap='.$id_networkmap.'&amp;delete_networkmap=1&amp;tab='.$activeTab.'&amp;pure='.$pure.'">' .
html_print_image("images/delete_mc.png", true, array ("title" => __('Delete map'))) .'</a>');
$buttons['savemap'] = array('active' => $activeTab == false,
$buttons['savemap'] = array('active' => $activeTab == false,
'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;id_networkmap='.$id_networkmap.'&amp;save_networkmap=1
&amp;tab='.$activeTab.'&amp;save_networkmap=1&amp;name='.$name.'&amp;group='.$group.'
&amp;layout='.$layout.'&amp;nooverlap='.$nooverlap.'&amp;simple='.$simple.'&amp;regen='.$regen.'
@ -242,6 +243,7 @@ if (!$nomaps && $id_networkmap != 0) {
&amp;module_group='.$module_group.'&amp;pure='.$pure.'&amp;hidden_options='.(int)$hidden_options.'
&amp;show_snmp_modules='.(int)$show_snmp_modules.'">' .
html_print_image("images/save_mc.png", true, array ("title" => __('Save map'))) .'</a>');
}
}
$title = '';

View File

@ -166,22 +166,20 @@ else {
}
// Create networkmap form
$networkmap_types = networkmap_get_types();
if (check_acl ($config['id_user'], 0, "AW")) {
$networkmap_types = networkmap_get_types();
echo '<form method="post" action="index.php?sec=network&amp;sec2=operation/agentes/networkmap">';
echo "<table style='width: 100%' class='databox'>";
echo "<tr>";
echo "<td class='datos' style='width: 50%'>";
html_print_input_hidden('add_networkmap', 1);
html_print_select($networkmap_types, 'tab', 'topology', '');
echo "</td>";
echo "<td class='datos'>";
html_print_submit_button (__('Create networkmap'), 'crt', false, 'class="sub next"');
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</form>";
}
?>
<form method="post" action="index.php?sec=network&amp;sec2=operation/agentes/networkmap">
<table style='width: 100%' class='databox'>
<tr>
<td class='datos' style='width: 50%'>
<?php
html_print_input_hidden('add_networkmap', 1);
html_print_select($networkmap_types, 'tab', 'topology', '');
?>
</td>
<td class='datos'>
<?php
html_print_submit_button (__('Create networkmap'), 'crt', false, 'class="sub next"');
?>
</td>
</tr>
</table>
</form>