Merge branch '2881-Añadir-campo-de-estado-de-agente-en-la-llamada-API-get_all_agents-2' into 'develop'
api function api_get_all_agents for meta - #2881 See merge request artica/pandorafms!1840
This commit is contained in:
commit
bc90e77a3d
|
@ -1620,10 +1620,6 @@ function api_set_delete_agent($id, $thrash1, $thrast2, $thrash3) {
|
||||||
function api_get_all_agents($thrash1, $thrash2, $other, $returnType) {
|
function api_get_all_agents($thrash1, $thrash2, $other, $returnType) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if (defined ('METACONSOLE')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Error if user cannot read agents.
|
// Error if user cannot read agents.
|
||||||
if (!check_acl($config['id_user'], 0, "AR")) {
|
if (!check_acl($config['id_user'], 0, "AR")) {
|
||||||
returnError('forbidden', $returnType);
|
returnError('forbidden', $returnType);
|
||||||
|
@ -1672,6 +1668,17 @@ function api_get_all_agents($thrash1, $thrash2, $other, $returnType) {
|
||||||
// Initialization of array
|
// Initialization of array
|
||||||
$result_agents = array();
|
$result_agents = array();
|
||||||
// Filter by state
|
// Filter by state
|
||||||
|
|
||||||
|
if (defined ('METACONSOLE')) {
|
||||||
|
$sql = "SELECT id_agente, alias, direccion, comentarios,
|
||||||
|
tconfig_os.name, url_address, nombre
|
||||||
|
FROM tconfig_os, tmetaconsole_agent
|
||||||
|
LEFT JOIN tagent_secondary_group
|
||||||
|
ON tmetaconsole_agent.id_agente = tagent_secondary_group.id_agent
|
||||||
|
WHERE tmetaconsole_agent.id_os = tconfig_os.id_os
|
||||||
|
AND disabled = 0 $where AND $groups";
|
||||||
|
}
|
||||||
|
else{
|
||||||
$sql = "SELECT id_agente, alias, direccion, comentarios,
|
$sql = "SELECT id_agente, alias, direccion, comentarios,
|
||||||
tconfig_os.name, url_address, nombre
|
tconfig_os.name, url_address, nombre
|
||||||
FROM tconfig_os, tagente
|
FROM tconfig_os, tagente
|
||||||
|
@ -1679,6 +1686,7 @@ function api_get_all_agents($thrash1, $thrash2, $other, $returnType) {
|
||||||
ON tagente.id_agente = tagent_secondary_group.id_agent
|
ON tagente.id_agente = tagent_secondary_group.id_agent
|
||||||
WHERE tagente.id_os = tconfig_os.id_os
|
WHERE tagente.id_os = tconfig_os.id_os
|
||||||
AND disabled = 0 $where AND $groups";
|
AND disabled = 0 $where AND $groups";
|
||||||
|
}
|
||||||
|
|
||||||
$all_agents = db_get_all_rows_sql($sql);
|
$all_agents = db_get_all_rows_sql($sql);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue