diff --git a/pandora_console/operation/search_main.php b/pandora_console/operation/search_main.php
index 2da3377ff4..b236539695 100644
--- a/pandora_console/operation/search_main.php
+++ b/pandora_console/operation/search_main.php
@@ -69,7 +69,7 @@ $table->data[0][10] = html_print_image('images/reporting.png', true, ['title' =>
$table->data[0][11] = "".sprintf(__('%s Found'), $totalReports).'';
$table->data[0][12] = html_print_image('images/visual_console_green.png', true, ['title' => __('Maps found')]);
$table->data[0][13] = "".sprintf(__('%s Found'), $totalMaps).'';
-if (enterprise_installed()) {
+if (enterprise_installed() || is_metaconsole()) {
$table->data[0][14] = html_print_image('images/policies.png', true, ['title' => __('Policies')]);
$table->data[0][15] = "".sprintf(__('%s Found'), $totalPolicies).'';
}
diff --git a/pandora_console/operation/search_policies.getdata.php b/pandora_console/operation/search_policies.getdata.php
index 0a28651e7a..0288c24d1b 100644
--- a/pandora_console/operation/search_policies.getdata.php
+++ b/pandora_console/operation/search_policies.getdata.php
@@ -177,19 +177,33 @@ if ($searchpolicies == 0) {
}
- $sql .= ' LIMIT '.$config['block_size'].' OFFSET '.get_parameter('offset', 0);
+ $sql .= ' LIMIT '.$config['block_size'].' OFFSET '.get_parameter('offset', 0);
$policies = db_process_sql($sql);
+ $sql = "SELECT id_grupo FROM tusuario_perfil
+ WHERE id_usuario LIKE '%".$config['id_user']."%'";
+
+ $groups_for_search = db_process_sql($sql);
+
+
+foreach ($policies as $p) {
+ foreach ($groups_for_search as $group) {
+ if ($p['id_group'] == $group['id_grupo'] || $group['id_grupo'] == 0) {
+ $policies_final = $p;
+ }
+ }
+}
+
+$policies = $policies_final;
if ($policies !== false) {
if ($only_count) {
unset($policies);
}
$sql = "SELECT COUNT(id) AS count FROM tpolicies
- WHERE name LIKE '%".$stringSearchSQL."%' OR
- description LIKE '%".$stringSearchSQL."%'";
+ WHERE id = '".$policies_final['id']."'";
$totalPolicies = db_get_value_sql($sql);