diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordModel.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordModel.java index 791ba7787..f142f4e8f 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordModel.java +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordModel.java @@ -63,6 +63,11 @@ public class ConnectionRecordModel { */ private String username; + /** + * The remote host associated with this connection record. + */ + private String remoteHost; + /** * The time the connection was initiated by the associated user. */ @@ -216,6 +221,26 @@ public class ConnectionRecordModel { this.username = username; } + /** + * Returns the remote host associated with this connection record. + * + * @return + * The remote host associated with this connection record. + */ + public String getRemoteHost() { + return remoteHost; + } + + /** + * Sets the remote host associated with this connection record. + * + * @param remoteHost + * The remote host to associate with this connection record. + */ + public void setRemoteHost(String remoteHost) { + this.remoteHost = remoteHost; + } + /** * Returns the date that the associated connection was established. * diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ModeledConnectionRecord.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ModeledConnectionRecord.java index 2dc72dafb..a5e83d413 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ModeledConnectionRecord.java +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ModeledConnectionRecord.java @@ -77,7 +77,7 @@ public class ModeledConnectionRecord implements ConnectionRecord { @Override public String getRemoteHost() { - return null; + return model.getRemoteHost(); } @Override diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/AbstractGuacamoleTunnelService.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/AbstractGuacamoleTunnelService.java index 40543338e..59ed13c1c 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/AbstractGuacamoleTunnelService.java +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/AbstractGuacamoleTunnelService.java @@ -306,6 +306,7 @@ public abstract class AbstractGuacamoleTunnelService implements GuacamoleTunnelS recordModel.setUsername(record.getUsername()); recordModel.setConnectionIdentifier(record.getConnectionIdentifier()); recordModel.setConnectionName(record.getConnectionName()); + recordModel.setRemoteHost(record.getRemoteHost()); recordModel.setSharingProfileIdentifier(record.getSharingProfileIdentifier()); recordModel.setSharingProfileName(record.getSharingProfileName()); recordModel.setStartDate(record.getStartDate()); diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/schema/001-create-schema.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/schema/001-create-schema.sql index 515ea726b..70eafa2a6 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/schema/001-create-schema.sql +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/schema/001-create-schema.sql @@ -322,6 +322,7 @@ CREATE TABLE `guacamole_connection_history` ( `history_id` int(11) NOT NULL AUTO_INCREMENT, `user_id` int(11) DEFAULT NULL, `username` varchar(128) NOT NULL, + `remote_host` varchar(128) DEFAULT NULL, `connection_id` int(11) DEFAULT NULL, `connection_name` varchar(128) NOT NULL, `sharing_profile_id` int(11) DEFAULT NULL, diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/schema/upgrade/upgrade-pre-0.9.14.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/schema/upgrade/upgrade-pre-0.9.14.sql index 14a016b1f..c975bf303 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/schema/upgrade/upgrade-pre-0.9.14.sql +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/schema/upgrade/upgrade-pre-0.9.14.sql @@ -30,3 +30,10 @@ ALTER TABLE guacamole_connection ALTER TABLE guacamole_connection ADD COLUMN failover_only BOOLEAN NOT NULL DEFAULT 0; + +-- +-- Add remote_host to connection history +-- + +ALTER TABLE guacamole_connection_history + ADD COLUMN remote_host VARCHAR(128) DEFAULT NULL; diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml index 989379057..c2c12c138 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml @@ -27,6 +27,7 @@ + @@ -41,6 +42,7 @@ SELECT guacamole_connection_history.connection_id, guacamole_connection_history.connection_name, + guacamole_connection_history.remote_host, guacamole_connection_history.sharing_profile_id, guacamole_connection_history.sharing_profile_name, guacamole_connection_history.user_id, @@ -62,6 +64,7 @@ INSERT INTO guacamole_connection_history ( connection_id, connection_name, + remote_host, sharing_profile_id, sharing_profile_name, user_id, @@ -72,6 +75,7 @@ VALUES ( #{record.connectionIdentifier,jdbcType=VARCHAR}, #{record.connectionName,jdbcType=VARCHAR}, + #{record.remoteHost,jdbcType=VARCHAR}, #{record.sharingProfileIdentifier,jdbcType=VARCHAR}, #{record.sharingProfileName,jdbcType=VARCHAR}, (SELECT user_id FROM guacamole_user @@ -89,6 +93,7 @@ SELECT guacamole_connection_history.connection_id, guacamole_connection_history.connection_name, + guacamole_connection_history.remote_host, guacamole_connection_history.sharing_profile_id, guacamole_connection_history.sharing_profile_name, guacamole_connection_history.user_id, @@ -146,6 +151,7 @@ SELECT guacamole_connection_history.connection_id, guacamole_connection_history.connection_name, + guacamole_connection_history.remote_host, guacamole_connection_history.sharing_profile_id, guacamole_connection_history.sharing_profile_name, guacamole_connection_history.user_id, @@ -209,4 +215,4 @@ - \ No newline at end of file + diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/schema/001-create-schema.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/schema/001-create-schema.sql index d1b5bf5f9..f5372f753 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/schema/001-create-schema.sql +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/schema/001-create-schema.sql @@ -381,6 +381,7 @@ CREATE TABLE guacamole_connection_history ( history_id serial NOT NULL, user_id integer DEFAULT NULL, username varchar(128) NOT NULL, + remote_host varchar(128) DEFAULT NULL, connection_id integer DEFAULT NULL, connection_name varchar(128) NOT NULL, sharing_profile_id integer DEFAULT NULL, diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/schema/upgrade/upgrade-pre-0.9.14.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/schema/upgrade/upgrade-pre-0.9.14.sql index 20882ed74..438dd5a81 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/schema/upgrade/upgrade-pre-0.9.14.sql +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/schema/upgrade/upgrade-pre-0.9.14.sql @@ -30,3 +30,10 @@ ALTER TABLE guacamole_connection ALTER TABLE guacamole_connection ADD COLUMN failover_only BOOLEAN NOT NULL DEFAULT FALSE; + +-- +-- Add remote_host to connection history +-- + +ALTER TABLE guacamole_connection_history + ADD COLUMN remote_host VARCHAR(128) DEFAULT NULL; diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml index 455ce6849..2b3e193ca 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml @@ -27,6 +27,7 @@ + @@ -41,6 +42,7 @@ SELECT guacamole_connection_history.connection_id, guacamole_connection_history.connection_name, + guacamole_connection_history.remote_host, guacamole_connection_history.sharing_profile_id, guacamole_connection_history.sharing_profile_name, guacamole_connection_history.user_id, @@ -62,6 +64,7 @@ INSERT INTO guacamole_connection_history ( connection_id, connection_name, + remote_host, sharing_profile_id, sharing_profile_name, user_id, @@ -72,6 +75,7 @@ VALUES ( #{record.connectionIdentifier,jdbcType=INTEGER}::integer, #{record.connectionName,jdbcType=VARCHAR}, + #{record.remoteHost,jdbcType=VARCHAR}, #{record.sharingProfileIdentifier,jdbcType=INTEGER}::integer, #{record.sharingProfileName,jdbcType=VARCHAR}, (SELECT user_id FROM guacamole_user @@ -89,6 +93,7 @@ SELECT guacamole_connection_history.connection_id, guacamole_connection_history.connection_name, + guacamole_connection_history.remote_host, guacamole_connection_history.sharing_profile_id, guacamole_connection_history.sharing_profile_name, guacamole_connection_history.user_id, @@ -144,6 +149,7 @@ SELECT guacamole_connection_history.connection_id, guacamole_connection_history.connection_name, + guacamole_connection_history.remote_host, guacamole_connection_history.sharing_profile_id, guacamole_connection_history.sharing_profile_name, guacamole_connection_history.user_id, @@ -207,4 +213,4 @@ - \ No newline at end of file +