From 87296eb472d8cd1a61f5076d1f20067f8346f125 Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Wed, 1 Aug 2018 14:35:05 +0200 Subject: [PATCH] added methods to api (metaconsole and node) to create and update operating systems --- pandora_console/include/functions_api.php | 62 +++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 76968e1e75..66f2a2e64c 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -1390,6 +1390,68 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3) { } } + +function api_set_create_os($thrash1, $thrash2, $other, $thrash3) { + global $config; + + + if (!check_acl($config['id_user'], 0, "AW")) { + returnError('forbidden', 'string'); + return; + } + + if (defined ('METACONSOLE')) { + return; + } + + $values = array(); + + $values['name'] = $other['data'][0]; + $values['description'] = $other['data'][1]; + + if (($other['data'][2] !== 0) && ($other['data'][2] != '')) { + $values['icon_name'] = $other['data'][2]; + } + + + + $resultOrId = false; + if ($other['data'][0] != '') { + $resultOrId = db_process_sql_insert('tconfig_os', $values); + } + +} + +function api_set_update_os($id_os, $thrash2, $other, $thrash3) { + global $config; + + if (defined ('METACONSOLE')) { + return; + } + + if (!check_acl($config['id_user'], 0, "AW")) { + returnError('forbidden', 'string'); + return; + } + + $values = array(); + $values['name'] = $other['data'][0]; + $values['description'] = $other['data'][1]; + + if (($other['data'][2] !== 0) && ($other['data'][2] != '')) { + $values['icon_name'] = $other['data'][2];; + } + $result = false; + + + if ($other['data'][0] != '') { + + $result = db_process_sql_update('tconfig_os', $values, array('id_os' => $id_os)); + } + +} + + /** * * Creates a custom field