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

29 lines
1.2 KiB
PHP
Raw Normal View History

2020-09-15 18:20:32 +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()) {
2020-09-21 20:30:31 +01:00
$status = ['status' =>1, 'message' => 'ERROR: You need to be admin to delete services templates'];
2020-09-15 18:20:32 +01:00
} else {
2020-09-21 19:34:09 +01:00
if (! is_numeric($vars['service_template_id'])) {
$status = ['status' =>1, 'message' => 'No Service Template has been selected'];
2020-09-15 18:20:32 +01:00
} else {
2020-09-24 06:18:19 +01:00
if (delete_service_template($vars['service_template_id'], $vars['service_delete'])) {
2020-09-21 20:30:31 +01:00
$status = ['status' =>0, 'message' => 'Service Template: <i>' . $vars['service_template_id'] . ', has been deleted.</i>'];
2020-09-15 18:20:32 +01:00
} else {
2020-09-21 20:30:31 +01:00
$status = ['status' =>1, 'message' => 'Service Template: <i>' . $vars['service_template_id'] . ', has NOT been deleted.</i>'];
2020-09-15 18:20:32 +01:00
}
}
}
header('Content-Type: application/json');
echo _json_encode($status);