diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 02003ef075..f4b9447c72 100644 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -51,6 +51,8 @@ $idItem = get_parameter('id_item', 0); $pure = get_parameter('pure',0); $schedule_report = get_parameter('schbutton', ''); +$strict_user = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']); + if ($schedule_report != '') { $id_user_task = 1; @@ -375,7 +377,7 @@ switch ($action) { $table_aux->colspan[0][0] = 4; $table_aux->data[0][0] = "". __("Group") . ""; - $table_aux->data[0][1] = html_print_select_groups(false, "AR", true, 'id_group', $id_group, '', '', '', true, false, true, '', false, 'width:150px'); + $table_aux->data[0][1] = html_print_select_groups(false, "AR", true, 'id_group', $id_group, '', '', '', true, false, true, '', false, 'width:150px', false, false, 'id_grupo', $strict_user); $table_aux->data[0][2] = "". __("Free text for search: ") . ""; $table_aux->data[0][3] = html_print_input_text ("search", $search, '', 30, '', true); diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 0140cccd2c..56b90d73f9 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -381,26 +381,7 @@ function html_print_select_groups($id_user = false, $privilege = "AR", $returnAllGroup, true, $id_group, $keys_field); if ($strict_user) { - foreach ($fields as $id => $group_name) { - $sql = "SELECT tags FROM tusuario_perfil WHERE id_usuario = '$id_user' AND id_grupo = $id"; - $group_has_tag = db_get_value_sql ($sql); - if (!$group_has_tag) { - - $sql_parent = "SELECT parent FROM tgrupo WHERE id_grupo = $id AND propagate = 1"; - $id_parent = db_get_value_sql($sql_parent); - - if ($id_parent) { - $sql_parent_aux = "SELECT tags FROM tusuario_perfil WHERE id_usuario = '$id_user' AND id_grupo = $id_parent"; - $parent_has_tag = db_get_value_sql ($sql_parent_aux); - - if ($parent_has_tag) { - unset($fields[$id]); - } - } - } else { - unset($fields[$id]); - } - } + $fields = users_get_strict_mode_groups($config['id_user'], $returnAllGroup); } $output = html_print_select ($fields, $name, $selected, $script, diff --git a/pandora_console/include/functions_users.php b/pandora_console/include/functions_users.php index 2743e08806..aa90631a56 100644 --- a/pandora_console/include/functions_users.php +++ b/pandora_console/include/functions_users.php @@ -875,4 +875,26 @@ function users_get_user_users($id_user = false, $privilege = "AR", return $user_users; } + +function users_get_strict_mode_groups($id_user, $return_group_all) { + + global $config; + + $sql = "SELECT * FROM tusuario_perfil WHERE id_usuario = '".$id_user."' AND tags = ''"; + $user_groups = db_get_all_rows_sql ($sql); + + if ($user_groups == false) { + $user_groups = array(); + } + + $return_user_groups = array(); + if ($return_group_all) { + $return_user_groups[0] = __('All'); + } + foreach ($user_groups as $group) { + $return_user_groups[$group['id_grupo']] = groups_get_name ($group['id_grupo']); + } + + return $return_user_groups; +} ?> diff --git a/pandora_console/operation/events/events_list.php b/pandora_console/operation/events/events_list.php index c24654bbe3..89b994d243 100644 --- a/pandora_console/operation/events/events_list.php +++ b/pandora_console/operation/events/events_list.php @@ -122,6 +122,8 @@ if (is_ajax()) { return; } +$strict_user = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']); + // Get the tags where the user have permissions in Events reading tasks $tags = tags_get_user_tags($config['id_user'], 'ER'); @@ -409,7 +411,6 @@ $table_advanced->rowclass[] = ''; $data = array(); $data[0] = __('User ack.') . $jump; -$strict_user = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']); if ($strict_user) { $user_users = array($config['id_user']=>$config['id_user']); } else { @@ -511,8 +512,10 @@ $table->data = array(); $data = array(); $data[0] = __('Group') . '
'; -$data[0] .= html_print_select_groups($config["id_user"], "ER", true, - 'id_group', $id_group, '', '', 0, true, false, false, 'w130') . '
'; + +$data[0] .= html_print_select_groups($config["id_user"], "ER", true, + 'id_group', $id_group, '', '', 0, true, false, false, 'w130', false, false, false, false, 'id_grupo', $strict_user). '
'; + //********************************************************************** // TODO // This code is disabled for to enabled in Pandora 5.1