GUAC-1193 Add required connection name property to connection record.

This commit is contained in:
James Muehlner
2015-10-13 20:04:24 -07:00
parent 3c271da9b4
commit 03c1ac1876
8 changed files with 91 additions and 16 deletions

View File

@@ -37,6 +37,11 @@ public class ConnectionRecordModel {
*/ */
private String connectionIdentifier; private String connectionIdentifier;
/**
* The name of the connection associated with this connection record.
*/
private String connectionName;
/** /**
* The database ID of the user associated with this connection record. * The database ID of the user associated with this connection record.
*/ */
@@ -82,6 +87,32 @@ public class ConnectionRecordModel {
this.connectionIdentifier = connectionIdentifier; this.connectionIdentifier = connectionIdentifier;
} }
/**
* Returns the name of the connection associated with this connection
* record.
*
* @return
* The name of the connection associated with this connection
* record.
*/
public String getConnectionName() {
return connectionName;
}
/**
* Sets the name of the connection associated with this connection
* record.
*
* @param connectionName
* The name of the connection to associate with this connection
* record.
*/
public void setConnectionName(String connectionName) {
this.connectionName = connectionName;
}
/** /**
* Returns the database ID of the user associated with this connection * Returns the database ID of the user associated with this connection
* record. * record.

View File

@@ -56,6 +56,11 @@ public class ModeledConnectionRecord implements ConnectionRecord {
return model.getConnectionIdentifier(); return model.getConnectionIdentifier();
} }
@Override
public String getConnectionName() {
return model.getConnectionName();
}
@Override @Override
public Date getStartDate() { public Date getStartDate() {
return model.getStartDate(); return model.getStartDate();

View File

@@ -169,6 +169,11 @@ public class ActiveConnectionRecord implements ConnectionRecord {
return connection.getIdentifier(); return connection.getIdentifier();
} }
@Override
public String getConnectionName() {
return connection.getName();
}
@Override @Override
public Date getStartDate() { public Date getStartDate() {
return startDate; return startDate;

View File

@@ -42,7 +42,6 @@ import org.glyptodon.guacamole.net.auth.Connection;
import org.glyptodon.guacamole.net.auth.ConnectionGroup; import org.glyptodon.guacamole.net.auth.ConnectionGroup;
import org.glyptodon.guacamole.net.auth.Directory; import org.glyptodon.guacamole.net.auth.Directory;
import org.glyptodon.guacamole.net.auth.User; import org.glyptodon.guacamole.net.auth.User;
import org.glyptodon.guacamole.net.auth.simple.SimpleConnectionRecordSet;
/** /**
* UserContext implementation which is driven by an arbitrary, underlying * UserContext implementation which is driven by an arbitrary, underlying

View File

@@ -28,11 +28,12 @@
<!-- Result mapper for system permissions --> <!-- Result mapper for system permissions -->
<resultMap id="ConnectionRecordResultMap" type="org.glyptodon.guacamole.auth.jdbc.connection.ConnectionRecordModel"> <resultMap id="ConnectionRecordResultMap" type="org.glyptodon.guacamole.auth.jdbc.connection.ConnectionRecordModel">
<result column="connection_id" property="connectionIdentifier" jdbcType="INTEGER"/> <result column="connection_id" property="connectionIdentifier" jdbcType="INTEGER"/>
<result column="user_id" property="userID" jdbcType="INTEGER"/> <result column="connection_name" property="connectionName" jdbcType="VARCHAR"/>
<result column="username" property="username" jdbcType="VARCHAR"/> <result column="user_id" property="userID" jdbcType="INTEGER"/>
<result column="start_date" property="startDate" jdbcType="TIMESTAMP"/> <result column="username" property="username" jdbcType="VARCHAR"/>
<result column="end_date" property="endDate" jdbcType="TIMESTAMP"/> <result column="start_date" property="startDate" jdbcType="TIMESTAMP"/>
<result column="end_date" property="endDate" jdbcType="TIMESTAMP"/>
</resultMap> </resultMap>
<!-- Select all connection records from a given connection --> <!-- Select all connection records from a given connection -->
@@ -40,6 +41,7 @@
SELECT SELECT
connection_id, connection_id,
connection_name,
guacamole_connection_history.user_id, guacamole_connection_history.user_id,
username, username,
start_date, start_date,
@@ -59,6 +61,7 @@
INSERT INTO guacamole_connection_history ( INSERT INTO guacamole_connection_history (
connection_id, connection_id,
connection_name,
user_id, user_id,
start_date, start_date,
end_date end_date
@@ -77,6 +80,7 @@
SELECT SELECT
guacamole_connection_history.connection_id, guacamole_connection_history.connection_id,
guacamole_connection.connection_name,
guacamole_connection_history.user_id, guacamole_connection_history.user_id,
guacamole_user.username, guacamole_user.username,
guacamole_connection_history.start_date, guacamole_connection_history.start_date,
@@ -140,6 +144,7 @@
SELECT SELECT
guacamole_connection_history.connection_id, guacamole_connection_history.connection_id,
guacamole_connection.connection_name,
guacamole_connection_history.user_id, guacamole_connection_history.user_id,
guacamole_user.username, guacamole_user.username,
guacamole_connection_history.start_date, guacamole_connection_history.start_date,

View File

@@ -28,11 +28,12 @@
<!-- Result mapper for system permissions --> <!-- Result mapper for system permissions -->
<resultMap id="ConnectionRecordResultMap" type="org.glyptodon.guacamole.auth.jdbc.connection.ConnectionRecordModel"> <resultMap id="ConnectionRecordResultMap" type="org.glyptodon.guacamole.auth.jdbc.connection.ConnectionRecordModel">
<result column="connection_id" property="connectionIdentifier" jdbcType="INTEGER"/> <result column="connection_id" property="connectionIdentifier" jdbcType="INTEGER"/>
<result column="user_id" property="userID" jdbcType="INTEGER"/> <result column="connection_name" property="connectionName" jdbcType="VARCHAR"/>
<result column="username" property="username" jdbcType="VARCHAR"/> <result column="user_id" property="userID" jdbcType="INTEGER"/>
<result column="start_date" property="startDate" jdbcType="TIMESTAMP"/> <result column="username" property="username" jdbcType="VARCHAR"/>
<result column="end_date" property="endDate" jdbcType="TIMESTAMP"/> <result column="start_date" property="startDate" jdbcType="TIMESTAMP"/>
<result column="end_date" property="endDate" jdbcType="TIMESTAMP"/>
</resultMap> </resultMap>
<!-- Select all connection records from a given connection --> <!-- Select all connection records from a given connection -->
@@ -40,6 +41,7 @@
SELECT SELECT
connection_id, connection_id,
connection_name,
guacamole_connection_history.user_id, guacamole_connection_history.user_id,
username, username,
start_date, start_date,
@@ -59,6 +61,7 @@
INSERT INTO guacamole_connection_history ( INSERT INTO guacamole_connection_history (
connection_id, connection_id,
connection_name,
user_id, user_id,
start_date, start_date,
end_date end_date
@@ -77,6 +80,7 @@
SELECT SELECT
guacamole_connection_history.connection_id, guacamole_connection_history.connection_id,
guacamole_connection.connection_name,
guacamole_connection_history.user_id, guacamole_connection_history.user_id,
guacamole_user.username, guacamole_user.username,
guacamole_connection_history.start_date, guacamole_connection_history.start_date,
@@ -140,6 +144,7 @@
SELECT SELECT
guacamole_connection_history.connection_id, guacamole_connection_history.connection_id,
guacamole_connection.connection_name,
guacamole_connection_history.user_id, guacamole_connection_history.user_id,
guacamole_user.username, guacamole_user.username,
guacamole_connection_history.start_date, guacamole_connection_history.start_date,

View File

@@ -41,6 +41,15 @@ public interface ConnectionRecord {
* record. * record.
*/ */
public String getConnectionIdentifier(); public String getConnectionIdentifier();
/**
* Returns the name of the connection associated with this connection
* record.
*
* @return
* The name of the connection associated with this connection record.
*/
public String getConnectionName();
/** /**
* Returns the date and time the connection began. * Returns the date and time the connection began.

View File

@@ -37,6 +37,11 @@ public class APIConnectionRecord {
*/ */
private final String connectionIdentifier; private final String connectionIdentifier;
/**
* The identifier of the connection associated with this record.
*/
private final String connectionName;
/** /**
* The date and time the connection began. * The date and time the connection began.
*/ */
@@ -72,11 +77,12 @@ public class APIConnectionRecord {
*/ */
public APIConnectionRecord(ConnectionRecord record) { public APIConnectionRecord(ConnectionRecord record) {
this.connectionIdentifier = record.getConnectionIdentifier(); this.connectionIdentifier = record.getConnectionIdentifier();
this.startDate = record.getStartDate(); this.connectionName = record.getConnectionName();
this.endDate = record.getEndDate(); this.startDate = record.getStartDate();
this.remoteHost = record.getRemoteHost(); this.endDate = record.getEndDate();
this.username = record.getUsername(); this.remoteHost = record.getRemoteHost();
this.active = record.isActive(); this.username = record.getUsername();
this.active = record.isActive();
} }
/** /**
@@ -90,6 +96,16 @@ public class APIConnectionRecord {
return connectionIdentifier; return connectionIdentifier;
} }
/**
* Returns the name of the connection associated with this record.
*
* @return
* The name of the connection associated with this record.
*/
public String getConnectionName() {
return connectionName;
}
/** /**
* Returns the date and time the connection began. * Returns the date and time the connection began.
* *