From 6bdd81d83379f080029865de8507e076cc95a846 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 4 Mar 2021 14:59:22 +0100 Subject: [locationinfo] Ignore position of machines with mismatching location If locationid != fixedlocationid, something must be off, and we better ignore that machine's position in the room. --- modules-available/locationinfo/inc/infopanel.inc.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules-available/locationinfo/inc/infopanel.inc.php b/modules-available/locationinfo/inc/infopanel.inc.php index af32c1ed..6deb9db5 100644 --- a/modules-available/locationinfo/inc/infopanel.inc.php +++ b/modules-available/locationinfo/inc/infopanel.inc.php @@ -108,7 +108,9 @@ class InfoPanel if ($withHostname) { $extraCols .= 'm.hostname,'; } - $query = "SELECT m.locationid, m.machineuuid, $extraCols m.logintime, m.lastseen, m.lastboot, m.state, m.currentrunmode FROM machine m + $query = "SELECT m.locationid, m.fixedlocationid, m.machineuuid, $extraCols m.logintime, + m.lastseen, m.lastboot, m.state, m.currentrunmode + FROM machine m WHERE m.locationid IN (:idlist)"; $dbquery = Database::simpleQuery($query, array('idlist' => $idList)); @@ -125,7 +127,8 @@ class InfoPanel } // Compact the pc data in one array. $pc = array('id' => $row['machineuuid']); - if ($withPosition && !empty($row['position'])) { + if ($withPosition && $row['locationid'] == $row['fixedlocationid'] && !empty($row['position'])) { + // check fixed* == locationid to ignore stale position data in relocated clients $position = json_decode($row['position'], true); if (isset($position['gridCol']) && isset($position['gridRow'])) { $pc['x'] = $position['gridCol']; -- cgit v1.2.3-55-g7522