diff options
author | Ramón M. Gómez <ramongomez@us.es> | 2020-09-11 10:59:25 +0200 |
---|---|---|
committer | Ramón M. Gómez <ramongomez@us.es> | 2020-09-11 10:59:25 +0200 |
commit | 3cffc27097143b880b7aaf3e208f364217b57fa9 (patch) | |
tree | 924fc3968b216452b70f8888ce610d5ee42cf390 /admin | |
parent | 7e8132afa3d91c36f114d4275d9855bae87de9e5 (diff) |
#992: Set local session flag on user login or logout.
Diffstat (limited to 'admin')
-rw-r--r-- | admin/WebConsole/rest/ogagent.php | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/admin/WebConsole/rest/ogagent.php b/admin/WebConsole/rest/ogagent.php index a6271f5c..694daab5 100644 --- a/admin/WebConsole/rest/ogagent.php +++ b/admin/WebConsole/rest/ogagent.php @@ -181,6 +181,8 @@ EOD; } else { throw new Exception("Client is not in the database: ip=$ip, user=$user"); } + // Compose sentence to store if the user session is local or not. + $cmd->texto = "UPDATE remotepc SET islocal = IF('$session' = 'local', 1, 0)"; // Redirect notification to UDS server, if needed. if ($reserved == 1 and !is_null($sendlogin[0]['url'])) { $sendlogin[0]['get'] = $app->request()->getBody(); @@ -188,18 +190,16 @@ EOD; // ... (check response) //if ($result[0]['code'] != 200) { // ... - // Updating user's session language for messages. - $cmd->texto = <<<EOD -UPDATE remotepc - SET language = '$language' - WHERE id = '$id'; -EOD; - $cmd->Ejecutar(); + // Add user's session language to the SQL sentence. + $cmd->texto .= ", language = '$language"; } // Release a reserved client if a user opens a local session. if ($reserved == 1 and $session === "local" and ! is_null($sendrel[0]['url'])) { $result = multiRequest($sendrel); } + // Update the database. + $cmd->texto .= " WHERE id = '$id';"; + $cmd->Ejecutar(); } else { throw new Exception("Database error"); } @@ -268,6 +268,9 @@ EOD; //if ($result[0]['code'] != 200) { // ... } + // Disable local session flag. + $cmd->texto = "UPDATE remotepc SET islocal = 0 WHERE id = '$id';"; + $cmd->Ejecutar(); } else { throw new Exception("Database error"); } |