Changed ACL's permission in Networkmaps

visualization: RR (Report Read)
Edition: RW (Report Write)
Deletion: RW (only yours networkmaps), RM(any of its group, although he did not create it.)
(cherry picked from commit d34ce5aa9e)

Conflicts:
	pandora_console/operation/agentes/networkmap_list.php
This commit is contained in:
m-lopez-f 2015-01-15 15:43:08 +01:00
parent 90d600a238
commit 8798d946e3
3 changed files with 26 additions and 5 deletions

View File

@ -1557,6 +1557,27 @@ function networkmap_delete_networkmap ($id_networkmap) {
return @db_process_sql_delete ('tnetwork_map', array ('id_networkmap' => $id_networkmap));
}
/**
* Deletes a network map if the property is that user.
*
* @param string User id that call this funtion.
* @param int Map id to be deleted.
*
* @return bool True if the map was deleted, false the map is not yours.
*/
function networkmap_delete_user_networkmap ($id_user = '', $id_networkmap) {
if ($id_user == '') {
$id_user = $config['id_user'];
}
$id_networkmap = safe_int ($id_networkmap);
if (empty ($id_networkmap))
return false;
$networkmap = networkmap_get_networkmap ($id_networkmap);
if ($networkmap === false)
return false;
return @db_process_sql_delete ('tnetwork_map', array ('id_networkmap' => $id_networkmap, 'id_user' => $id_user));
}
/**
* Updates a network map.
*

View File

@ -229,7 +229,7 @@ $combolist .= '</form>';
$buttons['combolist'] = $combolist;
if (check_acl ($config['id_user'], 0, "AW")) {
if (check_acl ($config['id_user'], 0, "RW") || check_acl ($config['id_user'], 0, "RM")) {
$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>');

View File

@ -100,7 +100,7 @@ $table->size[] = '80%';
$table->size[] = '60px';
$table->size[] = '30px';
if (check_acl ($config["id_user"], 0, "AW")) {
if (check_acl ($config['id_user'], 0, "RW") || check_acl ($config['id_user'], 0, "RM")) {
$table->size[] = '30px';
$table->size[] = '30px';
}
@ -109,7 +109,7 @@ $table->head = array();
$table->head[] = __('Name');
$table->head[] = __('Type');
$table->head[] = __('Group');
if (check_acl ($config["id_user"], 0, "AW")) {
if (check_acl ($config['id_user'], 0, "RW") || check_acl ($config['id_user'], 0, "RM")) {
$table->head[] = __('Edit');
$table->head[] = __('Delete');
}
@ -154,7 +154,7 @@ else {
$data[] = $network_map['type'];
$data[] = ui_print_group_icon ($network_map['id_group'], true);
if (check_acl ($config["id_user"], 0, "AW")) {
if (check_acl ($config['id_user'], 0, "RW") || check_acl ($config['id_user'], 0, "RM")) {
$data[] = '<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[] = '<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>';
}
@ -166,7 +166,7 @@ else {
}
// Create networkmap form
if (check_acl ($config['id_user'], 0, "AW")) {
if (check_acl ($config['id_user'], 0, "RW") || check_acl ($config['id_user'], 0, "RM")) {
$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'>";