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:
vgilc 2017-03-13 12:53:51 +01:00
commit 2d3af34aea
5 changed files with 53 additions and 51 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 ('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) {

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

@ -430,7 +430,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 +441,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

@ -1136,7 +1136,7 @@ if (isset($ehorus_tab) && !empty($ehorus_tab)) {
//Tabs for extensions
foreach ($config['extensions'] as $extension) {
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
if ($extension['extension_ope_tab']['id'] === "vmware_manager") {
@ -1189,6 +1189,7 @@ foreach ($config['extensions'] as $extension) {
$onheader = $onheader + array($id => $extension_tab);
}
}
}
$header_description = '';
switch($tab) {