Fixed problems with ACL permmisions. Gitlab: #451

This commit is contained in:
m-lopez-f 2017-03-06 12:54:48 +01:00
parent 395a73a868
commit 7f0359283d
11 changed files with 116 additions and 99 deletions

View File

@ -20,7 +20,7 @@ $id_agente = get_parameter ("id_agente");
$address = agents_get_address($id_agente);
if (!empty($address) || empty($id_agente)) {
extensions_add_opemode_tab_agent ('ssh_gateway','SSH Gateway','extensions/ssh_gateway/secure_console.png',"ssh_gateway", "v1r1");
extensions_add_opemode_tab_agent ('ssh_gateway','SSH Gateway','extensions/ssh_gateway/secure_console.png',"ssh_gateway", "v1r1", 'AW');
}
function ssh_gateway () {

View File

@ -39,6 +39,6 @@ $id_agente = get_parameter ("id_agente");
$address = agents_get_address($id_agente);
if (!empty($address) || empty($id_agente)) {
extensions_add_opemode_tab_agent('vnc_view', __('VNC view'), 'images/vnc.png', 'vnc_view', "v1r1");
extensions_add_opemode_tab_agent('vnc_view', __('VNC view'), 'images/vnc.png', 'vnc_view', "v1r1", 'AW');
}
?>

View File

@ -15,12 +15,16 @@
// GNU General Public License for more details.
global $config;
global $incident_w;
global $incident_m;
check_login ();
ui_require_css_file ('firts_task');
?>
<?php
ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no incidents defined yet.') ) );
ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no incidents defined yet.') ) );
if ($incident_w || $incident_m) {
?>
<div class="new_task">
@ -41,3 +45,4 @@ ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no in
</form>
</div>
</div>
<?php } ?>

View File

@ -15,6 +15,8 @@
// GNU General Public License for more details.
global $config;
global $vconsoles_write;
global $vconsoles_manage;
check_login ();
ui_require_css_file ('firts_task');
@ -22,6 +24,7 @@ ui_print_info_message(
array(
'no_close'=>true,
'message'=> __('There are no visual console defined yet.')));
if ($vconsoles_write || $vconsoles_manage) {
?>
<div class="new_task">
@ -41,3 +44,4 @@ ui_print_info_message(
</form>
</div>
</div>
<?php } ?>

View File

@ -15,25 +15,31 @@
// GNU General Public License for more details.
global $config;
global $agent_w;
check_login ();
ui_require_css_file ('firts_task');
?>
<?php ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no services defined yet.') ) ); ?>
<div class="new_task">
<div class="image_task">
<?php echo html_print_image('images/firts_task/icono_grande_servicios.png', true, array("title" => __('Services')));?>
<?php if ($agent_w) { ?>
<div class="new_task">
<div class="image_task">
<?php echo html_print_image('images/firts_task/icono_grande_servicios.png', true, array("title" => __('Services')));?>
</div>
<div class="text_task">
<h3> <?php echo __('Create Services'); ?></h3>
<p id="description_task"> <?php echo __("A service is a way to group your IT resources based on their functionalities.
A service could be e.g. your official website, your CRM system, your support application, or even your printers.
Services are logical groups which can include hosts, routers, switches, firewalls, CRMs, ERPs, websites and numerous other services.
By the following example, you're able to see more clearly what a service is:
A chip manufacturer sells computers by its website all around the world.
His company consists of three big departments: A management, an on-line shop and support."); ?></p>
<form action="index.php?sec=estado&sec2=enterprise/godmode/services/services.service&action=new_service" method="post">
<input type="submit" class="button_task" value="<?php echo __('Create Services'); ?>" />
</form>
</div>
</div>
<div class="text_task">
<h3> <?php echo __('Create Services'); ?></h3>
<p id="description_task"> <?php echo __("A service is a way to group your IT resources based on their functionalities.
A service could be e.g. your official website, your CRM system, your support application, or even your printers.
Services are logical groups which can include hosts, routers, switches, firewalls, CRMs, ERPs, websites and numerous other services.
By the following example, you're able to see more clearly what a service is:
A chip manufacturer sells computers by its website all around the world.
His company consists of three big departments: A management, an on-line shop and support."); ?></p>
<form action="index.php?sec=estado&sec2=enterprise/godmode/services/services.service&action=new_service" method="post">
<input type="submit" class="button_task" value="<?php echo __('Create Services'); ?>" />
</form>
</div>
</div>
<?php } ?>

View File

@ -15,10 +15,15 @@
// GNU General Public License for more details.
global $config;
global $networkmaps_write;
global $networkmaps_manage;
check_login ();
ui_require_css_file ('firts_task');
?>
<?php ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no transactions defined yet.') ) ); ?>
<?php ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no transactions defined yet.') ) );
if ($networkmaps_write || $networkmaps_manage) {
?>
<div class="new_task">
<div class="image_task">
@ -33,4 +38,5 @@ Transaction graphs represent the different processes within our infrastructure t
<input type="submit" class="button_task" value="<?php echo __('Create Transactions'); ?>" />
</form>
</div>
</div>
</div>
<?php } ?>

View File

@ -146,10 +146,12 @@ if (!empty($all_data)) {
$table->data[] = $tdata;
// Users
$tdata = array();
$tdata[0] = reporting_get_stats_users($data);
$table->rowclass[] = '';
$table->data[] = $tdata;
if (users_is_admin()) {
$tdata = array();
$tdata[0] = reporting_get_stats_users($data);
$table->rowclass[] = '';
$table->data[] = $tdata;
}
html_print_table($table);
unset($table);

View File

@ -471,25 +471,27 @@ if ($id_agente) {
//Extensions tabs
foreach ($config['extensions'] as $extension) {
if (isset($extension['extension_god_tab']) && check_acl ($config["id_user"], $group, "AW", $id_agente)) {
$image = $extension['extension_god_tab']['icon'];
$name = $extension['extension_god_tab']['name'];
$id = $extension['extension_god_tab']['id'];
$id_extension = get_parameter('id_extension', '');
if ($id_extension == $id) {
$active = true;
if (isset($extension['extension_god_tab'])) {
if (check_acl ($config["id_user"], $group, $extension['extension_god_tab']['acl'])) {
$image = $extension['extension_god_tab']['icon'];
$name = $extension['extension_god_tab']['name'];
$id = $extension['extension_god_tab']['id'];
$id_extension = get_parameter('id_extension', '');
if ($id_extension == $id) {
$active = true;
}
else {
$active = false;
}
$url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=extension&id_agente='.$id_agente . '&id_extension=' . $id;
$extension_tab = array('text' => '<a href="' . $url .'">' . html_print_image ($image, true, array ( "title" => $name)) . '</a>', 'active' => $active);
$onheader = $onheader + array($id => $extension_tab);
}
else {
$active = false;
}
$url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=extension&id_agente='.$id_agente . '&id_extension=' . $id;
$extension_tab = array('text' => '<a href="' . $url .'">' . html_print_image ($image, true, array ( "title" => $name)) . '</a>', 'active' => $active);
$onheader = $onheader + array($id => $extension_tab);
}
}
@ -591,7 +593,6 @@ if ($delete_conf_file) {
__('Could not delete conf file'));
}
// Show agent creation results
if ($create_agent) {
if (!isset($agent_creation_error)) {

6
pandora_console/include/functions_extensions.php Normal file → Executable file
View File

@ -409,7 +409,7 @@ function extensions_add_godmode_menu_option ($name, $acl, $fatherId = null, $ico
* @param tabIcon Path to the image icon
* @param tabFunction Name of the function to execute when this extension is called
*/
function extensions_add_godmode_tab_agent($tabId, $tabName, $tabIcon, $tabFunction, $version="N/A") {
function extensions_add_godmode_tab_agent($tabId, $tabName, $tabIcon, $tabFunction, $version="N/A", $acl = 'AW') {
global $config;
global $extension_file;
@ -420,6 +420,7 @@ function extensions_add_godmode_tab_agent($tabId, $tabName, $tabIcon, $tabFuncti
$extension['extension_god_tab']['icon'] = $tabIcon;
$extension['extension_god_tab']['function'] = $tabFunction;
$extension['extension_god_tab']['version'] = $version;
$extension['extension_ope_tab']['acl'] = $acl;
}
/**
@ -430,7 +431,7 @@ function extensions_add_godmode_tab_agent($tabId, $tabName, $tabIcon, $tabFuncti
* @param tabIcon Path to the image icon
* @param tabFunction Name of the function to execute when this extension is called
*/
function extensions_add_opemode_tab_agent($tabId, $tabName, $tabIcon, $tabFunction, $version="N/A") {
function extensions_add_opemode_tab_agent($tabId, $tabName, $tabIcon, $tabFunction, $version="N/A", $acl = 'AR') {
global $config;
global $extension_file;
@ -441,6 +442,7 @@ function extensions_add_opemode_tab_agent($tabId, $tabName, $tabIcon, $tabFuncti
$extension['extension_ope_tab']['icon'] = $tabIcon;
$extension['extension_ope_tab']['function'] = $tabFunction;
$extension['extension_ope_tab']['version'] = $version;
$extension['extension_ope_tab']['acl'] = $acl;
}
/**

View File

@ -157,19 +157,15 @@ $data_agents = array(
$table->data[1][0] = reporting_get_stats_alerts($data);
$table->data[2][0] = reporting_get_stats_modules_status($data, 180, 100, false, $data_agents);
$table->data[3][0] = reporting_get_stats_agents_monitors($data);
$table->rowclass[] = '';
// ---------------------------------------------------------------------
// Server performance
// ---------------------------------------------------------------------
if ($is_admin) {
$table->data[4][0] = reporting_get_stats_servers(false);
$table->rowclass[] = '';
}
html_print_table($table);
@ -178,7 +174,6 @@ echo '</td>'; //Left column
echo '<td style="vertical-align: top; width: 75%; padding-top: 0px;" id="rightcolumn">';
// ---------------------------------------------------------------------
// Last events information
// ---------------------------------------------------------------------

View File

@ -1155,57 +1155,53 @@ if (isset($ehorus_tab) && !empty($ehorus_tab)) {
//Tabs for extensions
foreach ($config['extensions'] as $extension) {
if (isset($extension['extension_ope_tab'])) {
//VMware extension is only available for VMware OS
if ($extension['extension_ope_tab']['id'] === "vmware_manager") {
//Check if OS is vmware
$id_remote_field = db_get_value ("id_field",
"tagent_custom_fields", "name", "vmware_type");
$vmware_type = db_get_value_filter("description",
"tagent_custom_data",
array("id_field" => $id_remote_field, "id_agent" => $agent["id_agente"]));
if ($vmware_type != "vm") {
continue;
if (check_acl($config['id_user'], $id_grupo, $extension['extension_ope_tab']['acl'])) {
//VMware extension is only available for VMware OS
if ($extension['extension_ope_tab']['id'] === "vmware_manager") {
//Check if OS is vmware
$id_remote_field = db_get_value ("id_field",
"tagent_custom_fields", "name", "vmware_type");
$vmware_type = db_get_value_filter("description",
"tagent_custom_data",
array("id_field" => $id_remote_field, "id_agent" => $agent["id_agente"]));
if ($vmware_type != "vm") {
continue;
}
}
}
//RHEV extension is only available for RHEV Virtual Machines
if ($extension['extension_ope_tab']['id'] === "rhev_manager") {
//Get id for remote field "rhev_type"
$id_remote_field = db_get_value("id_field", "tagent_custom_fields", "name", "rhev_type");
//Get rhev type for this agent
$rhev_type = db_get_value_filter ("description", "tagent_custom_data", array ("id_field" => $id_remote_field, "id_agent" => $agent['id_agente']));
//Check if rhev type is a vm
if ($rhev_type != "vm") {
continue;
//RHEV extension is only available for RHEV Virtual Machines
if ($extension['extension_ope_tab']['id'] === "rhev_manager") {
//Get id for remote field "rhev_type"
$id_remote_field = db_get_value("id_field", "tagent_custom_fields", "name", "rhev_type");
//Get rhev type for this agent
$rhev_type = db_get_value_filter ("description", "tagent_custom_data", array ("id_field" => $id_remote_field, "id_agent" => $agent['id_agente']));
//Check if rhev type is a vm
if ($rhev_type != "vm") {
continue;
}
}
$image = $extension['extension_ope_tab']['icon'];
$name = $extension['extension_ope_tab']['name'];
$id = $extension['extension_ope_tab']['id'];
$id_extension = get_parameter('id_extension', '');
if ($id_extension == $id) {
$active = true;
}
else {
$active = false;
}
$url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=extension&id_agente='.$id_agente . '&id_extension=' . $id;
$extension_tab = array('text' => '<a href="' . $url .'">' . html_print_image ($image, true, array ( "title" => $name)) . '</a>', 'active' => $active);
$onheader = $onheader + array($id => $extension_tab);
}
$image = $extension['extension_ope_tab']['icon'];
$name = $extension['extension_ope_tab']['name'];
$id = $extension['extension_ope_tab']['id'];
$id_extension = get_parameter('id_extension', '');
if ($id_extension == $id) {
$active = true;
}
else {
$active = false;
}
$url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=extension&id_agente='.$id_agente . '&id_extension=' . $id;
$extension_tab = array('text' => '<a href="' . $url .'">' . html_print_image ($image, true, array ( "title" => $name)) . '</a>', 'active' => $active);
$onheader = $onheader + array($id => $extension_tab);
}
}