Merge remote-tracking branch 'origin/develop' into ent-9129-ampliar-funcionalidad-de-los-informes-top-n-actuales

This commit is contained in:
Daniel Barbero Martin 2022-06-29 13:54:27 +02:00
commit 2ff94b319c
38 changed files with 288 additions and 217 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.763-220628
Version: 7.0NG.763-220629
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.763-220628"
pandora_version="7.0NG.763-220629"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1015,7 +1015,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.763';
use constant AGENT_BUILD => '220628';
use constant AGENT_BUILD => '220629';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.763
%define release 220628
%define release 220629
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.763
%define release 220628
%define release 220629
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.763"
PI_BUILD="220628"
PI_BUILD="220629"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{220628}
{220629}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.763 Build 220628")
#define PANDORA_VERSION ("7.0NG.763 Build 220629")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.763(Build 220628))"
VALUE "ProductVersion", "(7.0NG.763(Build 220629))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.763-220628
Version: 7.0NG.763-220629
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.763-220628"
pandora_version="7.0NG.763-220629"
package_pear=0
package_pandora=1

View File

@ -352,14 +352,15 @@ if ($search_string) {
$filter[] = "(name LIKE '%".$search_string."%' OR description LIKE '%".$search_string."%' OR value LIKE '%".$search_string."%')";
}
$total_templates = alerts_get_alert_templates($filter, ['COUNT(*) AS total']);
$total_templates = $total_templates[0]['total'];
$filter['offset'] = (int) get_parameter('offset');
$filter['limit'] = (int) $config['block_size'];
if (!is_user_admin($config['id_user'])) {
$filter['id_group'] = array_keys(users_get_groups(false, 'LM'));
}
$total_templates = alerts_get_alert_templates($filter, ['COUNT(*) AS total']);
$total_templates = $total_templates[0]['total'];
$templates = alerts_get_alert_templates(
$filter,
[

View File

@ -77,7 +77,7 @@ if (check_acl($config['id_user'], 0, 'PM')) {
'images/custom_columns.png',
true,
[
'title' => __('Custom fields'),
'title' => __('Custom columns'),
'class' => 'invert_filter',
]
).'</a>',
@ -87,18 +87,17 @@ if (check_acl($config['id_user'], 0, 'PM')) {
switch ($section) {
case 'filter':
$buttons['filter']['active'] = true;
$subpage = ' - '.__('Filters');
$subpage = __('Filters');
break;
case 'fields':
$buttons['fields']['active'] = true;
$subpage = ' - '.__('Custom fields');
$subpage = __('Custom columns');
break;
case 'responses':
$buttons['responses']['active'] = true;
$subpage = ' - '.__('Responses');
$help_header = '';
$subpage = __('Responses');
break;
case 'view':
@ -107,18 +106,28 @@ switch ($section) {
default:
$buttons['filter']['active'] = true;
$subpage = ' - '.__('Filters');
$subpage = __('Filters');
break;
}
if (! defined('METACONSOLE')) {
ui_print_page_header(
__('Manage events').$subpage,
if (is_metaconsole() === false) {
ui_print_standard_header(
$subpage,
'images/gm_events.png',
false,
$help_header,
'',
true,
$buttons
(array) $buttons,
[
[
'link' => '',
'label' => __('Configuration'),
],
[
'link' => '',
'label' => __('Events'),
],
]
);
} else {
ui_meta_print_header(__('Manage events').$subpage, '', $buttons);

View File

@ -1,16 +1,32 @@
<?php
/**
* Godmode menu.
*
* @category Menu
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2022 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 for 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.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2021 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.
// Begin.
require_once 'include/config.php';
check_login();
@ -21,11 +37,11 @@ require_once 'include/functions_menu.php';
$menu_godmode = [];
$menu_godmode['class'] = 'godmode';
if (check_acl($config['id_user'], 0, 'AR')
|| check_acl($config['id_user'], 0, 'AW')
|| check_acl($config['id_user'], 0, 'RR')
|| check_acl($config['id_user'], 0, 'RW')
|| check_acl($config['id_user'], 0, 'PM')
if ((bool) check_acl($config['id_user'], 0, 'AR') === true
|| (bool) check_acl($config['id_user'], 0, 'AW') === true
|| (bool) check_acl($config['id_user'], 0, 'RR') === true
|| (bool) check_acl($config['id_user'], 0, 'RW') === true
|| (bool) check_acl($config['id_user'], 0, 'PM') === true
) {
$sub = [];
$sub['godmode/servers/discovery&wiz=main']['text'] = __('Start');
@ -33,17 +49,17 @@ if (check_acl($config['id_user'], 0, 'AR')
$sub['godmode/servers/discovery&wiz=tasklist']['text'] = __('Task list');
$sub['godmode/servers/discovery&wiz=tasklist']['id'] = 'tasklist';
if (check_acl($config['id_user'], 0, 'AW')
|| check_acl($config['id_user'], 0, 'PM')
if ((bool) check_acl($config['id_user'], 0, 'AW') === true
|| (bool) check_acl($config['id_user'], 0, 'PM') === true
) {
if (check_acl($config['id_user'], 0, 'AW')) {
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
$sub2 = [];
$sub2['godmode/servers/discovery&wiz=hd&mode=netscan']['text'] = __('Network scan');
enterprise_hook('hostdevices_submenu');
$sub2['godmode/servers/discovery&wiz=hd&mode=customnetscan']['text'] = __('Custom network scan');
}
if (check_acl($config['id_user'], 0, 'PM')) {
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$sub2['godmode/servers/discovery&wiz=hd&mode=managenetscanscripts']['text'] = __('Manage scan scripts');
}
@ -52,7 +68,7 @@ if (check_acl($config['id_user'], 0, 'AR')
$sub['godmode/servers/discovery&wiz=hd']['sub2'] = $sub2;
}
if (check_acl($config['id_user'], 0, 'AW')) {
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
enterprise_hook('applications_menu');
enterprise_hook('cloud_menu');
enterprise_hook('console_task_menu');
@ -67,19 +83,19 @@ if (check_acl($config['id_user'], 0, 'AR')
$sub = [];
if (check_acl($config['id_user'], 0, 'AW') || check_acl($config['id_user'], 0, 'AD')) {
if ((bool) check_acl($config['id_user'], 0, 'AW') === true || (bool) check_acl($config['id_user'], 0, 'AD') === true) {
$sub['godmode/agentes/modificar_agente']['text'] = __('Manage agents');
$sub['godmode/agentes/modificar_agente']['id'] = 'Manage agents';
$sub['godmode/agentes/modificar_agente']['subsecs'] = ['godmode/agentes/configurar_agente'];
}
if (check_acl($config['id_user'], 0, 'PM')) {
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$sub['godmode/agentes/fields_manager']['text'] = __('Custom fields');
$sub['godmode/agentes/fields_manager']['id'] = 'Custom fields';
$sub['godmode/modules/manage_nc_groups']['text'] = __('Component groups');
$sub['godmode/modules/manage_nc_groups']['id'] = 'Component groups';
// Category
// Category.
$sub['godmode/category/category']['text'] = __('Module categories');
$sub['godmode/category/category']['id'] = 'Module categories';
$sub['godmode/category/category']['subsecs'] = 'godmode/category/edit_category';
@ -91,15 +107,15 @@ if (check_acl($config['id_user'], 0, 'PM')) {
$sub['godmode/groups/modu_group_list']['id'] = 'Module groups';
}
if (check_acl($config['id_user'], 0, 'AW')) {
// Netflow
if ($config['activate_netflow']) {
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
// Netflow.
if ((bool) $config['activate_netflow'] === true) {
$sub['godmode/netflow/nf_edit']['text'] = __('Netflow filters');
$sub['godmode/netflow/nf_edit']['id'] = 'Netflow filters';
}
}
if (!empty($sub)) {
if (empty($sub) === false) {
$menu_godmode['gagente']['text'] = __('Resources');
$menu_godmode['gagente']['sec2'] = 'godmode/agentes/modificar_agente';
$menu_godmode['gagente']['id'] = 'god-resources';
@ -107,13 +123,13 @@ if (!empty($sub)) {
}
$sub = [];
if (check_acl($config['id_user'], 0, 'PM')) {
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$sub['godmode/groups/group_list']['text'] = __('Manage agents groups');
$sub['godmode/groups/group_list']['id'] = 'Manage agents groups';
}
if (check_acl($config['id_user'], 0, 'PM')) {
// Tag
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
// Tag.
$sub['godmode/tag/tag']['text'] = __('Module tags');
$sub['godmode/tag/tag']['id'] = 'Module tags';
$sub['godmode/tag/tag']['subsecs'] = 'godmode/tag/edit_tag';
@ -121,17 +137,17 @@ if (check_acl($config['id_user'], 0, 'PM')) {
enterprise_hook('enterprise_acl_submenu');
}
if (check_acl($config['id_user'], 0, 'UM')) {
if ((bool) check_acl($config['id_user'], 0, 'UM') === true) {
$sub['godmode/users/user_list']['text'] = __('Users management');
$sub['godmode/users/user_list']['id'] = 'Users management';
}
if (check_acl($config['id_user'], 0, 'PM')) {
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$sub['godmode/users/profile_list']['text'] = __('Profile management');
$sub['godmode/users/profile_list']['id'] = 'Profile management';
}
if (!empty($sub)) {
if (empty($sub) === false) {
$menu_godmode['gusuarios']['sub'] = $sub;
$menu_godmode['gusuarios']['text'] = __('Profiles');
$menu_godmode['gusuarios']['sec2'] = 'godmode/users/user_list';
@ -139,8 +155,7 @@ if (!empty($sub)) {
}
$sub = [];
if (check_acl($config['id_user'], 0, 'PM')) {
// enterprise_hook('components_submenu');
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$sub['templates']['text'] = __('Templates');
$sub['templates']['id'] = 'Templates';
$sub['templates']['type'] = 'direct';
@ -155,31 +170,22 @@ if (check_acl($config['id_user'], 0, 'PM')) {
$sub2['godmode/modules/manage_network_components']['text'] = __('Remote components');
$sub2['godmode/modules/manage_network_components']['id'] = 'Network components';
$sub['templates']['sub2'] = $sub2;
/*
$sub2['godmode/modules/manage_snmp_modules']['text'] = __('SNMP Modules');
$sub2['godmode/modules/manage_snmp_modules']['id'] = 'SNMP Modules';
$sub2['godmode/modules/manage_wmi_modules']['text'] = __('WMI Modules');
$sub2['godmode/modules/manage_wmi_modules']['id'] = 'WMI Modules';
$sub['godmode/modules/manage_block_templates']['text'] = __('Module blocks');
$sub['godmode/modules/manage_block_templates']['id'] = 'Module blocks';
*/
enterprise_hook('inventory_submenu');
enterprise_hook('autoconfiguration_menu');
enterprise_hook('agent_repository_menu');
}
if (check_acl($config['id_user'], 0, 'AW')) {
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
enterprise_hook('policies_menu');
enterprise_hook('agents_submenu');
}
if (check_acl($config['id_user'], 0, 'NW')) {
if ((bool) check_acl($config['id_user'], 0, 'NW') === true) {
enterprise_hook('agents_ncm_submenu');
}
if (check_acl($config['id_user'], 0, 'AW')) {
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
$sub['gmassive']['text'] = __('Bulk operations');
$sub['gmassive']['id'] = 'Bulk operations';
$sub['gmassive']['type'] = 'direct';
@ -188,7 +194,7 @@ if (check_acl($config['id_user'], 0, 'AW')) {
$sub2['godmode/massive/massive_operations&amp;tab=massive_agents']['text'] = __('Agents operations');
$sub2['godmode/massive/massive_operations&amp;tab=massive_modules']['text'] = __('Modules operations');
$sub2['godmode/massive/massive_operations&amp;tab=massive_plugins']['text'] = __('Plugins operations');
if (check_acl($config['id_user'], 0, 'UM')) {
if ((bool) check_acl($config['id_user'], 0, 'UM') === true) {
$sub2['godmode/massive/massive_operations&amp;tab=massive_users']['text'] = __('Users operations');
}
@ -199,23 +205,48 @@ if (check_acl($config['id_user'], 0, 'AW')) {
enterprise_hook('massiveservices_submenu');
$sub['gmassive']['sub2'] = $sub2;
$sub2 = [];
}
if (check_acl($config['id_user'], 0, 'PM') || check_acl($config['id_user'], 0, 'UM')) {
if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($config['id_user'], 0, 'UM') === true) {
$sub['godmode/groups/group_list&tab=credbox']['text'] = __('Credential store');
$sub['godmode/groups/group_list&tab=credbox']['id'] = 'credential store';
}
if (!empty($sub)) {
// Manage events.
$sub2 = [];
if ((bool) check_acl($config['id_user'], 0, 'EW') === true || (bool) check_acl($config['id_user'], 0, 'EM') === true) {
// Custom event fields.
$sub2['godmode/events/events&section=filter']['text'] = __('Event filters');
$sub2['godmode/events/events&section=filter']['id'] = 'Event filters';
}
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$sub2['godmode/events/events&section=fields']['text'] = __('Custom columns');
$sub2['godmode/events/events&section=fields']['id'] = 'Custom events';
$sub2['godmode/events/events&section=responses']['text'] = __('Event responses');
$sub2['godmode/events/events&section=responses']['id'] = 'Event responses';
}
if (empty($sub2) === false) {
$sub['geventos']['text'] = __('Events');
$sub['geventos']['id'] = 'events';
$sub['geventos']['sec2'] = 'godmode/events/events&section=filter';
$sub['geventos']['type'] = 'direct';
$sub['geventos']['subtype'] = 'nolink';
$sub['geventos']['sub2'] = $sub2;
}
if (empty($sub) === false) {
$menu_godmode['gmodules']['text'] = __('Configuration');
$menu_godmode['gmodules']['sec2'] = 'godmode/modules/manage_network_templates';
$menu_godmode['gmodules']['id'] = 'god-configuration';
$menu_godmode['gmodules']['sub'] = $sub;
}
if (check_acl($config['id_user'], 0, 'LW')
|| check_acl($config['id_user'], 0, 'LM')
|| check_acl($config['id_user'], 0, 'AD')
if ((bool) check_acl($config['id_user'], 0, 'LW') === true
|| (bool) check_acl($config['id_user'], 0, 'LM') === true
|| (bool) check_acl($config['id_user'], 0, 'AD') === true
) {
$menu_godmode['galertas']['text'] = __('Alerts');
$menu_godmode['galertas']['sec2'] = 'godmode/alerts/alert_list';
@ -226,7 +257,7 @@ if (check_acl($config['id_user'], 0, 'LW')
$sub['godmode/alerts/alert_list']['id'] = 'List of Alerts';
$sub['godmode/alerts/alert_list']['pages'] = ['godmode/alerts/alert_view'];
if (check_acl($config['id_user'], 0, 'LM')) {
if ((bool) check_acl($config['id_user'], 0, 'LM') === true) {
$sub['godmode/alerts/alert_templates']['text'] = __('Templates');
$sub['godmode/alerts/alert_templates']['id'] = 'Templates';
$sub['godmode/alerts/alert_templates']['pages'] = ['godmode/alerts/configure_alert_template'];
@ -250,44 +281,21 @@ if (check_acl($config['id_user'], 0, 'LW')
$menu_godmode['galertas']['sub'] = $sub;
}
// Manage events
$sub = [];
if (check_acl($config['id_user'], 0, 'EW') || check_acl($config['id_user'], 0, 'EM')) {
// Custom event fields
$sub['godmode/events/events&section=filter']['text'] = __('Event filters');
$sub['godmode/events/events&section=filter']['id'] = 'Event filters';
}
if (check_acl($config['id_user'], 0, 'PM')) {
$sub['godmode/events/events&section=fields']['text'] = __('Custom events');
$sub['godmode/events/events&section=fields']['id'] = 'Custom events';
$sub['godmode/events/events&section=responses']['text'] = __('Event responses');
$sub['godmode/events/events&section=responses']['id'] = 'Event responses';
}
if (!empty($sub)) {
$menu_godmode['geventos']['text'] = __('Events');
$menu_godmode['geventos']['sec2'] = 'godmode/events/events&section=filter';
$menu_godmode['geventos']['id'] = 'god-events';
$menu_godmode['geventos']['sub'] = $sub;
}
if (check_acl($config['id_user'], 0, 'AW') || check_acl($config['id_user'], 0, 'PM')) {
// Servers
if ((bool) check_acl($config['id_user'], 0, 'AW') === true || (bool) check_acl($config['id_user'], 0, 'PM') === true) {
// Servers.
$menu_godmode['gservers']['text'] = __('Servers');
$menu_godmode['gservers']['sec2'] = 'godmode/servers/modificar_server';
$menu_godmode['gservers']['id'] = 'god-servers';
$sub = [];
if (check_acl($config['id_user'], 0, 'AW')) {
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
$sub['godmode/servers/modificar_server']['text'] = __('Manage servers');
$sub['godmode/servers/modificar_server']['id'] = 'Manage servers';
}
// This subtabs are only for Pandora Admin.
if (check_acl($config['id_user'], 0, 'PM')) {
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
enterprise_hook('ha_cluster');
$sub['godmode/servers/plugin']['text'] = __('Plugins');
@ -304,15 +312,15 @@ if (check_acl($config['id_user'], 0, 'AW') || check_acl($config['id_user'], 0, '
$menu_godmode['gservers']['sub'] = $sub;
}
if (check_acl($config['id_user'], 0, 'PM')) {
// Setup
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
// Setup.
$menu_godmode['gsetup']['text'] = __('Setup');
$menu_godmode['gsetup']['sec2'] = 'general';
$menu_godmode['gsetup']['id'] = 'god-setup';
$sub = [];
// Options Setup
// Options Setup.
$sub['general']['text'] = __('Setup');
$sub['general']['id'] = 'Setup';
$sub['general']['type'] = 'direct';
@ -337,8 +345,8 @@ if (check_acl($config['id_user'], 0, 'PM')) {
$sub2['godmode/setup/setup&section=vis']['text'] = __('Visual styles');
$sub2['godmode/setup/setup&section=vis']['refr'] = 0;
if (check_acl($config['id_user'], 0, 'AW')) {
if ($config['activate_netflow']) {
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
if ((bool) $config['activate_netflow'] === true) {
$sub2['godmode/setup/setup&section=net']['text'] = __('Netflow');
$sub2['godmode/setup/setup&section=net']['refr'] = 0;
}
@ -361,7 +369,7 @@ if (check_acl($config['id_user'], 0, 'PM')) {
$sub2['godmode/setup/setup&section=external_tools']['text'] = __('External Tools');
$sub2['godmode/setup/setup&section=external_tools']['refr'] = 0;
if ($config['activate_gis']) {
if ((bool) $config['activate_gis'] === true) {
$sub2['godmode/setup/setup&section=gis']['text'] = __('Map conections GIS');
}
@ -376,14 +384,14 @@ if (check_acl($config['id_user'], 0, 'PM')) {
$menu_godmode['gsetup']['sub'] = $sub;
}
if (check_acl($config['id_user'], 0, 'PM') || check_acl($config['id_user'], 0, 'DM')) {
if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($config['id_user'], 0, 'DM') === true) {
$menu_godmode['gextensions']['text'] = __('Admin tools');
$menu_godmode['gextensions']['sec2'] = 'godmode/extensions';
$menu_godmode['gextensions']['id'] = 'god-extensions';
$sub = [];
if (check_acl($config['id_user'], 0, 'PM')) {
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
// Audit //meter en extensiones.
$sub['godmode/audit_log']['text'] = __('System audit log');
$sub['godmode/audit_log']['id'] = 'System audit log';
@ -399,7 +407,7 @@ if (check_acl($config['id_user'], 0, 'PM') || check_acl($config['id_user'], 0, '
$sub['godmode/setup/file_manager']['text'] = __('File manager');
$sub['godmode/setup/file_manager']['id'] = 'File manager';
if (is_user_admin($config['id_user'])) {
if (is_user_admin($config['id_user']) === true) {
$sub['extensions/db_status']['text'] = __('DB Schema Check');
$sub['extensions/db_status']['id'] = 'DB Schema Check';
$sub['extensions/db_status']['sec'] = 'gbman';
@ -414,40 +422,38 @@ if (check_acl($config['id_user'], 0, 'PM') || check_acl($config['id_user'], 0, '
$menu_godmode['gextensions']['sub'] = $sub;
}
if (is_array($config['extensions'])) {
if (is_array($config['extensions']) === true) {
$sub = [];
$sub2 = [];
foreach ($config['extensions'] as $extension) {
// If no godmode_menu is a operation extension
if ($extension['godmode_menu'] == '') {
// If no godmode_menu is a operation extension.
if (empty($extension['godmode_menu']) === true) {
continue;
}
if ($extension['godmode_menu']['name'] == 'System Info') {
if ($extension['godmode_menu']['name'] === 'System Info') {
continue;
}
if ($extension['godmode_menu']['name'] != __('DB Schema check') && $extension['godmode_menu']['name'] != __('DB interface')) {
if ($extension['godmode_menu']['name'] !== __('DB Schema check') && $extension['godmode_menu']['name'] !== __('DB interface')) {
$extmenu = $extension['godmode_menu'];
}
// Check the ACL for this user
if (! check_acl($config['id_user'], 0, $extmenu['acl'])) {
// Check the ACL for this user.
if ((bool) check_acl($config['id_user'], 0, $extmenu['acl']) === false) {
continue;
}
// Check if was displayed inside other menu
if ($extension['godmode_menu']['fatherId'] == '') {
// Check if was displayed inside other menu.
if (empty($extension['godmode_menu']['fatherId']) === true) {
$sub2[$extmenu['sec2']]['text'] = __($extmenu['name']);
$sub2[$extmenu['sec2']]['id'] = $extmenu['name'];
$sub2[$extmenu['sec2']]['refr'] = 0;
} else {
if (is_array($extmenu) && array_key_exists('fatherId', $extmenu)) {
if (is_array($extmenu) === true && array_key_exists('fatherId', $extmenu) === true) {
if (strlen($extmenu['fatherId']) > 0) {
if (array_key_exists('subfatherId', $extmenu)) {
if (array_key_exists('subfatherId', $extmenu) === true) {
if (strlen($extmenu['subfatherId']) > 0) {
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['text'] = __($extmenu['name']);
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['id'] = $extmenu['name'];
@ -462,12 +468,7 @@ if (is_array($config['extensions'])) {
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['id'] = $extmenu['name'];
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['refr'] = 0;
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['icon'] = $extmenu['icon'];
if ($extmenu['name'] == 'Cron jobs') {
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['sec'] = $extmenu['fatherId'];
} else {
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['sec'] = $extmenu['fatherId'];
}
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['sec'] = $extmenu['fatherId'];
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['extension'] = true;
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['enterprise'] = $extension['enterprise'];
$menu_godmode[$extmenu['fatherId']]['hasExtensions'] = true;
@ -487,7 +488,7 @@ if (is_array($config['extensions'])) {
}
}
// Complete the submenu
// Complete the submenu.
$extension_view = [];
$extension_view['godmode/extensions']['id'] = 'Extension manager view';
$extension_view['godmode/extensions']['text'] = __('Extension manager view');
@ -499,7 +500,7 @@ if (is_array($config['extensions'])) {
$sub['godmode/extensions']['type'] = 'direct';
$sub['godmode/extensions']['subtype'] = 'nolink';
if (is_array($menu_godmode['gextensions']['sub'])) {
if (is_array($menu_godmode['gextensions']['sub']) === true) {
$submenu = array_merge($menu_godmode['gextensions']['sub'], $sub);
if ($menu_godmode['gextensions']['sub'] != null) {
$menu_godmode['gextensions']['sub'] = $submenu;
@ -514,7 +515,7 @@ $menu_godmode['links']['id'] = 'god-links';
$sub = [];
$rows = db_get_all_rows_in_table('tlink', 'name');
foreach ($rows as $row) {
// Audit //meter en extensiones
// Audit //meter en extensiones.
$sub[$row['link']]['text'] = $row['name'];
$sub[$row['link']]['id'] = $row['name'];
$sub[$row['link']]['type'] = 'direct';
@ -523,9 +524,9 @@ foreach ($rows as $row) {
$menu_godmode['links']['sub'] = $sub;
// Update Manager
if (check_acl($config['id_user'], 0, 'PM') && $config['enable_update_manager']) {
$menu_godmode['messages']['text'] = __('Warp Update');
// Warp Manager.
if ((bool) check_acl($config['id_user'], 0, 'PM') === true && (bool) $config['enable_update_manager'] === true) {
$menu_godmode['messages']['text'] = __('Warp Update');;
$menu_godmode['messages']['id'] = 'god-um_messages';
$menu_godmode['messages']['sec2'] = '';
@ -546,7 +547,7 @@ if (check_acl($config['id_user'], 0, 'PM') && $config['enable_update_manager'])
}
// Module library.
if (check_acl($config['id_user'], 0, 'AR')) {
if ((bool) check_acl($config['id_user'], 0, 'AR') === true) {
$menu_godmode['gmodule_library']['text'] = __('Module library');
$menu_godmode['gmodule_library']['id'] = 'god-module_library';
@ -560,6 +561,6 @@ if (check_acl($config['id_user'], 0, 'AR')) {
$menu_godmode['gmodule_library']['sub'] = $sub;
}
if (!$config['pure']) {
if ((bool) $config['pure'] === false) {
menu_print_menu($menu_godmode);
}

View File

@ -260,6 +260,8 @@ class CalendarManager
*/
public function deleteCalendar()
{
global $config;
$id = (int) get_parameter('id');
try {
$calendar = new Calendar($id);
@ -278,6 +280,22 @@ class CalendarManager
return;
}
if (is_numeric($id) === true) {
if ((bool) check_acl(
$config['id_user'],
$calendar->id_group(),
'LM'
) === false
) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access calendar delete'
);
include 'general/noaccess.php';
exit;
}
}
// Remove.
$calendar->delete();
$this->message = \ui_print_success_message(
@ -480,6 +498,35 @@ class CalendarManager
$new = true;
}
$group_id = null;
if ($new === true) {
if (is_numeric(get_parameter('id_group')) === true) {
$group_id = get_parameter('id_group');
}
} else {
if (is_numeric($calendar->id_group()) === true) {
$group_id = $calendar->id_group();
}
}
if (is_numeric($group_id) === true) {
// Check for permissions before rendering edit view or performing save action.
if ((bool) check_acl(
$config['id_user'],
$group_id,
'LM'
) === false
) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access calendar editor'
);
include 'general/noaccess.php';
exit;
}
}
$action = get_parameter('action');
if ($action === 'save') {
$success = false;
@ -604,19 +651,23 @@ class CalendarManager
$is_management_allowed = \is_management_allowed();
if ((bool) $data === true) {
$manage = check_acl(
$config['id_user'],
0,
'LM',
true
);
$user_id = $config['id_user'];
$data = array_reduce(
$data,
function ($carry, $item) use ($manage, $is_management_allowed) {
function ($carry, $item) use ($user_id, $is_management_allowed) {
// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
// Transforms array of arrays $data into an array
// of objects, making a post-process of certain fields.
// Users must only be able to manage items that belong to their groups.
// IMPORTANT: if user does not have permission over 'All' group, items belonging to such
// group must be listed but they must not allow for edition.
$manage = check_acl_restricted_all(
$user_id,
$item['id_group'],
'LM'
);
$tmp = (object) $item;
if ((bool) $manage === true) {

View File

@ -20,7 +20,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC220628';
$build_version = 'PC220629';
$pandora_version = 'v7.0NG.763';
// Do not overwrite default timezone set if defined.

View File

@ -2399,9 +2399,9 @@ function check_acl_one_of_groups($id_user, $groups, $access, $cache=true)
* LM - Alert Management
* PM - Pandora Management
*
* @param integer $id_user User id
* @param integer $id_group Agents group id to check from
* @param string $access Access privilege
* @param integer $id_user User id.
* @param integer $id_group Agents group id to check from.
* @param string $access Access privilege.
* @param boolean $onlyOneGroup Flag to check acl for specified group only (not to roots up, or check acl for 'All' group when $id_group is 0).
*
* @return boolean 1 if the user has privileges, 0 if not.
@ -2409,7 +2409,7 @@ function check_acl_one_of_groups($id_user, $groups, $access, $cache=true)
function check_acl_restricted_all($id_user, $id_group, $access, $onlyOneGroup=false)
{
if (empty($id_user)) {
// User ID needs to be specified
// User ID needs to be specified.
trigger_error('Security error: check_acl got an empty string for user id', E_USER_WARNING);
return 0;
} else if (is_user_admin($id_user)) {

View File

@ -401,8 +401,15 @@ function events_delete($id_evento, $filter=null, $history=false, $force_node=fal
case '1':
// Group by events.
$event = events_get_event($id_evento, ['estado', 'event_type', 'id_agente', 'id_agentmodule']);
$filter['group_rep'] = 0;
$filter['status'] = $event['estado'];
$filter['event_type'] = $event['event_type'];
$filter['id_agent'] = $event['id_agente'];
$filter['id_agentmodule'] = $event['id_agentmodule'];
$sql = events_get_all(
['te.*'],
['te.id_evento'],
$filter,
// Offset.
null,
@ -418,18 +425,7 @@ function events_delete($id_evento, $filter=null, $history=false, $force_node=fal
true
);
$target_ids = db_get_all_rows_sql(
sprintf(
'SELECT tu.id_evento FROM tevento tu INNER JOIN ( %s ) tf
ON tu.estado = tf.estado
AND tu.evento = tf.evento
AND tu.id_agente = tf.id_agente
AND tu.id_agentmodule = tf.id_agentmodule
AND tf.max_id_evento = %d',
$sql,
$id_evento
)
);
$target_ids = db_get_all_rows_sql($sql);
// Try to avoid deadlock while updating full set.
if ($target_ids !== false && count($target_ids) > 0) {
@ -494,8 +490,15 @@ function events_update_status($id_evento, $status, $filter=null)
case '1':
// Group by events.
$event = events_get_event($id_evento, ['estado', 'event_type', 'id_agente', 'id_agentmodule']);
$filter['group_rep'] = 0;
$filter['status'] = $event['estado'];
$filter['event_type'] = $event['event_type'];
$filter['id_agent'] = $event['id_agente'];
$filter['id_agentmodule'] = $event['id_agentmodule'];
$sql = events_get_all(
['te.*'],
['te.id_evento'],
$filter,
// Offset.
null,
@ -511,18 +514,7 @@ function events_update_status($id_evento, $status, $filter=null)
true
);
$target_ids = db_get_all_rows_sql(
sprintf(
'SELECT tu.id_evento FROM tevento tu INNER JOIN ( %s ) tf
ON tu.estado = tf.estado
AND tu.evento = tf.evento
AND tu.id_agente = tf.id_agente
AND tu.id_agentmodule = tf.id_agentmodule
AND tf.max_id_evento = %d',
$sql,
$id_evento
)
);
$target_ids = db_get_all_rows_sql($sql);
// Try to avoid deadlock while updating full set.
if ($target_ids !== false && count($target_ids) > 0) {
@ -732,6 +724,13 @@ function events_get_all(
);
}
if (isset($filter['id_agentmodule']) === true && $filter['id_agentmodule'] > 0) {
$sql_filters[] = sprintf(
' AND te.id_agentmodule = %d ',
$filter['id_agentmodule']
);
}
if (empty($filter['event_type']) === false && $filter['event_type'] !== 'all') {
if (is_array($filter['event_type']) === true) {
$type = [];

View File

@ -232,27 +232,22 @@ function menu_print_menu(&$menu)
$menu_selected = true;
$selected = true;
$visible = true;
} else if (($sec2 == $subsec2 || $allsec2 == $subsec2 || $selected_submenu2) && !isset($sub[$subsec2]['options'])) {
} else if (($sec2 === $subsec2 || $allsec2 === $subsec2 || $selected_submenu2 === true) && isset($sub[$subsec2]['options']) === false) {
$class .= 'submenu_selected selected';
$selected = true;
$menu_selected = true;
$hasExtensions = (array_key_exists('hasExtensions', $main)) ? $main['hasExtensions'] : false;
if (($extensionInMenuParameter != '') && ($hasExtensions)) {
$hasExtensions = (array_key_exists('hasExtensions', $main) === true) ? $main['hasExtensions'] : false;
if ((empty($extensionInMenuParameter) === false) && ((bool) $hasExtensions === true)) {
$visible = true;
} else {
$visible = false;
}
} else if (isset($sub['pages']) && (array_search($sec2, $sub['pages']) !== false)) {
$class .= 'submenu_selected selected';
$menu_selected = true;
$selected = true;
$visible = true;
} else {
// Else it's not selected.
$class .= 'submenu_not_selected';
}
if (! isset($sub['refr'])) {
if (isset($sub['refr']) === false) {
$sub['refr'] = 0;
}

View File

@ -186,6 +186,9 @@ class Calendar extends Entity
$order_by = '';
$pagination = '';
$user_groups = users_get_groups();
$user_groups_ids = implode(',', array_keys($user_groups));
if (isset($filter['free_search']) === true
&& empty($filter['free_search']) === false
) {
@ -196,6 +199,8 @@ class Calendar extends Entity
);
}
$sql_filters[] = ' AND id_group IN ('.$user_groups_ids.')';
if (isset($order) === true) {
$dir = 'asc';
if ($order === 'desc') {

View File

@ -478,7 +478,7 @@ class ModuleStatusWidget extends Widget
case 4:
// Critical (ALERT).
$icon = '4'.$icon.'_bad.png';
$icon = $icon.'_bad.png';
break;
case 0:
@ -493,7 +493,7 @@ class ModuleStatusWidget extends Widget
case 10:
// Warning (ALERT).
$icon = '4'.$icon.'_warning.png';
$icon = $icon.'_warning.png';
break;
case 3:

View File

@ -206,7 +206,7 @@ class SpecialDay extends Entity
&& empty($filter['id_group']) === false
) {
$sql_filters[] = sprintf(
' AND `talert_special_days`.`id_group` IN ("%s")',
' AND `talert_special_days`.`id_group` IN (%s)',
implode(',', $filter['id_group'])
);
}

View File

@ -129,7 +129,7 @@
<div style='height: 10px'>
<?php
$version = '7.0NG.763';
$build = '220628';
$build = '220629';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -390,11 +390,11 @@ if (is_ajax() === true) {
// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
if ($tmp->meta === true) {
if ($tmp->server_name !== null) {
$tmp->data_server = metaconsole_get_servers(
$data_server = metaconsole_get_servers(
$tmp->server_id
);
$tmp->server_url_hash = metaconsole_get_servers_url_hash(
$tmp->data_server
$data_server
);
}
}
@ -892,11 +892,11 @@ if (is_ajax() === true) {
$server_url = '';
$hashdata = '';
if ($tmp->meta === true) {
if (isset($tmp->data_server) === true
&& $tmp->data_server !== false
if (isset($data_server) === true
&& $data_server !== false
&& isset($tmp->server_url_hash) === true
) {
$server_url = $tmp->data_server['server_url'];
$server_url = $data_server['server_url'];
$hashdata = $tmp->server_url_hash;
}
}
@ -1455,15 +1455,19 @@ if ($pure) {
if (is_metaconsole() === false) {
unset($onheader['history']);
ui_print_page_header(
__('Events'),
ui_print_standard_header(
__('Events list'),
'images/lightning_go.png',
false,
'eventview',
false,
$onheader,
true,
'eventsmodal'
(array) $onheader,
[
[
'link' => '',
'label' => __('Events'),
],
]
);
} else {
unset($onheader['rss']);

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.763
%define release 220628
%define release 220629
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.763
%define release 220628
%define release 220629
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.763
%define release 220628
%define release 220629
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -73,6 +73,12 @@ if (empty($message) === false) {
echo $message;
}
$return_all_group = false;
if (users_can_manage_group_all('LM') === true) {
$return_all_group = true;
}
$inputs = [];
// Name.
@ -91,7 +97,7 @@ $inputs[] = [
'label' => __('Group'),
'arguments' => [
'type' => 'select_groups',
'returnAllGroup' => true,
'returnAllGroup' => $return_all_group,
'name' => 'id_group',
'selected' => $calendar->id_group(),
'required' => true,

View File

@ -45,7 +45,7 @@ if ((int) $cellData['id_widget'] !== 0) {
$output .= '</div>';
$output .= '<div class="header-options">';
if ($manageDashboards !== 0) {
if ($manageDashboards !== 0 || $writeDashboards !== 0) {
if ((int) $cellData['id_widget'] !== 0) {
$output .= '<a id="configure-widget-'.$cellData['id'].'" class="">';
$output .= html_print_image(

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.763-220628
Version: 7.0NG.763-220629
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.763-220628"
pandora_version="7.0NG.763-220629"
package_cpan=0
package_pandora=1

View File

@ -46,7 +46,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.763";
my $pandora_build = "220628";
my $pandora_build = "220629";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.763";
my $pandora_build = "220628";
my $pandora_build = "220629";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.763
%define release 220628
%define release 220629
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.763
%define release 220628
%define release 220629
Summary: Pandora FMS Server
Name: %{name}

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.763"
PI_BUILD="220628"
PI_BUILD="220629"
MODE=$1
if [ $# -gt 1 ]; then

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.763 Build 220628";
my $version = "7.0NG.763 Build 220629";
# Pandora server configuration
my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "7.0NG.763 Build 220628";
my $version = "7.0NG.763 Build 220629";
# save program name for logging
my $progname = basename($0);