mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Merge branch 'acl_in_extension_agent_tab' into 'pandora_6.0'
Add acl system in agent tab extesions See merge request !240
This commit is contained in:
commit
2d3af34aea
@ -20,7 +20,7 @@ $id_agente = get_parameter ("id_agente");
|
|||||||
$address = agents_get_address($id_agente);
|
$address = agents_get_address($id_agente);
|
||||||
|
|
||||||
if (!empty($address) || empty($id_agente)) {
|
if (!empty($address) || empty($id_agente)) {
|
||||||
extensions_add_opemode_tab_agent ('network_tools','Network Tools','extensions/net_tools/nettool.png',"main_net_tools", "v1r1");
|
extensions_add_opemode_tab_agent ('network_tools','Network Tools','extensions/net_tools/nettool.png',"main_net_tools", "v1r1", 'AW');
|
||||||
}
|
}
|
||||||
|
|
||||||
function whereis_the_command ($command) {
|
function whereis_the_command ($command) {
|
||||||
|
@ -20,7 +20,7 @@ $id_agente = get_parameter ("id_agente");
|
|||||||
$address = agents_get_address($id_agente);
|
$address = agents_get_address($id_agente);
|
||||||
|
|
||||||
if (!empty($address) || empty($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 () {
|
function ssh_gateway () {
|
||||||
|
@ -39,6 +39,6 @@ $id_agente = get_parameter ("id_agente");
|
|||||||
$address = agents_get_address($id_agente);
|
$address = agents_get_address($id_agente);
|
||||||
|
|
||||||
if (!empty($address) || empty($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');
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -430,7 +430,7 @@ function extensions_add_godmode_tab_agent($tabId, $tabName, $tabIcon, $tabFuncti
|
|||||||
* @param tabIcon Path to the image icon
|
* @param tabIcon Path to the image icon
|
||||||
* @param tabFunction Name of the function to execute when this extension is called
|
* @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 $config;
|
||||||
global $extension_file;
|
global $extension_file;
|
||||||
|
|
||||||
@ -441,6 +441,7 @@ function extensions_add_opemode_tab_agent($tabId, $tabName, $tabIcon, $tabFuncti
|
|||||||
$extension['extension_ope_tab']['icon'] = $tabIcon;
|
$extension['extension_ope_tab']['icon'] = $tabIcon;
|
||||||
$extension['extension_ope_tab']['function'] = $tabFunction;
|
$extension['extension_ope_tab']['function'] = $tabFunction;
|
||||||
$extension['extension_ope_tab']['version'] = $version;
|
$extension['extension_ope_tab']['version'] = $version;
|
||||||
|
$extension['extension_ope_tab']['acl'] = $acl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1136,57 +1136,58 @@ if (isset($ehorus_tab) && !empty($ehorus_tab)) {
|
|||||||
//Tabs for extensions
|
//Tabs for extensions
|
||||||
foreach ($config['extensions'] as $extension) {
|
foreach ($config['extensions'] as $extension) {
|
||||||
if (isset($extension['extension_ope_tab'])) {
|
if (isset($extension['extension_ope_tab'])) {
|
||||||
|
if (check_acl($config['id_user'], $id_grupo, $extension['extension_ope_tab']['acl'])) {
|
||||||
//VMware extension is only available for VMware OS
|
//VMware extension is only available for VMware OS
|
||||||
if ($extension['extension_ope_tab']['id'] === "vmware_manager") {
|
if ($extension['extension_ope_tab']['id'] === "vmware_manager") {
|
||||||
|
|
||||||
//Check if OS is vmware
|
//Check if OS is vmware
|
||||||
$id_remote_field = db_get_value ("id_field",
|
$id_remote_field = db_get_value ("id_field",
|
||||||
"tagent_custom_fields", "name", "vmware_type");
|
"tagent_custom_fields", "name", "vmware_type");
|
||||||
|
|
||||||
$vmware_type = db_get_value_filter("description",
|
$vmware_type = db_get_value_filter("description",
|
||||||
"tagent_custom_data",
|
"tagent_custom_data",
|
||||||
array("id_field" => $id_remote_field, "id_agent" => $agent["id_agente"]));
|
array("id_field" => $id_remote_field, "id_agent" => $agent["id_agente"]));
|
||||||
|
|
||||||
if ($vmware_type != "vm") {
|
if ($vmware_type != "vm") {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
//RHEV extension is only available for RHEV Virtual Machines
|
||||||
|
if ($extension['extension_ope_tab']['id'] === "rhev_manager") {
|
||||||
//RHEV extension is only available for RHEV Virtual Machines
|
//Get id for remote field "rhev_type"
|
||||||
if ($extension['extension_ope_tab']['id'] === "rhev_manager") {
|
$id_remote_field = db_get_value("id_field", "tagent_custom_fields", "name", "rhev_type");
|
||||||
//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']));
|
||||||
//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") {
|
||||||
//Check if rhev type is a vm
|
continue;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user