Readded the extension admin page. TICKET: #3149

This commit is contained in:
mdtrooper 2016-01-12 14:08:17 +01:00
parent 74a4c11f4b
commit 703b27027f
3 changed files with 42 additions and 111 deletions

View File

@ -142,27 +142,19 @@ $table->width = '98%';
$table->head = array();
$table->head[] = __('File');
$table->head[] = __('Version');
$table->head[] = "<span title='" . __("Enterprise") . "'>" . __('E.') . "</span>";
$table->head[] = "<span title='" . __("Godmode Function") . "'>" . __('G.F.') . "</span>";
$table->head[] = "<span title='" . __("Godmode Menu") . "'>" . __('G.M.') . "</span>";
$table->head[] = "<span title='" . __("Operation Menu") . "'>" . __('O.M.') . "</span>";
$table->head[] = "<span title='" . __("Operation Function") . "'>" . __('O.F.') . "</span>";
$table->head[] = "<span title='" . __("Login Function") . "'>" . __('L.F.') . "</span>";
$table->head[] = "<span title='" . __("Agent operation tab") . "'>" . __('A.O.T.') . "</span>";
$table->head[] = "<span title='" . __("Agent godmode tab") . "'>" . __('A.G.T.') . "</span>";
$table->head[] = "<span title='" . __("Operation") . "'>" . __('O.') . "</span>";
$table->head[] = __("Enterprise");
$table->head[] = __("Godmode Function");
$table->head[] = __("Godmode Menu");
$table->head[] = __("Operation Menu");
$table->head[] = __("Operation Function");
$table->head[] = __("Login Function");
$table->head[] = __("Agent operation tab");
$table->head[] = __("Agent godmode tab");
$table->head[] = __("Operation");
$table->width = array();
$table->width[] = '30%';
$table->width[] = '30%';
$table->width[] = '22px';
$table->width[] = '44px';
$table->width[] = '44px';
$table->width[] = '44px';
$table->width[] = '44px';
$table->width[] = '66px';
$table->width[] = '66px';
$table->width[] = '44px';
$table->align = array();
$table->align[] = 'left';

View File

