diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index c1671a6f98..8df7ebf62d 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,7 @@ +2011-09-16 Miguel de Dios + + * include/functions_api.php: added the "getgroups" call. + 2011-09-16 Juan Manuel Ramon * include/functions_agents.php: Avoid bad syntax sql query diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 2f4890a1e5..6e424b9804 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -153,6 +153,32 @@ function isInACL($ip) { } //-------------------------DEFINED OPERATIONS FUNCTIONS------------------------- +function get_groups($thrash1, $thrash2, $other, $returnType, $user_in_db) { + if ($other['type'] == 'string') { + if ($other['data'] != '') { + returnError('error_parameter', 'Error in the parameters.'); + return; + } + else {//Default values + $separator = ';'; + } + } + else if ($other['type'] == 'array') { + $separator = $other['data'][0]; + } + + $groups = users_get_groups ($user_in_db, "IR"); + + $data_groups = array(); + foreach ($groups as $id => $group) { + $data_groups[] = array($id, $group); + } + + $data['type'] = 'array'; + $data['data'] = $data_groups; + + returnData($returnType, $data, $separator); +} function get_agent_module_name_last_value($agentName, $moduleName, $other = ';', $returnType) {