diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 40e37c4bac..26d7bc9974 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2013-07-17 Sergio Martin + + * include/functions_users.php + include/functions_groups.php + operation/events/events_list.php: Fixed the visibility + of the users in the events view filter. Now the user + can only filter by the users of the groups where the + user belongs + 2013-07-17 Sergio Martin * operation/menu.php diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php index 86a1bd9980..a4fd9cca27 100644 --- a/pandora_console/include/functions_groups.php +++ b/pandora_console/include/functions_groups.php @@ -592,10 +592,12 @@ function groups_get_id ($group_name, $returnAllGroup = false) { * Get all the users belonging to a group. * * @param int $id_group The group id to look for + * @param mixed filter array + * @param bool True if users with all permissions in the group are retrieved * * @return array An array with all the users or an empty array */ -function groups_get_users ($id_group, $filter = false) { +function groups_get_users ($id_group, $filter = false, $return_user_all = false) { global $config; if (! is_array ($filter)) diff --git a/pandora_console/include/functions_users.php b/pandora_console/include/functions_users.php index d901b653c7..f64329482d 100644 --- a/pandora_console/include/functions_users.php +++ b/pandora_console/include/functions_users.php @@ -808,4 +808,26 @@ function users_can_manage_group_all($id_group = 0) { return false; } + +/** + * Get the users that belongs to the same groups of the current user + * + * @return mixed Array with id_user as index and value + */ +function users_get_user_users() { + global $config; + + $user_groups = users_get_groups(); + + $user_users = array(); + foreach($user_groups as $id_user_group => $name_user_group) { + $group_users = groups_get_users($id_user_group, false, true); + + foreach($group_users as $gu) { + $user_users[$gu['id_user']] = $gu['id_user']; + } + } + + return $user_users; +} ?> diff --git a/pandora_console/operation/events/events_list.php b/pandora_console/operation/events/events_list.php index 9913b49798..a97afb1b9c 100644 --- a/pandora_console/operation/events/events_list.php +++ b/pandora_console/operation/events/events_list.php @@ -387,8 +387,10 @@ $table_advanced->rowclass[] = ''; $data = array(); $data[0] = __('User ack.') . '
'; -$users = users_get_info (); -$data[0] .= html_print_select($users, "id_user_ack", $id_user_ack, '', + +$user_users = users_get_user_users(); + +$data[0] .= html_print_select($user_users, "id_user_ack", $id_user_ack, '', __('Any'), 0, true); $data[1] = ''; $table_advanced->data[] = $data;