From ce49a45d2a3fe8f9337f375ab0507f7041045b94 Mon Sep 17 00:00:00 2001 From: "marcos.alconada" Date: Tue, 26 Mar 2019 11:03:36 +0100 Subject: [PATCH] Commit para revisar progreso Former-commit-id: e1e07ad590624f958e0e8cc31b18d6f936df485e --- pandora_console/include/functions_api.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index a792da92c5..9d9216e0b3 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -14732,15 +14732,26 @@ function api_get_filter_user_group($user, $group, $disable) } if ($group !== null) { - $sql = "select * from tperfil,tusuario_perfil where tperfil.id_perfil in (select tusuario_perfil.id_perfil from tusuario_perfil where id_usuario = '$user' and id_grupo = $group) LIMIT 1"; - $filter_user = db_get_all_rows_sql($sql); + $condition = $grupo; + $campo = 'group'; } if ($disable !== null) { - $sql = "select * from tperfil,tusuario_perfil where tperfil.id_perfil in (select tusuario_perfil.id_perfil from tusuario_perfil where id_usuario = '$user' and disable = $disable) LIMIT 1"; - $filter_user = db_get_all_rows_sql($sql); + $condition = $disable; + $campo = 'disable'; } + // CASO CON USUARIO DE META CONSOLE + /* + if ($user_meta !== null) { + $campo = 'metaconsole_assigned_server'; + $condition = 1; + } + */ + + $sql = sprintf(('select * from tperfil,tusuario_perfil where tperfil.id_perfil in (select tusuario_perfil.id_perfil from tusuario_perfil where id_usuario = '$user' and %s = % d)'), $campo, $condition); + $filter_user = db_get_all_rows_sql($sql); + if ($filter_user === false) { returnError('Error_user', ' User profile could not be found.'); } else {