@ -215,9 +215,9 @@ if (check_acl ($config['id_user'], 0, "PM")) {
$menu_godmode["gsetup"]["text"] = __('Setup');
$menu_godmode["gsetup"]["sec2"] = "godmode/setup/setup&section=general";
$menu_godmode["gsetup"]["id"] = "god-setup";
$sub = array ();
// Options Setup
$sub["general"]["text"] = __('Setup');
$sub["general"]["id"] = 'Setup';
@ -228,30 +228,30 @@ if (check_acl ($config['id_user'], 0, "PM")) {
$sub2["godmode/setup/setup&amp;section=general"]["text"] = __('General Setup');
$sub2["godmode/setup/setup&amp;section=general"]["id"] = 'General Setup';
$sub2["godmode/setup/setup&amp;section=general"]["refr"] = 0;
enterprise_hook ('password_submenu');
enterprise_hook ('enterprise_submenu');
enterprise_hook ('historydb_submenu');
enterprise_hook ('log_collector_submenu');
$sub2["godmode/setup/setup&amp;section=auth"]["text"] = __('Authentication');
$sub2["godmode/setup/setup&amp;section=auth"]["refr"] = 0;
$sub2["godmode/setup/setup&amp;section=perf"]["text"] = __('Performance');
$sub2["godmode/setup/setup&amp;section=perf"]["refr"] = 0;
$sub2["godmode/setup/setup&amp;section=vis"]["text"] = __('Visual styles');
$sub2["godmode/setup/setup&amp;section=vis"]["refr"] = 0;
if (check_acl ($config['id_user'], 0, "AW")) {
if ($config['activate_netflow']) {
$sub2["godmode/setup/setup&amp;section=net"]["text"] = __('Netflow');
$sub2["godmode/setup/setup&amp;section=net"]["refr"] = 0;
}
}
if ($config['activate_gis'])
$sub2["godmode/setup/gis"]["text"] = __('Map conections GIS');
@ -260,9 +260,9 @@ if (check_acl ($config['id_user'], 0, "PM")) {
$sub["godmode/setup/os"]["id"] = 'Edit OS';
$sub["godmode/setup/license"]["text"] = __('License');
$sub["godmode/setup/license"]["id"] = 'License';
enterprise_hook ('skins_submenu');
$menu_godmode["gsetup"]["sub"] = $sub;
}
@ -270,7 +270,7 @@ if (check_acl ($config['id_user'], 0, "PM")) {
$menu_godmode["gextensions"]["text"] = __('Admin tools');
$menu_godmode["gextensions"]["sec2"] = "godmode/extensions";
$menu_godmode["gextensions"]["id"] = "god-extensions";
$sub = array ();
// Audit //meter en extensiones
$sub["godmode/admin_access_logs"]["text"] = __('System audit log');
@ -279,7 +279,11 @@ if (check_acl ($config['id_user'], 0, "PM")) {
$sub["godmode/setup/links"]["id"] = 'Links';
$sub["godmode/update_manager/update_manager"]["text"] = __('Update manager');
$sub["godmode/update_manager/update_manager"]["id"] = 'Update manager';
$sub["gextmaneger"]["sub2"] = $sub2;
$sub["godmode/extensions"]["sub2"] = $sub2;
if (check_acl ($config['id_user'], 0, "DM")) {
$sub["gdbman"]["text"] = __('DB maintenance');
$sub["gdbman"]["id"] = 'DB maintenance';
@ -291,7 +295,7 @@ if (check_acl ($config['id_user'], 0, "PM")) {
$sub2["godmode/db/db_refine"]["text"] = __('Database debug');
$sub2["godmode/db/db_audit"]["text"] = __('Database audit');
$sub2["godmode/db/db_event"]["text"] = __('Database event');
$sub["gdbman"]["sub2"] = $sub2;
}
$sub["extras/pandora_diag"]["text"] = __('Diagnostic info');
@ -308,24 +312,24 @@ if (check_acl ($config['id_user'], 0, "PM")) {
if (is_array ($config['extensions'])) {
$sub = array ();
$sub["gextmaneger"]["text"] = __('Extension manager');
$sub["gextmaneger"]["id"] = 'Extension manager';
$sub["gextmaneger"]["type"] = "direct";
$sub["gextmaneger"]["subtype"] = "nolink";
$sub["godmode/extensions"]["text"] = __('Extension manager');
$sub["godmode/extensions"]["id"] = 'Extension manager';
$sub2 = array ();
foreach ($config['extensions'] as $extension) {
//If no godmode_menu is a operation extension
if ($extension['godmode_menu'] == '') {
continue;
}
$extmenu = $extension['godmode_menu'];
if ($extmenu["name"] == 'DB interface' && !check_acl ($config['id_user'], 0, "DM")) {
continue;
}
//Check the ACL for this user
if (! check_acl ($config['id_user'], 0, $extmenu['acl'])) {
continue;
@ -379,7 +383,12 @@ if (check_acl ($config['id_user'], 0, "PM")) {
}
}
}
$sub["gextmaneger"]["sub2"] = $sub2;
$sub["godmode/extensions"]["sub2"] = $sub2;
$submenu = array_merge($menu_godmode["gextensions"]["sub"],$sub);
$menu_godmode["gextensions"]["sub"] = $submenu;
}

View File

@ -1,70 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
check_login ();
if (! check_acl ($config['id_user'], 0, "AR")) {
db_pandora_audit("ACL Violation",
"Trying to access extensions list");
include ("general/noaccess.php");
exit;
}
// Header
ui_print_page_header (__('Extensions'). " &raquo; ". __('Defined extensions'), "images/extensions.png", false, "", false, "" );
if (sizeof ($config['extensions']) == 0) {
echo '<h3>'.__('There are no extensions defined').'</h3>';
return;
}
$delete = get_parameter ("delete", "");
$name = get_parameter ("name", "");
if ($delete != "") {
if (!file_exists($config["homedir"]."/extensions/ext_backup"))
mkdir($config["homedir"]."/extensions/ext_backup");
$source = $config["homedir"]."/$delete.php";
rename ($source, $config["homedir"]."/extensions/ext_backup/$name.php");
}
$table->width = '60%';
$table->head = array ();
$table->head[0] = __('Name');
$table->head[1] = __('Version');
$table->head[2] = __('Action');
$table->style = array();
$table->style[1] = 'text-align: center;';
$table->style[2] = 'text-align: center; font-weight: bolder;';
$table->data = array ();
foreach ($config['extensions'] as $extension) {
if ($extension['main_function'] == '')
continue;
if ($extension['operation_menu'] == null)
continue;
$data = array ();
$data[0] = $extension['operation_menu']['name'];
$data[1] = $extension['operation_menu']['version'];
$data[2] = '<a href="index.php?sec=extensions&amp;sec2='.$extension['operation_menu']['sec2'].'" class="mn">' . __('Execute') . '</a>';
array_push ($table->data, $data);
}
html_print_table ($table);
?>