summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2019-12-17 17:23:24 +0100
committerSimon Rettberg2019-12-17 17:23:24 +0100
commitefa84ed663108f2730e3f3f7853caa43b793af65 (patch)
tree53dca8de58cf02d07d61c88690629e1eabaed5d5
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
-rw-r--r--modules-available/rebootcontrol/lang/de/messages.json1
-rw-r--r--modules-available/rebootcontrol/pages/jumphost.inc.php15
2 files changed, 16 insertions, 0 deletions
diff --git a/modules-available/rebootcontrol/lang/de/messages.json b/modules-available/rebootcontrol/lang/de/messages.json
index 32da10b1..33a3fbde 100644
--- a/modules-available/rebootcontrol/lang/de/messages.json
+++ b/modules-available/rebootcontrol/lang/de/messages.json
@@ -2,6 +2,7 @@
"invalid-cidr": "Ung\u00fcltige CIDR-Angabe: {{0}}",
"invalid-port": "Ung\u00fcltiger Port: {{0}}",
"invalid-subnet": "Ung\u00fcltiges Subnetz: {{0}}",
+ "jumphost-deleted": "Sprung-Host {{0}} gel\u00f6scht",
"jumphost-saved": "Sprung-Host {{0}} gespeichert",
"no-clients-selected": "Keine Clients ausgew\u00e4hlt",
"no-current-tasks": "Keine aktuellen oder k\u00fcrzlich abgeschlossenen Aufgaben",
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');