summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2023-12-14 17:55:32 +0100
committerSimon Rettberg2023-12-14 17:55:32 +0100
commit88d87eb34ef69725215df162e245bfb38743bcd0 (patch)
treef47df8fddf64247b8682d2ee7f2a42e185c48b20
parent[statistics] Sanitize live values from client (diff)
downloadslx-admin-88d87eb34ef69725215df162e245bfb38743bcd0.tar.gz
slx-admin-88d87eb34ef69725215df162e245bfb38743bcd0.tar.xz
slx-admin-88d87eb34ef69725215df162e245bfb38743bcd0.zip
[rebootcontrol] Hide client2client subnets in details view if disabled
-rw-r--r--modules-available/rebootcontrol/pages/subnet.inc.php16
-rw-r--r--modules-available/rebootcontrol/templates/subnet-edit.html2
2 files changed, 12 insertions, 6 deletions
diff --git a/modules-available/rebootcontrol/pages/subnet.inc.php b/modules-available/rebootcontrol/pages/subnet.inc.php
index 3e593505..a6d8d837 100644
--- a/modules-available/rebootcontrol/pages/subnet.inc.php
+++ b/modules-available/rebootcontrol/pages/subnet.inc.php
@@ -154,15 +154,19 @@ class SubPage
$jh[] = $row;
}
$subnet['jumpHosts'] = $jh;
- // Get list of all subnets that can broadcast into this one
- $res = Database::simpleQuery('SELECT s.start, s.end FROM reboot_subnet s
+ $c2c = Property::get(RebootControl::KEY_SCAN_CLIENT_TO_CLIENT);
+ if ($c2c) {
+ // Get list of all subnets that can broadcast into this one
+ $res = Database::simpleQuery('SELECT s.start, s.end FROM reboot_subnet s
INNER JOIN reboot_subnet_x_subnet sxs ON (s.subnetid = sxs.srcid AND sxs.dstid = :id AND sxs.reachable = 1)
ORDER BY s.start ASC', ['id' => $id]);
- $sn = [];
- foreach ($res as $row) {
- $sn[] = ['cidr' => IpUtil::rangeToCidr($row['start'], $row['end'])];
+ $sn = [];
+ foreach ($res as $row) {
+ $sn[] = ['cidr' => IpUtil::rangeToCidr($row['start'], $row['end'])];
+ }
+ $subnet['sourceNets'] = $sn;
+ $subnet['showC2C'] = true;
}
- $subnet['sourceNets'] = $sn;
Permission::addGlobalTags($subnet['perms'], null, ['subnet.flag', 'jumphost.view', 'jumphost.assign-subnet']);
Render::addTemplate('subnet-edit', $subnet);
}
diff --git a/modules-available/rebootcontrol/templates/subnet-edit.html b/modules-available/rebootcontrol/templates/subnet-edit.html
index 5a6adf3c..570865c7 100644
--- a/modules-available/rebootcontrol/templates/subnet-edit.html
+++ b/modules-available/rebootcontrol/templates/subnet-edit.html
@@ -39,12 +39,14 @@
</div>
{{/jumpHosts}}
</div>
+ {{#showC2C}}
<div class="list-group-item">
<label>{{lang_reachableFrom}}</label>
{{#sourceNets}}
<div>{{cidr}}</div>
{{/sourceNets}}
</div>
+ {{/showC2C}}
</div>
<div class="panel-footer text-right">
<button type="submit" class="btn btn-danger" name="action" value="delete"