summaryrefslogtreecommitdiffstats
path: root/modules-available/locations/inc/locationutil.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/locations/inc/locationutil.inc.php')
-rw-r--r--modules-available/locations/inc/locationutil.inc.php19
1 files changed, 12 insertions, 7 deletions
diff --git a/modules-available/locations/inc/locationutil.inc.php b/modules-available/locations/inc/locationutil.inc.php
index 6b18d864..708cc8a2 100644
--- a/modules-available/locations/inc/locationutil.inc.php
+++ b/modules-available/locations/inc/locationutil.inc.php
@@ -125,9 +125,7 @@ class LocationUtil
$return = [];
$locs = false;
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
- if ($row['subnetlocationid'] === $row['fixedlocationid'])
- continue;
- if (Location::isUuidLocationValid((int)$row['fixedlocationid'], (int)$row['subnetlocationid']))
+ if (Location::isFixedLocationValid($row['fixedlocationid'], $row['subnetlocationid']))
continue;
$lid = (int)$row['fixedlocationid'];
if (!isset($return[$lid])) {
@@ -145,14 +143,21 @@ class LocationUtil
$return[$lid]['count']++;
} else {
$slid = (int)$row['subnetlocationid'];
- $return[$lid]['clients'][] = [
+ $data = [
'machineuuid' => $row['machineuuid'],
'hostname' => $row['hostname'],
'clientip' => $row['clientip'],
- 'iplocationid' => $slid,
- 'iplocationname' => $locs[$slid]['locationname'],
- 'canmove' => !$checkPerms || $ipLocs === true || in_array($slid, $ipLocs), // Can machine be moved to subnet's locationid?
];
+ if ($slid !== 0) {
+ $data += [
+ 'iplocationid' => $slid,
+ 'iplocationname' => $locs[$slid]['locationname'],
+ 'ipisleaf' => empty($locs[$slid]['children']),
+ 'canmove' => empty($locs[$slid]['children'])
+ && (!$checkPerms || $ipLocs === true || in_array($slid, $ipLocs)), // Can machine be moved to subnet's locationid?
+ ];
+ }
+ $return[$lid]['clients'][] = $data;
}
}
if (empty($return))