mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-462: Migrate user/connection record mappers to common base interface.
This commit is contained in:
@@ -37,36 +37,11 @@
|
||||
<result column="end_date" property="endDate" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- Select all connection records from a given connection -->
|
||||
<select id="select" resultMap="ConnectionRecordResultMap">
|
||||
|
||||
SELECT
|
||||
[guacamole_connection_history].history_id,
|
||||
[guacamole_connection_history].connection_id,
|
||||
[guacamole_connection_history].connection_name,
|
||||
[guacamole_connection_history].remote_host,
|
||||
[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,
|
||||
[guacamole_connection_history].end_date
|
||||
FROM [guacamole_connection_history]
|
||||
WHERE
|
||||
[guacamole_connection_history].connection_id = #{identifier,jdbcType=INTEGER}
|
||||
ORDER BY
|
||||
[guacamole_connection_history].start_date DESC,
|
||||
[guacamole_connection_history].end_date DESC
|
||||
|
||||
</select>
|
||||
|
||||
<!-- Update the given connection record, assigning an end date -->
|
||||
<update id="updateEndDate" parameterType="org.apache.guacamole.auth.jdbc.connection.ConnectionRecordModel">
|
||||
|
||||
UPDATE [guacamole_connection_history]
|
||||
SET end_date = #{record.endDate,jdbcType=TIMESTAMP}
|
||||
WHERE history_id = #{record.recordID,jdbcType=INTEGER}
|
||||
|
||||
</update>
|
||||
|
||||
<!-- Insert the given connection record -->
|
||||
|
@@ -33,27 +33,6 @@
|
||||
<result column="end_date" property="endDate" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- Select all user records from a given user -->
|
||||
<select id="select" resultMap="UserRecordResultMap">
|
||||
|
||||
SELECT
|
||||
[guacamole_user_history].history_id,
|
||||
[guacamole_user_history].remote_host,
|
||||
[guacamole_user_history].user_id,
|
||||
[guacamole_user_history].username,
|
||||
[guacamole_user_history].start_date,
|
||||
[guacamole_user_history].end_date
|
||||
FROM [guacamole_user_history]
|
||||
JOIN [guacamole_user] ON [guacamole_user_history].user_id = [guacamole_user].user_id
|
||||
JOIN [guacamole_entity] ON [guacamole_user].entity_id = [guacamole_entity].entity_id
|
||||
WHERE
|
||||
[guacamole_entity].name = #{username,jdbcType=VARCHAR}
|
||||
ORDER BY
|
||||
[guacamole_user_history].start_date DESC,
|
||||
[guacamole_user_history].end_date DESC
|
||||
|
||||
</select>
|
||||
|
||||
<!-- Insert the given user record -->
|
||||
<insert id="insert" useGeneratedKeys="true" keyProperty="record.recordID"
|
||||
parameterType="org.apache.guacamole.auth.jdbc.base.ActivityRecordModel">
|
||||
@@ -79,18 +58,10 @@
|
||||
|
||||
</insert>
|
||||
|
||||
<!-- Update the given user record -->
|
||||
<update id="update" parameterType="org.apache.guacamole.auth.jdbc.base.ActivityRecordModel">
|
||||
<!-- Update the given user record, assigning an end date -->
|
||||
<update id="updateEndDate" parameterType="org.apache.guacamole.auth.jdbc.base.ActivityRecordModel">
|
||||
UPDATE [guacamole_user_history]
|
||||
SET remote_host = #{record.remoteHost,jdbcType=VARCHAR},
|
||||
user_id = (SELECT user_id FROM [guacamole_user]
|
||||
JOIN [guacamole_entity] ON [guacamole_user].entity_id = [guacamole_entity].entity_id
|
||||
WHERE
|
||||
[guacamole_entity].name = #{record.username,jdbcType=VARCHAR}
|
||||
AND [guacamole_entity].type = 'USER'),
|
||||
username = #{record.username,jdbcType=VARCHAR},
|
||||
start_date = #{record.startDate,jdbcType=TIMESTAMP},
|
||||
end_date = #{record.endDate,jdbcType=TIMESTAMP}
|
||||
SET end_date = #{record.endDate,jdbcType=TIMESTAMP}
|
||||
WHERE history_id = #{record.recordID,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
@@ -109,8 +80,8 @@
|
||||
<!-- Search terms -->
|
||||
<where>
|
||||
|
||||
<if test="username != null">
|
||||
[guacamole_user_history].username = #{username,jdbcType=VARCHAR}
|
||||
<if test="identifier != null">
|
||||
[guacamole_user_history].username = #{identifier,jdbcType=VARCHAR}
|
||||
</if>
|
||||
|
||||
<foreach collection="terms" item="term" open=" AND " separator=" AND ">
|
||||
@@ -172,8 +143,8 @@
|
||||
</include>
|
||||
)
|
||||
|
||||
<if test="username != null">
|
||||
AND [guacamole_entity].name = #{username,jdbcType=VARCHAR}
|
||||
<if test="identifier != null">
|
||||
AND [guacamole_entity].name = #{identifier,jdbcType=VARCHAR}
|
||||
</if>
|
||||
|
||||
<foreach collection="terms" item="term" open=" AND " separator=" AND ">
|
||||
|
Reference in New Issue
Block a user