GUACAMOLE-5: Add sharing profile properties to connection record model. Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/53a856b2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/53a856b2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/53a856b2
Branch: refs/heads/master Commit: 53a856b285c65b519f73492e40ddce640d70f14f Parents: cfac865 Author: Michael Jumper <[email protected]> Authored: Tue Jul 19 16:03:11 2016 -0700 Committer: Michael Jumper <[email protected]> Committed: Tue Jul 19 22:26:30 2016 -0700 ---------------------------------------------------------------------- .../jdbc/connection/ConnectionRecordModel.java | 68 +++++++++++++++++++- .../connection/ModeledConnectionRecord.java | 4 +- .../jdbc/connection/ConnectionRecordMapper.xml | 24 +++++-- .../jdbc/connection/ConnectionRecordMapper.xml | 24 +++++-- 4 files changed, 105 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/53a856b2/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordModel.java ---------------------------------------------------------------------- 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 e383e25..8e027fe 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 */ @@ -40,6 +41,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. */ private Integer userID; @@ -111,6 +127,56 @@ public class ConnectionRecordModel { } /** + * 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. * http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/53a856b2/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ModeledConnectionRecord.java ---------------------------------------------------------------------- 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 41a5fdb..33de621 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 http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/53a856b2/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml ---------------------------------------------------------------------- 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 3adcde2..9893790 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 @@ <!-- Result mapper for system permissions --> <resultMap id="ConnectionRecordResultMap" type="org.apache.guacamole.auth.jdbc.connection.ConnectionRecordModel"> - <result column="connection_id" property="connectionIdentifier" jdbcType="INTEGER"/> - <result column="connection_name" property="connectionName" jdbcType="VARCHAR"/> - <result column="user_id" property="userID" jdbcType="INTEGER"/> - <result column="username" property="username" jdbcType="VARCHAR"/> - <result column="start_date" property="startDate" jdbcType="TIMESTAMP"/> - <result column="end_date" property="endDate" jdbcType="TIMESTAMP"/> + <result column="connection_id" property="connectionIdentifier" jdbcType="INTEGER"/> + <result column="connection_name" property="connectionName" jdbcType="VARCHAR"/> + <result column="sharing_profile_id" property="sharingProfileIdentifier" jdbcType="INTEGER"/> + <result column="sharing_profile_name" property="sharingProfileName" jdbcType="VARCHAR"/> + <result column="user_id" property="userID" jdbcType="INTEGER"/> + <result column="username" property="username" jdbcType="VARCHAR"/> + <result column="start_date" property="startDate" jdbcType="TIMESTAMP"/> + <result column="end_date" property="endDate" jdbcType="TIMESTAMP"/> </resultMap> <!-- Select all connection records from a given connection --> @@ -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, http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/53a856b2/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml ---------------------------------------------------------------------- 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 9e395a4..455ce68 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 @@ <!-- Result mapper for system permissions --> <resultMap id="ConnectionRecordResultMap" type="org.apache.guacamole.auth.jdbc.connection.ConnectionRecordModel"> - <result column="connection_id" property="connectionIdentifier" jdbcType="INTEGER"/> - <result column="connection_name" property="connectionName" jdbcType="VARCHAR"/> - <result column="user_id" property="userID" jdbcType="INTEGER"/> - <result column="username" property="username" jdbcType="VARCHAR"/> - <result column="start_date" property="startDate" jdbcType="TIMESTAMP"/> - <result column="end_date" property="endDate" jdbcType="TIMESTAMP"/> + <result column="connection_id" property="connectionIdentifier" jdbcType="INTEGER"/> + <result column="connection_name" property="connectionName" jdbcType="VARCHAR"/> + <result column="sharing_profile_id" property="sharingProfileIdentifier" jdbcType="INTEGER"/> + <result column="sharing_profile_name" property="sharingProfileName" jdbcType="VARCHAR"/> + <result column="user_id" property="userID" jdbcType="INTEGER"/> + <result column="username" property="username" jdbcType="VARCHAR"/> + <result column="start_date" property="startDate" jdbcType="TIMESTAMP"/> + <result column="end_date" property="endDate" jdbcType="TIMESTAMP"/> </resultMap> <!-- Select all connection records from a given connection --> @@ -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,
