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 e383e25fc..8e027fe8a 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 @@ -23,7 +23,8 @@ import java.util.Date; /** * A single connection record representing a past usage of a particular - * connection. + * connection. If the connection was being shared, the sharing profile used to + * join the connection is included in the record. * * @author Michael Jumper */ @@ -39,6 +40,21 @@ public class ConnectionRecordModel { */ private String connectionName; + /** + * The identifier of the sharing profile associated with this connection + * record. If no sharing profile was used, or the sharing profile that was + * used was deleted, this will be null. + */ + private String sharingProfileIdentifier; + + /** + * The name of the sharing profile associated with this connection record. + * If no sharing profile was used, this will be null. If the sharing profile + * that was used was deleted, this will still contain the name of the + * sharing profile at the time that the connection was used. + */ + private String sharingProfileName; + /** * The database ID of the user associated with this connection record. */ @@ -110,6 +126,56 @@ public class ConnectionRecordModel { this.connectionName = connectionName; } + /** + * Returns the identifier of the sharing profile associated with this + * connection record. If no sharing profile was used, or the sharing profile + * that was used was deleted, this will be null. + * + * @return + * The identifier of the sharing profile associated with this connection + * record, or null if no sharing profile was used or if the sharing + * profile that was used was deleted. + */ + public String getSharingProfileIdentifier() { + return sharingProfileIdentifier; + } + + /** + * Sets the identifier of the sharing profile associated with this + * connection record. If no sharing profile was used, this should be null. + * + * @param sharingProfileIdentifier + * The identifier of the sharing profile associated with this + * connection record, or null if no sharing profile was used. + */ + public void setSharingProfileIdentifier(String sharingProfileIdentifier) { + this.sharingProfileIdentifier = sharingProfileIdentifier; + } + + /** + * Returns the human-readable name of the sharing profile associated with this + * connection record. If no sharing profile was used, this will be null. + * + * @return + * The human-readable name of the sharing profile associated with this + * connection record, or null if no sharing profile was used. + */ + public String getSharingProfileName() { + return sharingProfileName; + } + + /** + * Sets the human-readable name of the sharing profile associated with this + * connection record. If no sharing profile was used, this should be null. + * + * @param sharingProfileName + * The human-readable name of the sharing profile associated with this + * connection record, or null if no sharing profile was used. + */ + public void setSharingProfileName(String sharingProfileName) { + this.sharingProfileName = sharingProfileName; + } + /** * Returns the database ID of the user associated with this connection * record. 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 41a5fdb34..33de621f5 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 @@ -60,12 +60,12 @@ public class ModeledConnectionRecord implements ConnectionRecord { @Override public String getSharingProfileIdentifier() { - return null; + return model.getSharingProfileIdentifier(); } @Override public String getSharingProfileName() { - return null; + return model.getSharingProfileName(); } @Override 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 3adcde2c2..989379057 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 @@ -25,12 +25,14 @@ - - - - - - + + + + + + + + @@ -39,6 +41,8 @@ SELECT guacamole_connection_history.connection_id, guacamole_connection_history.connection_name, + guacamole_connection_history.sharing_profile_id, + guacamole_connection_history.sharing_profile_name, guacamole_connection_history.user_id, guacamole_connection_history.username, guacamole_connection_history.start_date, @@ -58,6 +62,8 @@ INSERT INTO guacamole_connection_history ( connection_id, connection_name, + sharing_profile_id, + sharing_profile_name, user_id, username, start_date, @@ -66,6 +72,8 @@ VALUES ( #{record.connectionIdentifier,jdbcType=VARCHAR}, #{record.connectionName,jdbcType=VARCHAR}, + #{record.sharingProfileIdentifier,jdbcType=VARCHAR}, + #{record.sharingProfileName,jdbcType=VARCHAR}, (SELECT user_id FROM guacamole_user WHERE username = #{record.username,jdbcType=VARCHAR}), #{record.username,jdbcType=VARCHAR}, @@ -81,6 +89,8 @@ SELECT guacamole_connection_history.connection_id, guacamole_connection_history.connection_name, + guacamole_connection_history.sharing_profile_id, + guacamole_connection_history.sharing_profile_name, guacamole_connection_history.user_id, guacamole_connection_history.username, guacamole_connection_history.start_date, @@ -136,6 +146,8 @@ SELECT guacamole_connection_history.connection_id, guacamole_connection_history.connection_name, + guacamole_connection_history.sharing_profile_id, + guacamole_connection_history.sharing_profile_name, guacamole_connection_history.user_id, guacamole_connection_history.username, guacamole_connection_history.start_date, 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 9e395a432..455ce6849 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 @@ -25,12 +25,14 @@ - - - - - - + + + + + + + + @@ -39,6 +41,8 @@ SELECT guacamole_connection_history.connection_id, guacamole_connection_history.connection_name, + guacamole_connection_history.sharing_profile_id, + guacamole_connection_history.sharing_profile_name, guacamole_connection_history.user_id, guacamole_connection_history.username, guacamole_connection_history.start_date, @@ -58,6 +62,8 @@ INSERT INTO guacamole_connection_history ( connection_id, connection_name, + sharing_profile_id, + sharing_profile_name, user_id, username, start_date, @@ -66,6 +72,8 @@ VALUES ( #{record.connectionIdentifier,jdbcType=INTEGER}::integer, #{record.connectionName,jdbcType=VARCHAR}, + #{record.sharingProfileIdentifier,jdbcType=INTEGER}::integer, + #{record.sharingProfileName,jdbcType=VARCHAR}, (SELECT user_id FROM guacamole_user WHERE username = #{record.username,jdbcType=VARCHAR}), #{record.username,jdbcType=VARCHAR}, @@ -81,6 +89,8 @@ SELECT guacamole_connection_history.connection_id, guacamole_connection_history.connection_name, + guacamole_connection_history.sharing_profile_id, + guacamole_connection_history.sharing_profile_name, guacamole_connection_history.user_id, guacamole_connection_history.username, guacamole_connection_history.start_date, @@ -134,6 +144,8 @@ SELECT guacamole_connection_history.connection_id, guacamole_connection_history.connection_name, + guacamole_connection_history.sharing_profile_id, + guacamole_connection_history.sharing_profile_name, guacamole_connection_history.user_id, guacamole_connection_history.username, guacamole_connection_history.start_date,