Changes on the functionality and the ACL checks. Great improvements on the ACL management
This commit is contained in:
parent
57e8032b20
commit
d28cd4c172
|
@ -17,6 +17,18 @@ global $config;
|
|||
|
||||
require_once ($config['homedir'] . '/include/functions_visual_map.php');
|
||||
|
||||
// ACL for the general permission
|
||||
$vconsoles_read = check_acl ($config['id_user'], 0, "VR");
|
||||
$vconsoles_write = check_acl ($config['id_user'], 0, "VW");
|
||||
$vconsoles_manage = check_acl ($config['id_user'], 0, "VM");
|
||||
|
||||
if (!$vconsoles_read && !$vconsoles_write && !$vconsoles_manage) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access map builder");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$pure = (int)get_parameter('pure', 0);
|
||||
$hack_metaconsole = '';
|
||||
if (defined('METACONSOLE'))
|
||||
|
@ -31,110 +43,139 @@ $copy_layout = (bool) get_parameter ('copy_layout');
|
|||
$delete_layout = (bool) get_parameter ('delete_layout');
|
||||
$refr = (int) get_parameter('refr');
|
||||
|
||||
if ($delete_layout) {
|
||||
db_process_sql_delete ('tlayout_data', array ('id_layout' => $id_layout));
|
||||
$result = db_process_sql_delete ('tlayout', array ('id' => $id_layout));
|
||||
if ($result) {
|
||||
db_pandora_audit( "Visual console builder", "Delete visual console #$id_layout");
|
||||
ui_print_success_message(__('Successfully deleted'));
|
||||
db_clean_cache();
|
||||
if ($delete_layout || $copy_layout) {
|
||||
// Visual console required
|
||||
if (empty($id_layout)) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access map builder");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
db_pandora_audit( "Visual console builder", "Fail try to delete visual console #$id_layout");
|
||||
ui_print_error_message(__('Not deleted. Error deleting data'));
|
||||
|
||||
$group_id = db_get_value("id_group", "tlayout", "id", $id_layout);
|
||||
if ($group_id === false) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access map builder");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
$id_layout = 0;
|
||||
}
|
||||
|
||||
// ACL for the visual console
|
||||
// $vconsole_read = check_acl ($config['id_user'], $group_id, "VR");
|
||||
$vconsole_write = check_acl ($config['id_user'], $group_id, "VW");
|
||||
$vconsole_manage = check_acl ($config['id_user'], $group_id, "VM");
|
||||
|
||||
if ($copy_layout) {
|
||||
// Number of inserts
|
||||
$ninsert = (int) 0;
|
||||
if (!$vconsole_write && !$vconsole_manage) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access map builder");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Return from DB the source layout
|
||||
$layout_src = db_get_all_rows_filter ("tlayout","id = " . $id_layout);
|
||||
|
||||
// Name of dst
|
||||
$name_dst = get_parameter ("name_dst", $layout_src[0]['name'] . " copy");
|
||||
|
||||
// Create the new Console
|
||||
$idGroup = $layout_src[0]['id_group'];
|
||||
$background = $layout_src[0]['background'];
|
||||
$height = $layout_src[0]['height'];
|
||||
$width = $layout_src[0]['width'];
|
||||
$visualConsoleName = $name_dst;
|
||||
|
||||
$values = array('name' => $visualConsoleName, 'id_group' => $idGroup, 'background' => $background, 'height' => $height, 'width' => $width);
|
||||
$result = db_process_sql_insert('tlayout', $values);
|
||||
|
||||
$idNewVisualConsole = $result;
|
||||
|
||||
if ($result) {
|
||||
$ninsert = 1;
|
||||
if ($delete_layout) {
|
||||
db_process_sql_delete ('tlayout_data', array ('id_layout' => $id_layout));
|
||||
$result = db_process_sql_delete ('tlayout', array ('id' => $id_layout));
|
||||
if ($result) {
|
||||
db_pandora_audit( "Visual console builder", "Delete visual console #$id_layout");
|
||||
ui_print_success_message(__('Successfully deleted'));
|
||||
db_clean_cache();
|
||||
}
|
||||
else {
|
||||
db_pandora_audit( "Visual console builder", "Fail try to delete visual console #$id_layout");
|
||||
ui_print_error_message(__('Not deleted. Error deleting data'));
|
||||
}
|
||||
$id_layout = 0;
|
||||
}
|
||||
|
||||
if ($copy_layout) {
|
||||
// Number of inserts
|
||||
$ninsert = (int) 0;
|
||||
|
||||
// Return from DB the items of the source layout
|
||||
$data_layout_src = db_get_all_rows_filter ("tlayout_data", "id_layout = " . $id_layout);
|
||||
// Return from DB the source layout
|
||||
$layout_src = db_get_all_rows_filter ("tlayout","id = " . $id_layout);
|
||||
|
||||
if (!empty($data_layout_src)) {
|
||||
// Name of dst
|
||||
$name_dst = get_parameter ("name_dst", $layout_src[0]['name'] . " copy");
|
||||
|
||||
// Create the new Console
|
||||
$idGroup = $layout_src[0]['id_group'];
|
||||
$background = $layout_src[0]['background'];
|
||||
$height = $layout_src[0]['height'];
|
||||
$width = $layout_src[0]['width'];
|
||||
$visualConsoleName = $name_dst;
|
||||
|
||||
$values = array('name' => $visualConsoleName, 'id_group' => $idGroup, 'background' => $background, 'height' => $height, 'width' => $width);
|
||||
$result = db_process_sql_insert('tlayout', $values);
|
||||
|
||||
$idNewVisualConsole = $result;
|
||||
|
||||
if ($result) {
|
||||
$ninsert = 1;
|
||||
|
||||
//By default the id parent 0 is always 0.
|
||||
$id_relations = array(0 => 0);
|
||||
// Return from DB the items of the source layout
|
||||
$data_layout_src = db_get_all_rows_filter ("tlayout_data", "id_layout = " . $id_layout);
|
||||
|
||||
for ($a=0; $a < count($data_layout_src); $a++) {
|
||||
if (!empty($data_layout_src)) {
|
||||
|
||||
// Changing the source id by the new visual console id
|
||||
$data_layout_src[$a]['id_layout'] = $idNewVisualConsole;
|
||||
//By default the id parent 0 is always 0.
|
||||
$id_relations = array(0 => 0);
|
||||
|
||||
$old_id = $data_layout_src[$a]['id'];
|
||||
|
||||
// Unsetting the source's id
|
||||
unset($data_layout_src[$a]['id']);
|
||||
|
||||
// Configure the cloned Console
|
||||
$result = db_process_sql_insert('tlayout_data', $data_layout_src[$a]);
|
||||
|
||||
$id_relations[$old_id] = 0;
|
||||
|
||||
if ($result !== false) {
|
||||
$id_relations[$old_id] = $result;
|
||||
}
|
||||
|
||||
if ($result)
|
||||
$ninsert++;
|
||||
}// for each item of console
|
||||
|
||||
$inserts = count($data_layout_src) + 1;
|
||||
|
||||
// If the number of inserts is correct, the copy is completed
|
||||
if ($ninsert == $inserts) {
|
||||
|
||||
//Update the ids of parents
|
||||
$items = db_get_all_rows_filter ("tlayout_data", "id_layout = " . $idNewVisualConsole);
|
||||
|
||||
foreach ($items as $item) {
|
||||
$new_parent = $id_relations[$item['parent_item']];
|
||||
for ($a=0; $a < count($data_layout_src); $a++) {
|
||||
|
||||
db_process_sql_update('tlayout_data',
|
||||
array('parent_item' => $new_parent), array('id' => $item['id']));
|
||||
// Changing the source id by the new visual console id
|
||||
$data_layout_src[$a]['id_layout'] = $idNewVisualConsole;
|
||||
|
||||
$old_id = $data_layout_src[$a]['id'];
|
||||
|
||||
// Unsetting the source's id
|
||||
unset($data_layout_src[$a]['id']);
|
||||
|
||||
// Configure the cloned Console
|
||||
$result = db_process_sql_insert('tlayout_data', $data_layout_src[$a]);
|
||||
|
||||
$id_relations[$old_id] = 0;
|
||||
|
||||
if ($result !== false) {
|
||||
$id_relations[$old_id] = $result;
|
||||
}
|
||||
|
||||
if ($result)
|
||||
$ninsert++;
|
||||
}// for each item of console
|
||||
|
||||
$inserts = count($data_layout_src) + 1;
|
||||
|
||||
// If the number of inserts is correct, the copy is completed
|
||||
if ($ninsert == $inserts) {
|
||||
|
||||
//Update the ids of parents
|
||||
$items = db_get_all_rows_filter ("tlayout_data", "id_layout = " . $idNewVisualConsole);
|
||||
|
||||
foreach ($items as $item) {
|
||||
$new_parent = $id_relations[$item['parent_item']];
|
||||
|
||||
db_process_sql_update('tlayout_data',
|
||||
array('parent_item' => $new_parent), array('id' => $item['id']));
|
||||
}
|
||||
|
||||
|
||||
ui_print_success_message(__('Successfully copied'));
|
||||
db_clean_cache();
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
ui_print_error_message(__('Not copied. Error copying data'));
|
||||
}
|
||||
}
|
||||
else {
|
||||
// If the array is empty the copy is completed
|
||||
ui_print_success_message(__('Successfully copied'));
|
||||
db_clean_cache();
|
||||
}
|
||||
else {
|
||||
ui_print_error_message(__('Not copied. Error copying data'));
|
||||
}
|
||||
}
|
||||
else {
|
||||
// If the array is empty the copy is completed
|
||||
ui_print_success_message(__('Successfully copied'));
|
||||
db_clean_cache();
|
||||
ui_print_error_message(__('Not copied. Error copying data'));
|
||||
}
|
||||
}
|
||||
else {
|
||||
ui_print_error_message(__('Not copied. Error copying data'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$table->width = '98%';
|
||||
|
@ -146,7 +187,7 @@ $table->head[2] = __('Items');
|
|||
|
||||
// Fix: IW was the old ACL for report editing, now is RW
|
||||
//Only for RW flag
|
||||
if (check_acl ($config['id_user'], 0, "RW")) {
|
||||
if ($vconsoles_write || $vconsoles_manage) {
|
||||
$table->head[3] = __('Copy');
|
||||
$table->head[4] = __('Delete');
|
||||
}
|
||||
|
@ -159,9 +200,9 @@ $table->align[3] = 'center';
|
|||
$table->align[4] = 'center';
|
||||
|
||||
// Only display maps of "All" group if user is administrator
|
||||
// or has "RR" privileges, otherwise show only maps of user group
|
||||
// or has "VR" privileges, otherwise show only maps of user group
|
||||
$own_info = get_user_info ($config['id_user']);
|
||||
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "RR"))
|
||||
if ($own_info['is_admin'] || $vconsoles_read)
|
||||
$maps = visual_map_get_user_layouts ();
|
||||
else
|
||||
$maps = visual_map_get_user_layouts ($config['id_user'], false, false, false);
|
||||
|
@ -171,6 +212,9 @@ if (!$maps) {
|
|||
}
|
||||
else {
|
||||
foreach ($maps as $map) {
|
||||
// ACL for the visual console permission
|
||||
$vconsole_write = check_acl ($config['id_user'], $map['id_group'], "VW");
|
||||
$vconsole_manage = check_acl ($config['id_user'], $map['id_group'], "VM");
|
||||
|
||||
$data = array ();
|
||||
|
||||
|
@ -187,7 +231,7 @@ else {
|
|||
$data[2] = db_get_sql ("SELECT COUNT(*) FROM tlayout_data WHERE id_layout = ".$map['id']);
|
||||
|
||||
// Fix: IW was the old ACL for report editing, now is RW
|
||||
if (check_acl ($config['id_user'], 0, "RW")) {
|
||||
if ($vconsole_write || $vconsole_manage) {
|
||||
|
||||
if (!defined('METACONSOLE')) {
|
||||
$data[3] = '<a class="copy_visualmap" href="index.php?sec=reporting&sec2=godmode/reporting/map_builder&id_layout='.$map['id'].'&copy_layout=1">'.html_print_image ("images/copy.png", true).'</a>';
|
||||
|
@ -212,9 +256,7 @@ else {
|
|||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
}
|
||||
|
||||
// Fix: IW was the old ACL to check for report editing, now is RW
|
||||
//Only for RW flag
|
||||
if (check_acl ($config['id_user'], 0, "RW")) {
|
||||
if ($vconsoles_write || $vconsoles_manage) {
|
||||
if (!defined('METACONSOLE'))
|
||||
echo '<form action="index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder" method="post">';
|
||||
else {
|
||||
|
|
|
@ -17,7 +17,23 @@ global $config;
|
|||
|
||||
check_login ();
|
||||
|
||||
if (! check_acl ($config['id_user'], 0, "RW")) {
|
||||
// Visual console required
|
||||
if (empty($visualConsole)) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access report builder");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
// ACL for the existing visual console
|
||||
// if (!isset($vconsole_read))
|
||||
// $vconsole_read = check_acl ($config['id_user'], $visualConsole['id_group'], "VR");
|
||||
if (!isset($vconsole_write))
|
||||
$vconsole_write = check_acl ($config['id_user'], $visualConsole['id_group'], "VW");
|
||||
if (!isset($vconsole_manage))
|
||||
$vconsole_manage = check_acl ($config['id_user'], $visualConsole['id_group'], "VM");
|
||||
|
||||
if (!$vconsole_write && !$vconsole_manage) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access report builder");
|
||||
require ("general/noaccess.php");
|
||||
|
@ -85,7 +101,7 @@ $groups = users_get_groups ($config['id_user'], 'RW');
|
|||
$own_info = get_user_info($config['id_user']);
|
||||
// Only display group "All" if user is administrator
|
||||
// or has "RW" privileges
|
||||
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "RW"))
|
||||
if ($own_info['is_admin'] || $vconsole_write || $vconsole_manage)
|
||||
$display_all_group = true;
|
||||
else
|
||||
$display_all_group = false;
|
||||
|
|
|
@ -17,7 +17,23 @@ global $config;
|
|||
// Login check
|
||||
check_login ();
|
||||
|
||||
if (! check_acl ($config['id_user'], 0, "RW")) {
|
||||
// Visual console required
|
||||
if (empty($visualConsole)) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access report builder");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
// ACL for the existing visual console
|
||||
// if (!isset($vconsole_read))
|
||||
// $vconsole_read = check_acl ($config['id_user'], $visualConsole['id_group'], "VR");
|
||||
if (!isset($vconsole_write))
|
||||
$vconsole_write = check_acl ($config['id_user'], $visualConsole['id_group'], "VW");
|
||||
if (!isset($vconsole_manage))
|
||||
$vconsole_manage = check_acl ($config['id_user'], $visualConsole['id_group'], "VM");
|
||||
|
||||
if (!$vconsole_write && !$vconsole_manage) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access report builder");
|
||||
require ("general/noaccess.php");
|
||||
|
|
|
@ -17,7 +17,23 @@ global $config;
|
|||
|
||||
check_login ();
|
||||
|
||||
if (! check_acl ($config['id_user'], 0, "RW")) {
|
||||
// Visual console required
|
||||
if (empty($visualConsole)) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access report builder");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
// ACL for the existing visual console
|
||||
// if (!isset($vconsole_read))
|
||||
// $vconsole_read = check_acl ($config['id_user'], $visualConsole['id_group'], "VR");
|
||||
if (!isset($vconsole_write))
|
||||
$vconsole_write = check_acl ($config['id_user'], $visualConsole['id_group'], "VW");
|
||||
if (!isset($vconsole_manage))
|
||||
$vconsole_manage = check_acl ($config['id_user'], $visualConsole['id_group'], "VM");
|
||||
|
||||
if (!$vconsole_write && !$vconsole_manage) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access report builder");
|
||||
require ("general/noaccess.php");
|
||||
|
|
|
@ -18,25 +18,65 @@ global $statusProcessInDB;
|
|||
|
||||
check_login ();
|
||||
|
||||
if (! check_acl ($config['id_user'], 0, "RW")) {
|
||||
require_once ($config['homedir'] . '/include/functions_visual_map.php');
|
||||
require_once($config['homedir'] . "/include/functions_agents.php");
|
||||
enterprise_include_once('include/functions_visual_map.php');
|
||||
|
||||
// Retrieve the visual console id
|
||||
set_unless_defined ($idVisualConsole, 0); // Set default
|
||||
$idVisualConsole = get_parameter('id_visual_console', $idVisualConsole);
|
||||
|
||||
// Visual console creation tab and actions
|
||||
if ($activeTab == "data" && ($action == "new" || $action == "save")) {
|
||||
$visualConsole = null;
|
||||
|
||||
// General ACL
|
||||
//$vconsole_read = check_acl ($config['id_user'], 0, "VR");
|
||||
$vconsole_write = check_acl ($config['id_user'], 0, "VW");
|
||||
$vconsole_manage = check_acl ($config['id_user'], 0, "VM");
|
||||
}
|
||||
// Retrieving the visual console data
|
||||
else if (!empty($idVisualConsole)) {
|
||||
|
||||
// Load the visual console data
|
||||
$visualConsole = db_get_row_filter('tlayout', array('id' => $idVisualConsole));
|
||||
|
||||
// The visual console should exist.
|
||||
if (empty($visualConsole)) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access report builder");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
// The default group id is 0
|
||||
set_unless_defined ($visualConsole['id_group'], 0);
|
||||
|
||||
// ACL for the existing visual console
|
||||
//$vconsole_read = check_acl ($config['id_user'], $visualConsole['id_group'], "VR");
|
||||
$vconsole_write = check_acl ($config['id_user'], $visualConsole['id_group'], "VW");
|
||||
$vconsole_manage = check_acl ($config['id_user'], $visualConsole['id_group'], "VM");
|
||||
}
|
||||
// The visual console should exist.
|
||||
// The only exception is the visual console creation.
|
||||
else {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access report builder");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
// This section is only to manage the visual console
|
||||
if (!$vconsole_write && !$vconsole_manage) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access report builder");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once ($config['homedir'] . '/include/functions_visual_map.php');
|
||||
require_once($config['homedir'] . "/include/functions_agents.php");
|
||||
enterprise_include_once('include/functions_visual_map.php');
|
||||
|
||||
$pure = (int)get_parameter('pure', 0);
|
||||
|
||||
if (!empty($idVisualConsole)) {
|
||||
$idVisualConsole = get_parameter('id_visual_console', $idVisualConsole);
|
||||
}
|
||||
else {
|
||||
$idVisualConsole = get_parameter('id_visual_console', 0);
|
||||
}
|
||||
$pure = (int) get_parameter ('pure', 0);
|
||||
$refr = (int) get_parameter ('refr', $config['vc_refr']);
|
||||
|
||||
$id_layout = 0;
|
||||
|
||||
|
@ -53,8 +93,6 @@ $action = get_parameterBetweenListValues($action_name_parameter,
|
|||
|
||||
$activeTab = get_parameterBetweenListValues('tab', array('data', 'list_elements', 'wizard', 'wizard_services', 'editor'), 'data');
|
||||
|
||||
$refr = (int) get_parameter ('refr', $config['vc_refr']);
|
||||
|
||||
|
||||
//Save/Update data in DB
|
||||
global $statusProcessInDB;
|
||||
|
@ -71,16 +109,30 @@ switch ($activeTab) {
|
|||
|
||||
case 'update':
|
||||
case 'save':
|
||||
$idGroup = get_parameter('id_group');
|
||||
$background = get_parameter('background');
|
||||
$visualConsoleName = get_parameter('name');
|
||||
$idGroup = (int) get_parameter('id_group');
|
||||
$background = (string) get_parameter('background');
|
||||
$visualConsoleName = (string) get_parameter('name');
|
||||
|
||||
$values = array('name' => $visualConsoleName,
|
||||
'id_group' => $idGroup, 'background' => $background);
|
||||
// ACL for the new visual console
|
||||
//$vconsole_read_new = check_acl ($config['id_user'], $idGroup, "VR");
|
||||
$vconsole_write_new = check_acl ($config['id_user'], $idGroup, "VW");
|
||||
$vconsole_manage_new = check_acl ($config['id_user'], $idGroup, "VM");
|
||||
|
||||
// The user should have permissions on the new group
|
||||
if (!$vconsole_write_new && !$vconsole_manage_new) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access report builder");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$values = array(
|
||||
'name' => $visualConsoleName,
|
||||
'id_group' => $idGroup,
|
||||
'background' => $background
|
||||
);
|
||||
|
||||
// If the background is changed the size is reseted
|
||||
$visualConsole = db_get_row_filter('tlayout',
|
||||
array('id' => $idVisualConsole));
|
||||
$background_now = $visualConsole['background'];
|
||||
if ($background_now != $background && $background) {
|
||||
$sizeBackground = getimagesize($config['homedir'] . '/images/console/background/' . $background);
|
||||
|
@ -93,10 +145,18 @@ switch ($activeTab) {
|
|||
$result = false;
|
||||
if ($values['name'] != "" && $values['background'])
|
||||
$result = db_process_sql_update('tlayout', $values, array('id' => $idVisualConsole));
|
||||
if ($result !== false && $values['background']) {
|
||||
if ($result !== false) {
|
||||
db_pandora_audit( "Visual console builder", "Update visual console #$idVisualConsole");
|
||||
$action = 'edit';
|
||||
$statusProcessInDB = array('flag' => true, 'message' => ui_print_success_message(__('Successfully update.'), '', true));
|
||||
|
||||
// Return the updated visual console
|
||||
$visualConsole = db_get_row_filter('tlayout',
|
||||
array('id' => $idVisualConsole));
|
||||
// Update the ACL
|
||||
//$vconsole_read = $vconsole_read_new;
|
||||
$vconsole_write = $vconsole_write_new;
|
||||
$vconsole_manage = $vconsole_manage_new;
|
||||
}
|
||||
else {
|
||||
db_pandora_audit( "Visual console builder", "Fail update visual console #$idVisualConsole");
|
||||
|
@ -116,6 +176,14 @@ switch ($activeTab) {
|
|||
$action = 'edit';
|
||||
$statusProcessInDB = array('flag' => true,
|
||||
'message' => ui_print_success_message(__('Successfully created.'), '', true));
|
||||
|
||||
// Return the updated visual console
|
||||
$visualConsole = db_get_row_filter('tlayout',
|
||||
array('id' => $idVisualConsole));
|
||||
// Update the ACL
|
||||
//$vconsole_read = $vconsole_read_new;
|
||||
$vconsole_write = $vconsole_write_new;
|
||||
$vconsole_manage = $vconsole_manage_new;
|
||||
}
|
||||
else {
|
||||
db_pandora_audit( "Visual console builder", "Fail try to create visual console");
|
||||
|
@ -125,13 +193,9 @@ switch ($activeTab) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
$visualConsole = db_get_row_filter('tlayout',
|
||||
array('id' => $idVisualConsole));
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
$visualConsole = db_get_row_filter('tlayout',
|
||||
array('id' => $idVisualConsole));
|
||||
$visualConsoleName = $visualConsole['name'];
|
||||
$idGroup = $visualConsole['id_group'];
|
||||
$background = $visualConsole['background'];
|
||||
|
@ -147,13 +211,11 @@ switch ($activeTab) {
|
|||
json_encode(array())));
|
||||
|
||||
$delete_items = json_decode($delete_items_json, true);
|
||||
$id_visual_console = (int)get_parameter(
|
||||
'id_visual_console', 0);
|
||||
|
||||
if (!empty($delete_items)) {
|
||||
$result = (bool)db_process_sql_delete(
|
||||
'tlayout_data',
|
||||
array('id_layout' => $id_visual_console,
|
||||
array('id_layout' => $idVisualConsole,
|
||||
'id' => $delete_items));
|
||||
|
||||
}
|
||||
|
@ -187,6 +249,10 @@ switch ($activeTab) {
|
|||
'height' => $height),
|
||||
array('id' => $idVisualConsole));
|
||||
|
||||
// Return the updated visual console
|
||||
$visualConsole = db_get_row_filter('tlayout',
|
||||
array('id' => $idVisualConsole));
|
||||
|
||||
//Update elements in visual map
|
||||
$idsElements = db_get_all_rows_filter('tlayout_data',
|
||||
array('id_layout' => $idVisualConsole), array('id'));
|
||||
|
@ -246,12 +312,10 @@ switch ($activeTab) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
$visualConsole = db_get_row_filter('tlayout', array('id' => $idVisualConsole));
|
||||
$visualConsoleName = $visualConsole['name'];
|
||||
$action = 'edit';
|
||||
break;
|
||||
case 'wizard':
|
||||
$visualConsole = db_get_row_filter('tlayout', array('id' => $idVisualConsole));
|
||||
$visualConsoleName = $visualConsole['name'];
|
||||
$background = $visualConsole['background'];
|
||||
switch ($action) {
|
||||
|
@ -430,7 +494,6 @@ switch ($activeTab) {
|
|||
}
|
||||
break;
|
||||
case 'wizard_services':
|
||||
$visualConsole = db_get_row_filter('tlayout', array('id' => $idVisualConsole));
|
||||
$visualConsoleName = $visualConsole['name'];
|
||||
switch ($action) {
|
||||
case 'update':
|
||||
|
@ -453,9 +516,6 @@ switch ($activeTab) {
|
|||
case 'new':
|
||||
case 'update':
|
||||
case 'edit':
|
||||
$visualConsole = db_get_row_filter('tlayout',
|
||||
array('id' => $idVisualConsole));
|
||||
|
||||
$visualConsoleName = $visualConsole['name'];
|
||||
$action = 'edit';
|
||||
break;
|
||||
|
|
|
@ -17,7 +17,23 @@ global $config;
|
|||
|
||||
check_login ();
|
||||
|
||||
if (! check_acl ($config['id_user'], 0, "RW")) {
|
||||
// Visual console required
|
||||
if (empty($visualConsole)) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access report builder");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
// ACL for the existing visual console
|
||||
// if (!isset($vconsole_read))
|
||||
// $vconsole_read = check_acl ($config['id_user'], $visualConsole['id_group'], "VR");
|
||||
if (!isset($vconsole_write))
|
||||
$vconsole_write = check_acl ($config['id_user'], $visualConsole['id_group'], "VW");
|
||||
if (!isset($vconsole_manage))
|
||||
$vconsole_manage = check_acl ($config['id_user'], $visualConsole['id_group'], "VM");
|
||||
|
||||
if (!$vconsole_write && !$vconsole_manage) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access report builder");
|
||||
require ("general/noaccess.php");
|
||||
|
|
|
@ -17,14 +17,41 @@ global $config;
|
|||
|
||||
check_login ();
|
||||
|
||||
// Fix: IW was the old ACL to check for report editing, now is RW
|
||||
if (! check_acl ($config['id_user'], 0, "RW")) {
|
||||
$id_visual_console = get_parameter('id_visual_console', null);
|
||||
|
||||
// WARNING: CHECK THE ENTIRE FUNCTIONALITY
|
||||
|
||||
// Visual console id required
|
||||
if (empty($id_visual_console)) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access report builder");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Get the group id for the ACL checks
|
||||
$group_id = db_get_value('id_group', 'tlayout', 'id', $id_visual_console);
|
||||
if ($group_id === false) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access report builder");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
// ACL for the existing visual console
|
||||
// if (!isset($vconsole_read))
|
||||
// $vconsole_read = check_acl ($config['id_user'], $group_id, "VR");
|
||||
if (!isset($vconsole_write))
|
||||
$vconsole_write = check_acl ($config['id_user'], $group_id, "VW");
|
||||
if (!isset($vconsole_manage))
|
||||
$vconsole_manage = check_acl ($config['id_user'], $group_id, "VM");
|
||||
|
||||
if (!$vconsole_write && !$vconsole_manage) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access report builder");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
//Fix ajax to avoid include the file, 'functions_graph.php'.
|
||||
$ajax = true;
|
||||
|
@ -39,8 +66,6 @@ enterprise_include_once('include/functions_visual_map.php');
|
|||
$action = get_parameter('action');
|
||||
$type = get_parameter('type');
|
||||
|
||||
$id_visual_console = get_parameter('id_visual_console', null);
|
||||
|
||||
$id_element = get_parameter('id_element', null);
|
||||
|
||||
$image = get_parameter('image', null);
|
||||
|
|
|
@ -16,12 +16,16 @@ require_once ('../include/functions_visual_map.php');
|
|||
|
||||
class Visualmap {
|
||||
private $correct_acl = false;
|
||||
private $acl = "RR";
|
||||
private $acl = "VR";
|
||||
|
||||
private $id = 0;
|
||||
private $visual_map = null;
|
||||
private $visualmap = null;
|
||||
|
||||
function __construct() {
|
||||
|
||||
}
|
||||
|
||||
private function checkVisualmapACL($groupID = 0) {
|
||||
$system = System::getInstance();
|
||||
|
||||
if ($system->checkACL($this->acl)) {
|
||||
|
@ -39,17 +43,21 @@ class Visualmap {
|
|||
}
|
||||
|
||||
public function show() {
|
||||
$this->getFilters();
|
||||
|
||||
$this->visualmap = db_get_row('tlayout',
|
||||
'id', $this->id);
|
||||
|
||||
if (empty($this->visualmap)) {
|
||||
$this->show_fail_acl();
|
||||
}
|
||||
|
||||
$this->checkVisualmapACL($this->visualmap['id_group']);
|
||||
if (!$this->correct_acl) {
|
||||
$this->show_fail_acl();
|
||||
}
|
||||
else {
|
||||
$this->getFilters();
|
||||
|
||||
$this->visualmap = db_get_row('tlayout',
|
||||
'id', $this->id);
|
||||
|
||||
$this->show_visualmap();
|
||||
}
|
||||
|
||||
$this->show_visualmap();
|
||||
}
|
||||
|
||||
private function show_fail_acl() {
|
||||
|
|
|
@ -18,7 +18,7 @@ ob_get_clean(); //Fixed unused javascript code.
|
|||
|
||||
class Visualmaps {
|
||||
private $correct_acl = false;
|
||||
private $acl = "RR";
|
||||
private $acl = "VR";
|
||||
|
||||
private $default = true;
|
||||
private $default_filters = array();
|
||||
|
|
Loading…
Reference in New Issue