diff --git a/pandora_console/include/lib/Dashboard/Widgets/alerts_fired.php b/pandora_console/include/lib/Dashboard/Widgets/alerts_fired.php
index 2a248d7306..fdb5c3648a 100755
--- a/pandora_console/include/lib/Dashboard/Widgets/alerts_fired.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/alerts_fired.php
@@ -215,13 +215,19 @@ class AlertsFiredWidget extends Widget
// Retrieve global - common inputs.
$inputs = parent::getFormInputs();
+ $return_all_group = false;
+
+ if (users_can_manage_group_all('RM') || $values['groupId'] == 0) {
+ $return_all_group = true;
+ }
+
// Groups.
$inputs[] = [
'label' => __('Group'),
'arguments' => [
'type' => 'select_groups',
'name' => 'groupId',
- 'returnAllGroup' => true,
+ 'returnAllGroup' => $return_all_group,
'privilege' => 'AR',
'selected' => $values['groupId'],
'return' => true,
diff --git a/pandora_console/include/lib/Dashboard/Widgets/maps_made_by_user.php b/pandora_console/include/lib/Dashboard/Widgets/maps_made_by_user.php
index e449df4b82..5c5a12e16f 100644
--- a/pandora_console/include/lib/Dashboard/Widgets/maps_made_by_user.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/maps_made_by_user.php
@@ -229,7 +229,26 @@ class MapsMadeByUser extends Widget
// Retrieve global - common inputs.
$inputs = parent::getFormInputs();
- $fields = \visual_map_get_user_layouts($config['id_user'], true);
+ $return_all_group = false;
+
+ if (users_can_manage_group_all('RM')) {
+ $return_all_group = true;
+ }
+
+ $fields = \visual_map_get_user_layouts(
+ $config['id_user'],
+ true,
+ ['can_manage_group_all' => $return_all_group],
+ $return_all_group
+ );
+
+ // If currently selected graph is not included in fields array (it belongs to a group over which user has no permissions), then add it to fields array.
+ // This is aimed to avoid overriding this value when a user with narrower permissions edits widget configuration.
+ if ($values['vcId'] !== null && !array_key_exists($values['vcId'], $fields)) {
+ $selected_vc = db_get_value('name', 'tlayout', 'id', $values['vcId']);
+
+ $fields[$values['vcId']] = $selected_vc;
+ }
// Visual console.
$inputs[] = [
@@ -308,20 +327,6 @@ class MapsMadeByUser extends Widget
$groupId = $visualConsoleData['groupId'];
$visualConsoleName = $visualConsoleData['name'];
- // ACL.
- $aclRead = check_acl($config['id_user'], $groupId, 'VR');
- $aclWrite = check_acl($config['id_user'], $groupId, 'VW');
- $aclManage = check_acl($config['id_user'], $groupId, 'VM');
-
- if ($aclRead === 0 && $aclWrite === 0 && $aclManage === 0) {
- db_pandora_audit(
- 'ACL Violation',
- 'Trying to access visual console without group access'
- );
- include 'general/noaccess.php';
- exit;
- }
-
$uniq = uniqid();
$output = '
';
diff --git a/pandora_console/include/lib/Dashboard/Widgets/service_map.php b/pandora_console/include/lib/Dashboard/Widgets/service_map.php
index 718dc697dd..a2122c6dca 100644
--- a/pandora_console/include/lib/Dashboard/Widgets/service_map.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/service_map.php
@@ -254,6 +254,15 @@ class ServiceMapWidget extends Widget
$inputs = parent::getFormInputs();
$services_res = services_get_services();
+
+ // If currently selected report is not included in fields array (it belongs to a group over which user has no permissions), then add it to fields array.
+ // This is aimed to avoid overriding this value when a user with narrower permissions edits widget configuration.
+ if ($values['serviceId'] !== null && !in_array($values['serviceId'], array_column($services_res, 'id'))) {
+ $selected_service = db_get_row('tservice', 'id', $values['serviceId']);
+
+ $services_res[] = $selected_service;
+ }
+
$services = [0 => __('None')];
if ($services_res !== false) {
$fields = array_reduce(
diff --git a/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_group.php b/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_group.php
index 46570db44d..247331c4fe 100644
--- a/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_group.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_group.php
@@ -277,10 +277,21 @@ class TopNEventByGroupWidget extends Widget
],
];
+ $return_all_group = false;
+
// Groups.
$selected_groups = [];
if ($values['groupId']) {
$selected_groups = explode(',', $values['groupId'][0]);
+
+ if (users_can_manage_group_all('RM') || in_array(0, $selected_groups) === true) {
+ // Return all group if user has permissions or it is a currently selected group.
+ $return_all_group = true;
+ }
+ } else {
+ if (users_can_manage_group_all('RM')) {
+ $return_all_group = true;
+ }
}
$inputs[] = [
@@ -293,6 +304,7 @@ class TopNEventByGroupWidget extends Widget
'selected' => $selected_groups,
'return' => true,
'multiple' => true,
+ 'returnAllGroup' => $return_all_group,
],
];
diff --git a/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_module.php b/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_module.php
index a5ccda50c3..685df73659 100644
--- a/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_module.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_module.php
@@ -277,9 +277,20 @@ class TopNEventByModuleWidget extends Widget
],
];
+ $return_all_group = false;
+
$selected_groups = [];
if ($values['groupId']) {
$selected_groups = explode(',', $values['groupId'][0]);
+
+ if (users_can_manage_group_all('RM') || in_array(0, $selected_groups) === true) {
+ // Return all group if user has permissions or it is a currently selected group.
+ $return_all_group = true;
+ }
+ } else {
+ if (users_can_manage_group_all('RM')) {
+ $return_all_group = true;
+ }
}
// Groups.
@@ -293,6 +304,7 @@ class TopNEventByModuleWidget extends Widget
'selected' => $selected_groups,
'return' => true,
'multiple' => true,
+ 'returnAllGroup' => $return_all_group,
],
];
diff --git a/pandora_console/include/lib/Dashboard/Widgets/tree_view.php b/pandora_console/include/lib/Dashboard/Widgets/tree_view.php
index 5730586f1f..aa4e5f90fd 100644
--- a/pandora_console/include/lib/Dashboard/Widgets/tree_view.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/tree_view.php
@@ -344,6 +344,12 @@ class TreeViewWidget extends Widget
],
];
+ $return_all_group = false;
+
+ if (users_can_manage_group_all('RM')) {
+ $return_all_group = true;
+ }
+
// Groups.
$inputs[] = [
'label' => __('Groups'),
@@ -354,6 +360,7 @@ class TreeViewWidget extends Widget
'privilege' => 'AR',
'selected' => $values['groupId'],
'return' => true,
+ 'returnAllGroup' => $return_all_group,
],
];