You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by jf...@apache.org on 2024/02/15 22:39:30 UTC

(vcl) branch develop updated: VCL-1141 - Add Connect clicked info for reservations to User Lookup page

This is an automated email from the ASF dual-hosted git repository.

jfthomps pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/vcl.git


The following commit(s) were added to refs/heads/develop by this push:
     new 43dff399 VCL-1141 - Add Connect clicked info for reservations to User Lookup page
43dff399 is described below

commit 43dff3995b6a140edbd68037a60e2854fca42343
Author: Josh Thompson <jf...@ncsu.edu>
AuthorDate: Thu Feb 15 17:38:05 2024 -0500

    VCL-1141 - Add Connect clicked info for reservations to User Lookup page
    
    privileges.php: modified userLookup: added code to get last time Connect was clicked within the last week from querylog for user's reservations and server reservations user has access to
---
 web/.ht-inc/privileges.php | 50 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/web/.ht-inc/privileges.php b/web/.ht-inc/privileges.php
index cb90926e..41301699 100644
--- a/web/.ht-inc/privileges.php
+++ b/web/.ht-inc/privileges.php
@@ -1976,6 +1976,24 @@ function userLookup() {
 			print "<table>\n";
 			$first = 1;
 			foreach($requests as $req) {
+				# get information about last time Connect button clicked
+				$query = "SELECT timestamp, "
+				       .        "query "
+				       . "FROM querylog "
+				       . "WHERE userid = {$userdata['id']} AND "
+				       .       "mode = 'AJconnectRequest' AND "
+				       .       "timestamp > DATE_SUB(NOW(), INTERVAL 1 WEEK) AND "
+				       .       "query LIKE 'UPDATE reservation SET remoteIP = % WHERE requestid = {$req['requestid']}' "
+				       . "ORDER BY timestamp DESC "
+				       . "LIMIT 5";
+				$qh = doQuery($query);
+				$connects = array();
+				while($row = mysqli_fetch_assoc($qh)) {
+					preg_match("/^UPDATE reservation SET remoteIP = '([0-9\.]+)' WHERE requestid = {$req['requestid']}$/", $row['query'], $matches);
+					if(isset($matches[1]))
+						$connects[] = "{$row['timestamp']} from {$matches[1]}";
+				}
+				$connectstr = implode('<br>', $connects);
 				if($first)
 					$first = 0;
 				else {
@@ -2053,6 +2071,12 @@ function userLookup() {
 				print "    <th align=right>Management Node:</th>\n";
 				print "    <td>{$req['managementnode']}</td>\n";
 				print "  </tr>\n";
+				if(count($connects)) {
+					print "  <tr>\n";
+					print "    <th align=right>Connect last clicked:</th>\n";
+					print "    <td>$connectstr</td>\n";
+					print "  </tr>\n";
+				}
 			}
 			print "</table>\n";
 		}
@@ -2106,6 +2130,26 @@ function userLookup() {
 				print "<table>\n";
 				$first = 1;
 				foreach($requests as $req) {
+					# get information about last time Connect button clicked
+					$connects = array();
+					if(count($requests) < 15) {
+						$query = "SELECT timestamp, "
+						       .        "query "
+						       . "FROM querylog "
+						       . "WHERE userid = {$userdata['id']} AND "
+						       .       "mode = 'AJconnectRequest' AND "
+						       .       "timestamp > DATE_SUB(NOW(), INTERVAL 1 WEEK) AND "
+						       .       "query LIKE 'UPDATE reservation SET remoteIP = % WHERE requestid = {$req['requestid']}' "
+						       . "ORDER BY timestamp DESC "
+						       . "LIMIT 5";
+						$qh = doQuery($query);
+						while($row = mysqli_fetch_assoc($qh)) {
+							preg_match("/^UPDATE reservation SET remoteIP = '([0-9\.]+)' WHERE requestid = {$req['requestid']}$/", $row['query'], $matches);
+							if(isset($matches[1]))
+								$connects[] = "{$row['timestamp']} from {$matches[1]}";
+						}
+						$connectstr = implode('<br>', $connects);
+					}
 					if($first)
 						$first = 0;
 					else {
@@ -2177,6 +2221,12 @@ function userLookup() {
 					print "    <th align=right>Management Node:</th>\n";
 					print "    <td>{$req['managementnode']}</td>\n";
 					print "  </tr>\n";
+					if(count($connects)) {
+						print "  <tr>\n";
+						print "    <th align=right>Connect last clicked:</th>\n";
+						print "    <td>$connectstr</td>\n";
+						print "  </tr>\n";
+					}
 				}
 				print "</table>\n";
 			}