2012-01-25 Vanessa Gil <vanessa.gil@artica.es>

* include/functions_agents.php: Bad behavior group filter
	in massive operations and policies management.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5427 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
vgilc 2012-01-25 12:40:11 +00:00
parent ea22cf8722
commit 77d73b80fe
2 changed files with 17 additions and 8 deletions

View File

@ -1,3 +1,8 @@
2012-01-25 Vanessa Gil <vanessa.gil@artica.es>
* include/functions_agents.php: Bad behavior group filter
in massive operations and policies management.
2012-01-25 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_api.php: removed warning from get_all_agents

View File

@ -900,15 +900,19 @@ function agents_get_group_agents ($id_group = 0, $search = false, $case = "lower
}
if (is_array($id_group)) {
$search_sql = sprintf ('id_grupo IN (%s)', implode (",", $id_group));
$all_groups = false;
$search_group_sql = sprintf ('id_grupo IN (%s)', implode (",", $id_group));
}
else if ($id_group == 0) { //All group
$search_sql = '1 = 1';
$all_groups = true;
$search_group_sql = '1 = 1';
}
else {
$search_sql = sprintf ('id_grupo = %d', $id_group);
$all_groups = false;
$search_group_sql = sprintf ('id_grupo = %d', $id_group);
}
$search_sql = '1 = 1';
if ($search === true) {
//No added search. Show both disabled and non-disabled
@ -965,7 +969,7 @@ function agents_get_group_agents ($id_group = 0, $search = false, $case = "lower
enterprise_include_once ('include/functions_policies.php');
if ($extra_access){
if ($extra_access && $all_groups){ //if you have all group, search extra policies.
$extra_sql = enterprise_hook('policies_get_agents_sql_condition');
if ($extra_sql === ENTERPRISE_NOT_HOOK) {
$extra_sql = '';
@ -980,10 +984,10 @@ function agents_get_group_agents ($id_group = 0, $search = false, $case = "lower
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
$sql = sprintf ("SELECT id_agente, nombre FROM tagente WHERE %s (%s) ORDER BY nombre", $extra_sql, $search_sql);
$sql = sprintf ("SELECT id_agente, nombre FROM tagente WHERE (%s %s) AND (%s) ORDER BY nombre", $extra_sql, $search_group_sql, $search_sql);
break;
case "oracle":
$sql = sprintf ("SELECT id_agente, nombre FROM tagente WHERE %s (%s) ORDER BY dbms_lob.substr(nombre,4000,1)", $extra_sql, $search_sql);
$sql = sprintf ("SELECT id_agente, nombre FROM tagente WHERE (%s %s) AND (%s) ORDER BY dbms_lob.substr(nombre,4000,1)", $extra_sql, $search_group_sql, $search_sql);
break;
}