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;
/**
* The name of the connection associated with this connection record.
*/
private String connectionName;
/**
* The database ID of the user associated with this connection record.
*/
@@ -82,6 +87,32 @@ public class ConnectionRecordModel {
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
* record.

View File

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

View File

@@ -169,6 +169,11 @@ public class ActiveConnectionRecord implements ConnectionRecord {
return connection.getIdentifier();
}
@Override
public String getConnectionName() {
return connection.getName();
}
@Override
public Date getStartDate() {
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.Directory;
import org.glyptodon.guacamole.net.auth.User;
import org.glyptodon.guacamole.net.auth.simple.SimpleConnectionRecordSet;
/**
* UserContext implementation which is driven by an arbitrary, underlying

View File

@@ -28,11 +28,12 @@
<!-- Result mapper for system permissions -->
<resultMap id="ConnectionRecordResultMap" type="org.glyptodon.guacamole.auth.jdbc.connection.ConnectionRecordModel">
<result column="connection_id" property="connectionIdentifier" jdbcType="INTEGER"/>
<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="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 -->
@@ -40,6 +41,7 @@
SELECT
connection_id,
connection_name,
guacamole_connection_history.user_id,
username,
start_date,
@@ -59,6 +61,7 @@
INSERT INTO guacamole_connection_history (
connection_id,
connection_name,
user_id,
start_date,
end_date
@@ -77,6 +80,7 @@
SELECT
guacamole_connection_history.connection_id,
guacamole_connection.connection_name,
guacamole_connection_history.user_id,
guacamole_user.username,
guacamole_connection_history.start_date,
@@ -140,6 +144,7 @@
SELECT
guacamole_connection_history.connection_id,
guacamole_connection.connection_name,
guacamole_connection_history.user_id,
guacamole_user.username,
guacamole_connection_history.start_date,

View File

@@ -28,11 +28,12 @@
<!-- Result mapper for system permissions -->
<resultMap id="ConnectionRecordResultMap" type="org.glyptodon.guacamole.auth.jdbc.connection.ConnectionRecordModel">
<result column="connection_id" property="connectionIdentifier" jdbcType="INTEGER"/>
<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="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 -->
@@ -40,6 +41,7 @@
SELECT
connection_id,
connection_name,
guacamole_connection_history.user_id,
username,
start_date,
@@ -59,6 +61,7 @@
INSERT INTO guacamole_connection_history (
connection_id,
connection_name,
user_id,
start_date,
end_date
@@ -77,6 +80,7 @@
SELECT
guacamole_connection_history.connection_id,
guacamole_connection.connection_name,
guacamole_connection_history.user_id,
guacamole_user.username,
guacamole_connection_history.start_date,
@@ -140,6 +144,7 @@
SELECT
guacamole_connection_history.connection_id,
guacamole_connection.connection_name,
guacamole_connection_history.user_id,
guacamole_user.username,
guacamole_connection_history.start_date,

View File

@@ -42,6 +42,15 @@ public interface ConnectionRecord {
*/
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.
*

View File

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