Fixed connected users seeing all users
This commit is contained in:
parent
7d69ad114d
commit
29913883ae
|
@ -36,27 +36,50 @@ function users_extension_main_god($god=true)
|
||||||
// Header
|
// Header
|
||||||
ui_print_page_header(__('Users connected'), $image, false, '', $god);
|
ui_print_page_header(__('Users connected'), $image, false, '', $god);
|
||||||
|
|
||||||
// Get user conected last 5 minutes
|
// Get groups user has permission
|
||||||
|
$group_um = users_get_groups_UM($config['id_user']);
|
||||||
|
// Is admin or has group permissions all.
|
||||||
|
$groups = implode(',', array_keys($group_um, 1));
|
||||||
|
|
||||||
|
// Get user conected last 5 minutes.Show only those on which the user has permission.
|
||||||
switch ($config['dbtype']) {
|
switch ($config['dbtype']) {
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
$sql = 'SELECT id_user, last_connect
|
$sql = sprintf(
|
||||||
|
'SELECT tusuario.id_user, tusuario.last_connect
|
||||||
FROM tusuario
|
FROM tusuario
|
||||||
|
INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user
|
||||||
|
AND tusuario_perfil.id_grupo IN (%s)
|
||||||
WHERE last_connect > (UNIX_TIMESTAMP(NOW()) - '.SECONDS_5MINUTES.')
|
WHERE last_connect > (UNIX_TIMESTAMP(NOW()) - '.SECONDS_5MINUTES.')
|
||||||
ORDER BY last_connect DESC';
|
GROUP BY tusuario.id_user
|
||||||
|
ORDER BY last_connect DESC',
|
||||||
|
$groups
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'postgresql':
|
case 'postgresql':
|
||||||
$sql = "SELECT id_user, last_connect
|
$sql = sprintf(
|
||||||
|
"SELECT tusuario.id_user, tusuario.last_connect
|
||||||
FROM tusuario
|
FROM tusuario
|
||||||
|
INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user
|
||||||
|
AND tusuario_perfil.id_grupo IN (%s)
|
||||||
WHERE last_connect > (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_5MINUTES.')
|
WHERE last_connect > (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_5MINUTES.')
|
||||||
ORDER BY last_connect DESC';
|
GROUP BY tusuario.id_user
|
||||||
|
ORDER BY last_connect DESC',
|
||||||
|
$groups
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'oracle':
|
case 'oracle':
|
||||||
$sql = "SELECT id_user, last_connect
|
$sql = sprintf(
|
||||||
|
"SELECT tusuario.id_user, tusuario.last_connect
|
||||||
FROM tusuario
|
FROM tusuario
|
||||||
|
INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user
|
||||||
|
AND tusuario_perfil.id_grupo IN (%s)
|
||||||
WHERE last_connect > (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_5MINUTES.')
|
WHERE last_connect > (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_5MINUTES.')
|
||||||
ORDER BY last_connect DESC';
|
GROUP BY tusuario.id_user
|
||||||
|
ORDER BY last_connect DESC',
|
||||||
|
$groups
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue