From 3c5f72b288c988a94f72dcb035b2ee83f2da6bd2 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Wed, 23 Sep 2015 16:02:17 -0700 Subject: [PATCH] GUAC-1193: Include connection identifier within history records. --- .../connection/ModeledConnectionRecord.java | 5 +++++ .../jdbc/tunnel/ActiveConnectionRecord.java | 5 +++++ .../guacamole/net/auth/ConnectionRecord.java | 10 ++++++++++ .../basic/rest/history/APIConnectionRecord.java | 17 +++++++++++++++++ .../app/rest/types/ConnectionHistoryEntry.js | 7 +++++++ 5 files changed, 44 insertions(+) diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/glyptodon/guacamole/auth/jdbc/connection/ModeledConnectionRecord.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/glyptodon/guacamole/auth/jdbc/connection/ModeledConnectionRecord.java index 83e472c73..18e491065 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/glyptodon/guacamole/auth/jdbc/connection/ModeledConnectionRecord.java +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/glyptodon/guacamole/auth/jdbc/connection/ModeledConnectionRecord.java @@ -51,6 +51,11 @@ public class ModeledConnectionRecord implements ConnectionRecord { this.model = model; } + @Override + public String getConnectionIdentifier() { + return model.getConnectionIdentifier(); + } + @Override public Date getStartDate() { return model.getStartDate(); diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/glyptodon/guacamole/auth/jdbc/tunnel/ActiveConnectionRecord.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/glyptodon/guacamole/auth/jdbc/tunnel/ActiveConnectionRecord.java index 6401e705c..3c0cbf5bd 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/glyptodon/guacamole/auth/jdbc/tunnel/ActiveConnectionRecord.java +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/glyptodon/guacamole/auth/jdbc/tunnel/ActiveConnectionRecord.java @@ -164,6 +164,11 @@ public class ActiveConnectionRecord implements ConnectionRecord { return balancingGroup != null; } + @Override + public String getConnectionIdentifier() { + return connection.getIdentifier(); + } + @Override public Date getStartDate() { return startDate; diff --git a/guacamole-ext/src/main/java/org/glyptodon/guacamole/net/auth/ConnectionRecord.java b/guacamole-ext/src/main/java/org/glyptodon/guacamole/net/auth/ConnectionRecord.java index bb43565d5..1d3568e4b 100644 --- a/guacamole-ext/src/main/java/org/glyptodon/guacamole/net/auth/ConnectionRecord.java +++ b/guacamole-ext/src/main/java/org/glyptodon/guacamole/net/auth/ConnectionRecord.java @@ -32,6 +32,16 @@ import java.util.Date; */ public interface ConnectionRecord { + /** + * Returns the identifier of the connection associated with this + * connection record. + * + * @return + * The identifier of the connection associated with this connection + * record. + */ + public String getConnectionIdentifier(); + /** * Returns the date and time the connection began. * diff --git a/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/rest/history/APIConnectionRecord.java b/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/rest/history/APIConnectionRecord.java index 510ebaec9..a9e14586f 100644 --- a/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/rest/history/APIConnectionRecord.java +++ b/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/rest/history/APIConnectionRecord.java @@ -32,6 +32,11 @@ import org.glyptodon.guacamole.net.auth.ConnectionRecord; */ public class APIConnectionRecord { + /** + * The identifier of the connection associated with this record. + */ + private final String connectionIdentifier; + /** * The date and time the connection began. */ @@ -66,6 +71,7 @@ public class APIConnectionRecord { * The record to copy data from. */ public APIConnectionRecord(ConnectionRecord record) { + this.connectionIdentifier = record.getConnectionIdentifier(); this.startDate = record.getStartDate(); this.endDate = record.getEndDate(); this.remoteHost = record.getRemoteHost(); @@ -73,6 +79,17 @@ public class APIConnectionRecord { this.active = record.isActive(); } + /** + * Returns the identifier of the connection associated with this + * record. + * + * @return + * The identifier of the connection associated with this record. + */ + public String getConnectionIdentifier() { + return connectionIdentifier; + } + /** * Returns the date and time the connection began. * diff --git a/guacamole/src/main/webapp/app/rest/types/ConnectionHistoryEntry.js b/guacamole/src/main/webapp/app/rest/types/ConnectionHistoryEntry.js index 1fe9ba89a..1ffb78e37 100644 --- a/guacamole/src/main/webapp/app/rest/types/ConnectionHistoryEntry.js +++ b/guacamole/src/main/webapp/app/rest/types/ConnectionHistoryEntry.js @@ -41,6 +41,13 @@ angular.module('rest').factory('ConnectionHistoryEntry', [function defineConnect // Use empty object by default template = template || {}; + /** + * The identifier of the connection associated with this history entry. + * + * @type String + */ + this.connectionIdentifier = template.connectionIdentifier; + /** * The time that usage began, in seconds since 1970-01-01 00:00:00 UTC. *