summaryrefslogtreecommitdiffstats
path: root/modules-available/rebootcontrol/pages
diff options
context:
space:
mode:
authorSimon Rettberg2019-12-17 17:23:24 +0100
committerSimon Rettberg2019-12-17 17:23:24 +0100
commitefa84ed663108f2730e3f3f7853caa43b793af65 (patch)
tree53dca8de58cf02d07d61c88690629e1eabaed5d5 /modules-available/rebootcontrol/pages
parent[statistics] Update translations (diff)
downloadslx-admin-efa84ed663108f2730e3f3f7853caa43b793af65.tar.gz
slx-admin-efa84ed663108f2730e3f3f7853caa43b793af65.tar.xz
slx-admin-efa84ed663108f2730e3f3f7853caa43b793af65.zip
[rebootcontrol] Implement deletion of jump host
Diffstat (limited to 'modules-available/rebootcontrol/pages')
-rw-r--r--modules-available/rebootcontrol/pages/jumphost.inc.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/modules-available/rebootcontrol/pages/jumphost.inc.php b/modules-available/rebootcontrol/pages/jumphost.inc.php
index 7d1877d2..bf0a67e2 100644
--- a/modules-available/rebootcontrol/pages/jumphost.inc.php
+++ b/modules-available/rebootcontrol/pages/jumphost.inc.php
@@ -28,10 +28,17 @@ class SubPage
self::execCheckConnection($id);
return;
}
+ $id = Request::post('deleteid', false, 'int');
+ if ($id !== false) {
+ User::assertPermission('jumphost.edit');
+ self::deleteJumphost($id);
+ return;
+ }
}
private static function execCheckConnection($hostid)
{
+ // Permcheck in caller
$host = self::getJumpHost($hostid);
$task = RebootControl::wakeViaJumpHost($host, '255.255.255.255', [['macaddr' => '00:11:22:33:44:55']]);
if (!Taskmanager::isTask($task))
@@ -39,6 +46,14 @@ class SubPage
Util::redirect('?do=rebootcontrol&show=task&type=checkhost&what=task&taskid=' . $task['id']);
}
+ private static function deleteJumphost($hostid)
+ {
+ // Permcheck in caller
+ $host = self::getJumpHost($hostid);
+ Database::exec('DELETE FROM reboot_jumphost WHERE hostid = :hostid LIMIT 1', ['hostid' => $hostid]);
+ Message::addSuccess('jumphost-deleted', $host['host']);
+ }
+
private static function saveJumpHost()
{
User::assertPermission('jumphost.edit');