mirror of
				https://github.com/pandorafms/pandorafms.git
				synced 2025-10-31 11:34:51 +01:00 
			
		
		
		
	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:
		
							parent
							
								
									ea22cf8722
								
							
						
					
					
						commit
						77d73b80fe
					
				| @ -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> | 2012-01-25 Juan Manuel Ramon <juanmanuel.ramon@artica.es> | ||||||
| 
 | 
 | ||||||
| 	* include/functions_api.php: removed warning from get_all_agents | 	* include/functions_api.php: removed warning from get_all_agents | ||||||
|  | |||||||
| @ -900,16 +900,20 @@ function agents_get_group_agents ($id_group = 0, $search = false, $case = "lower | |||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (is_array($id_group)) { | 	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
 | 	else if ($id_group == 0) { //All group
 | ||||||
| 		$search_sql = '1 = 1'; | 		$all_groups = true; | ||||||
|  | 		$search_group_sql = '1 = 1'; | ||||||
| 	} | 	} | ||||||
| 	else { | 	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) { | 	if ($search === true) { | ||||||
| 		//No added search. Show both disabled and non-disabled
 | 		//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'); | 	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'); | 		$extra_sql = enterprise_hook('policies_get_agents_sql_condition'); | ||||||
| 		if ($extra_sql === ENTERPRISE_NOT_HOOK) { | 		if ($extra_sql === ENTERPRISE_NOT_HOOK) { | ||||||
| 			$extra_sql = ''; | 			$extra_sql = ''; | ||||||
| @ -980,13 +984,13 @@ function agents_get_group_agents ($id_group = 0, $search = false, $case = "lower | |||||||
| 	switch ($config["dbtype"]) { | 	switch ($config["dbtype"]) { | ||||||
| 		case "mysql": | 		case "mysql": | ||||||
| 		case "postgresql": | 		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; | 			break; | ||||||
| 		case "oracle": | 		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; | 			break; | ||||||
| 	} | 	} | ||||||
| 
 | 	 | ||||||
| 	$result = db_get_all_rows_sql ($sql); | 	$result = db_get_all_rows_sql ($sql); | ||||||
| 	 | 	 | ||||||
| 	if ($result === false) | 	if ($result === false) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user