Fixed problem with strict acl and group view.

This commit is contained in:
Arturo Gonzalez 2016-03-07 13:55:26 +01:00
parent ed7c72a1ba
commit 26a9b4d227
1 changed files with 16 additions and 11 deletions

View File

@ -47,7 +47,7 @@ function groupview_get_all_data ($id_user = false, $user_strict = false, $acltag
} }
if (!empty($user_groups_ids)) { if (!empty($user_groups_ids)) {
if (is_metaconsole()) { if (is_metaconsole() && (!$user_strict)) {
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
$list_groups = db_get_all_rows_sql(" $list_groups = db_get_all_rows_sql("
@ -247,7 +247,7 @@ function groupview_get_all_data ($id_user = false, $user_strict = false, $acltag
$list["_server_sanity_"] = format_numeric (100 - $list["_module_sanity_"], 1); $list["_server_sanity_"] = format_numeric (100 - $list["_module_sanity_"], 1);
} }
else if (!$user_strict) { else {
foreach ($list_groups as $group) { foreach ($list_groups as $group) {
$agent_not_init = agents_get_agents(array ( $agent_not_init = agents_get_agents(array (
'disabled' => 0, 'disabled' => 0,
@ -360,7 +360,7 @@ function groupview_get_all_data ($id_user = false, $user_strict = false, $acltag
return $list; return $list;
} }
function groupview_status_modules_agents($id_user = false, $user_strict = false, $access = 'AR', $force_group_and_tag = true) { function groupview_status_modules_agents($id_user = false, $user_strict = false, $access = 'AR', $force_group_and_tag = true, $returnAllGroup = false) {
global $config; global $config;
if ($id_user == false) { if ($id_user == false) {
@ -376,8 +376,12 @@ function groupview_status_modules_agents($id_user = false, $user_strict = false,
$result_list = array (); $result_list = array ();
foreach ($servers as $server) { foreach ($servers as $server) {
if (metaconsole_connect($server) != NOERR) {
continue;
}
$server_list = groupview_get_all_data($id_user, $user_strict, $server_list = groupview_get_all_data($id_user, $user_strict,
$acltags); $acltags, $returnAllGroup);
foreach ($server_list as $server_item) { foreach ($server_list as $server_item) {
if (! isset ($result_list[$server_item['_name_']])) { if (! isset ($result_list[$server_item['_name_']])) {
@ -411,6 +415,7 @@ function groupview_status_modules_agents($id_user = false, $user_strict = false,
$result_list[$server_item['_name_']]["_total_alerts_"] += $server_item["_total_alerts_"]; $result_list[$server_item['_name_']]["_total_alerts_"] += $server_item["_total_alerts_"];
} }
} }
metaconsole_restore_db();
} }
return $result_list; return $result_list;
@ -588,7 +593,7 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
} }
if (!empty($user_groups_ids)) { if (!empty($user_groups_ids)) {
if (is_metaconsole()) { if (is_metaconsole() && (!$user_strict)) {
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
$list_groups = db_get_all_rows_sql(" $list_groups = db_get_all_rows_sql("
@ -855,7 +860,7 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
$list["_server_sanity_"] = format_numeric (100 - $list["_module_sanity_"], 1); $list["_server_sanity_"] = format_numeric (100 - $list["_module_sanity_"], 1);
} }
else if (!$user_strict) { else {
foreach ($list_groups as $group) { foreach ($list_groups as $group) {
$agent_not_init = agents_get_agents(array ( $agent_not_init = agents_get_agents(array (
'disabled' => 0, 'disabled' => 0,