Files
librenms-librenms/includes/html/forms/parse-service-template.inc.php
T

38 lines
1.3 KiB
PHP
Raw Normal View History

2020-09-18 16:46:35 +01:00
<?php
/*
* LibreNMS
*
* Copyright (c) 2016 Aaron Daniels <[email protected]>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
2020-09-21 19:34:09 +01:00
if (! Auth::user()->hasGlobalAdmin()) {
exit('ERROR: You need to be admin');
2020-09-18 16:46:35 +01:00
}
2020-09-21 19:34:09 +01:00
$service_template_id = $vars['service_template_id'];
2020-09-18 16:46:35 +01:00
if (is_numeric($service_template_id) && $service_template_id > 0) {
2020-09-22 00:04:58 +01:00
$service_template = service_template_get($service_template_id);
2020-09-18 16:46:35 +01:00
2020-09-21 19:34:09 +01:00
$output = [
2020-09-24 21:51:11 +01:00
'device_group_id' => $service_template[0]['device_group_id'],
2020-09-24 21:58:19 +01:00
'stype' => $service_template[0]['service_template_type'],
'desc' => $service_template[0]['service_template_desc'],
'ip' => $service_template[0]['service_template_ip'],
'param' => $service_template[0]['service_template_param'],
'ignore' => $service_template[0]['service_template_ignore'],
'disabled' => $service_template[0]['service_template_disabled'],
2020-09-25 01:49:16 +01:00
'name' => $service_template[0]['service_template_name'],
2020-09-21 19:34:09 +01:00
];
2020-09-18 16:46:35 +01:00
header('Content-Type: application/json');
echo _json_encode($output);
}