2013-07-30 Sergio Martin <sergio.martin@artica.es>

* include/functions_users.php
	operation/events/events_list.php: Improve the encapsulation
	of the last Juanmas fix using my previous solution



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8595 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2013-07-30 09:56:20 +00:00
parent fe038789ad
commit a2c9f0319d
3 changed files with 15 additions and 30 deletions

View File

@ -1,3 +1,9 @@
2013-07-30 Sergio Martin <sergio.martin@artica.es>
* include/functions_users.php
operation/events/events_list.php: Improve the encapsulation
of the last Juanmas fix using my previous solution
2013-07-30 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* operation/events/events_list.php: Fix user filter in

View File

@ -812,16 +812,20 @@ function users_can_manage_group_all($id_group = 0) {
/**
* Get the users that belongs to the same groups of the current user
*
* @param string User id
* @param string The privilege to evaluate, and it is false then no check ACL.
* @param boolean $returnAllGroup Flag the return group, by default true.
*
* @return mixed Array with id_user as index and value
*/
function users_get_user_users() {
function users_get_user_users($id_user = false, $privilege = "AR", $returnAllGroup = true) {
global $config;
$user_groups = users_get_groups();
$user_groups = users_get_groups($id_user, $privilege, $returnAllGroup);
$user_users = array();
foreach($user_groups as $id_user_group => $name_user_group) {
$group_users = groups_get_users($id_user_group, false, true);
$group_users = groups_get_users($id_user_group, false, $returnAllGroup);
foreach($group_users as $gu) {
$user_users[$gu['id_user']] = $gu['id_user'];

View File

@ -387,35 +387,10 @@ $table_advanced->rowclass[] = '';
$data = array();
$data[0] = __('User ack.') . '<br>';
$users = users_get_info ();
if ($users === false)
$users = array();
$user_groups = users_get_groups($config['id_user'], "ER", users_can_manage_group_all(0));
$acl_column = get_acl_column("ER");
$users_acl = array();
foreach ($users as $user => $user_desc) {
$query = sprintf("SELECT id_grupo
FROM tusuario_perfil, tperfil
WHERE tperfil.id_perfil = tusuario_perfil.id_perfil AND
tusuario_perfil.id_usuario = '%s' AND
tperfil.%s = 1 AND
(tusuario_perfil.id_grupo IN (%s))
ORDER BY id_grupo", $user, $acl_column, implode(',',array_keys($user_groups)));
$user_group = db_get_all_rows_sql($query);
if ($user_group === false) {
continue;
}
$users_acl[$user] = $user;
$user_users = users_get_user_users($config['id_user'], "ER", users_can_manage_group_all(0));
}
$data[0] .= html_print_select($users_acl, "id_user_ack", $id_user_ack, '',
$data[0] .= html_print_select($user_users, "id_user_ack", $id_user_ack, '',
__('Any'), 0, true);
$data[1] = '';
$table_advanced->data[] = $data;