mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-30 16:43:22 +00:00 
			
		
		
		
	GUACAMOLE-52: Foreign keys in history table should be ON DELETE SET NULL. For sake of context, always store username and connection name in history table.
This commit is contained in:
		| @@ -37,17 +37,15 @@ | ||||
|     <select id="select" resultMap="ConnectionRecordResultMap"> | ||||
|  | ||||
|         SELECT | ||||
|             guacamole_connection.connection_id, | ||||
|             guacamole_connection.connection_name, | ||||
|             guacamole_user.user_id, | ||||
|             guacamole_user.username, | ||||
|             guacamole_connection_history.connection_id, | ||||
|             guacamole_connection_history.connection_name, | ||||
|             guacamole_connection_history.user_id, | ||||
|             guacamole_connection_history.username, | ||||
|             guacamole_connection_history.start_date, | ||||
|             guacamole_connection_history.end_date | ||||
|         FROM guacamole_connection_history | ||||
|         JOIN guacamole_connection ON guacamole_connection_history.connection_id = guacamole_connection.connection_id | ||||
|         JOIN guacamole_user ON guacamole_connection_history.user_id = guacamole_user.user_id | ||||
|         WHERE | ||||
|             guacamole_connection.connection_id = #{identifier,jdbcType=VARCHAR} | ||||
|             guacamole_connection_history.connection_id = #{identifier,jdbcType=VARCHAR} | ||||
|         ORDER BY | ||||
|             guacamole_connection_history.start_date DESC, | ||||
|             guacamole_connection_history.end_date DESC | ||||
| @@ -59,13 +57,18 @@ | ||||
|  | ||||
|         INSERT INTO guacamole_connection_history ( | ||||
|             connection_id, | ||||
|             connection_name, | ||||
|             user_id, | ||||
|             username, | ||||
|             start_date, | ||||
|             end_date | ||||
|         ) | ||||
|         VALUES ( | ||||
|             #{record.connectionIdentifier,jdbcType=VARCHAR}, | ||||
|             #{record.userID,jdbcType=INTEGER}, | ||||
|             #{record.connectionName,jdbcType=VARCHAR}, | ||||
|             (SELECT user_id FROM guacamole_user | ||||
|              WHERE username = #{record.username,jdbcType=VARCHAR}), | ||||
|             #{record.username,jdbcType=VARCHAR}, | ||||
|             #{record.startDate,jdbcType=TIMESTAMP}, | ||||
|             #{record.endDate,jdbcType=TIMESTAMP} | ||||
|         ) | ||||
| @@ -77,9 +80,9 @@ | ||||
|  | ||||
|         SELECT | ||||
|             guacamole_connection_history.connection_id, | ||||
|             guacamole_connection.connection_name, | ||||
|             guacamole_connection_history.connection_name, | ||||
|             guacamole_connection_history.user_id, | ||||
|             guacamole_user.username, | ||||
|             guacamole_connection_history.username, | ||||
|             guacamole_connection_history.start_date, | ||||
|             guacamole_connection_history.end_date | ||||
|         FROM guacamole_connection_history | ||||
| @@ -132,9 +135,9 @@ | ||||
|  | ||||
|         SELECT | ||||
|             guacamole_connection_history.connection_id, | ||||
|             guacamole_connection.connection_name, | ||||
|             guacamole_connection_history.connection_name, | ||||
|             guacamole_connection_history.user_id, | ||||
|             guacamole_user.username, | ||||
|             guacamole_connection_history.username, | ||||
|             guacamole_connection_history.start_date, | ||||
|             guacamole_connection_history.end_date | ||||
|         FROM guacamole_connection_history | ||||
|   | ||||
		Reference in New Issue
	
	Block a user