summaryrefslogtreecommitdiffstats
path: root/modules-available/serversetup-bwlp/page.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2018-09-24 12:34:56 +0200
committerSimon Rettberg2018-09-24 12:34:56 +0200
commit213625124dcbf333fd1232a9892ad02ccd7ddd19 (patch)
treee354e4925be89c920c3b995079b1bb64c6caa455 /modules-available/serversetup-bwlp/page.inc.php
parent[serversetup-bwlp] Implement chain-to-self for missing params (diff)
downloadslx-admin-213625124dcbf333fd1232a9892ad02ccd7ddd19.tar.gz
slx-admin-213625124dcbf333fd1232a9892ad02ccd7ddd19.tar.xz
slx-admin-213625124dcbf333fd1232a9892ad02ccd7ddd19.zip
[serversetup-bwlp] Fix access to editing IP address
Diffstat (limited to 'modules-available/serversetup-bwlp/page.inc.php')
-rw-r--r--modules-available/serversetup-bwlp/page.inc.php47
1 files changed, 19 insertions, 28 deletions
diff --git a/modules-available/serversetup-bwlp/page.inc.php b/modules-available/serversetup-bwlp/page.inc.php
index ba2e5433..6b1d20b6 100644
--- a/modules-available/serversetup-bwlp/page.inc.php
+++ b/modules-available/serversetup-bwlp/page.inc.php
@@ -37,6 +37,12 @@ class Page_ServerSetup extends Page
$this->getLocalAddresses();
}
+ if ($action === 'compile') {
+ User::assertPermission("edit.address");
+ Trigger::ipxe();
+ Util::redirect('?do=serversetup');
+ }
+
if ($action === 'ip') {
User::assertPermission("edit.address");
// New address is to be set
@@ -44,12 +50,6 @@ class Page_ServerSetup extends Page
$this->updateLocalAddress();
}
- if ($action === 'ipxe') {
- User::assertPermission("edit.menu");
- // iPXE stuff changes
- $this->updatePxeMenu();
- }
-
if ($action === 'savebootentry') {
User::assertPermission('ipxe.bootentry.edit');
$this->saveBootEntry();
@@ -132,6 +132,10 @@ class Page_ServerSetup extends Page
User::assertPermission('ipxe.bootentry.view');
$this->showBootentryList();
break;
+ case 'address':
+ User::assertPermission('edit.address');
+ $this->showEditAddress();
+ break;
default:
Util::redirect('?do=serversetup');
break;
@@ -284,6 +288,14 @@ class Page_ServerSetup extends Page
Render::addTemplate('ipxe-new-boot-entry', $params);
}
+ private function showEditAddress()
+ {
+ Render::addTemplate('ipaddress', array(
+ 'ips' => $this->taskStatus['data']['addresses'],
+ 'chooseHintClass' => $this->hasIpSet ? '' : 'alert alert-danger',
+ ));
+ }
+
// -----------------------------------------------------------------------------------------------
private function getLocalAddresses()
@@ -469,7 +481,7 @@ class Page_ServerSetup extends Page
private function updateLocalAddress()
{
- $newAddress = Request::post('ip', 'none');
+ $newAddress = Request::post('ip', 'none', 'string');
$valid = false;
foreach ($this->taskStatus['data']['addresses'] as $item) {
if ($item['ip'] !== $newAddress)
@@ -486,27 +498,6 @@ class Page_ServerSetup extends Page
Util::redirect();
}
- private function updatePxeMenu()
- {
- $timeout = Request::post('timeout', 10);
- if ($timeout === '')
- $timeout = 0;
- if (!is_numeric($timeout) || $timeout < 0) {
- Message::addError('main.value-invalid', 'timeout', $timeout);
- }
- $this->currentMenu['defaultentry'] = Request::post('defaultentry', 'net');
- $this->currentMenu['timeout'] = $timeout;
- $this->currentMenu['custom'] = Request::post('custom', '');
- $this->currentMenu['masterpasswordclear'] = Request::post('masterpassword', '');
- if (empty($this->currentMenu['masterpasswordclear']))
- $this->currentMenu['masterpassword'] = 'invalid';
- else
- $this->currentMenu['masterpassword'] = Crypto::hash6($this->currentMenu['masterpasswordclear']);
- Property::setBootMenu($this->currentMenu);
- Trigger::ipxe();
- Util::redirect('?do=ServerSetup');
- }
-
private function handleGetImage()
{
$file = "/opt/openslx/ipxe/openslx-bootstick.raw";