added methods to api (metaconsole and node) to create and update operating systems

This commit is contained in:
alejandro-campos 2018-08-01 14:35:05 +02:00
parent 2dc5bc1139
commit 87296eb472
1 changed files with 62 additions and 0 deletions

View File

@ -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 * Creates a custom field