Merge branch '3787-agents_get_agents' into 'develop'

rollback agent_get_agents

See merge request artica/pandorafms!2309

Former-commit-id: 7badea15471fa3d7aae787f913c76c8da70472cc
This commit is contained in:
Alejandro Fraguas 2019-04-03 12:04:52 +02:00
commit dcd5ab6317
1 changed files with 8 additions and 3 deletions

View File

@ -434,15 +434,15 @@ function agents_get_agents(
$filter_nogroup = $filter;
// Get user groups
$groups = array_keys(users_get_groups($config['id_user'], $access, true));
$groups = array_keys(users_get_groups($config['id_user'], $access, false));
// If no group specified, get all user groups
if (isset($filter['id_grupo']) === false) {
if (empty($filter['id_grupo'])) {
$all_groups = true;
$filter['id_grupo'] = $groups;
} else if (! is_array($filter['id_grupo'])) {
$all_groups = false;
// If group is specified but not allowed, return false.
// If group is specified but not allowed, return false
if (! in_array($filter['id_grupo'], $groups)) {
return false;
}
@ -466,6 +466,11 @@ function agents_get_agents(
$filter['id_group'] = $filter['id_grupo'];
if (in_array(0, $filter['id_grupo'])) {
unset($filter['id_grupo']);
unset($filter['id_group']);
}
if (!is_array($fields)) {
$fields = [];
$fields[0] = 'id_agente';