mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 00:53:21 +00:00 
			
		
		
		
	GUACAMOLE-394: Determine last active date for users based on history table.
This commit is contained in:
		| @@ -41,6 +41,7 @@ | ||||
|         <result column="email_address"       property="emailAddress"       jdbcType="VARCHAR"/> | ||||
|         <result column="organization"        property="organization"       jdbcType="VARCHAR"/> | ||||
|         <result column="organizational_role" property="organizationalRole" jdbcType="VARCHAR"/> | ||||
|         <result column="last_active"         property="lastActive"         jdbcType="TIMESTAMP"/> | ||||
|     </resultMap> | ||||
|  | ||||
|     <!-- Select all usernames --> | ||||
| @@ -63,8 +64,8 @@ | ||||
|     <select id="select" resultMap="UserResultMap"> | ||||
|  | ||||
|         SELECT | ||||
|             user_id, | ||||
|             username, | ||||
|             guacamole_user.user_id, | ||||
|             guacamole_user.username, | ||||
|             password_hash, | ||||
|             password_salt, | ||||
|             password_date, | ||||
| @@ -78,13 +79,16 @@ | ||||
|             full_name, | ||||
|             email_address, | ||||
|             organization, | ||||
|             organizational_role | ||||
|             organizational_role, | ||||
|             MAX(start_date) AS last_active | ||||
|         FROM guacamole_user | ||||
|         WHERE username IN | ||||
|         LEFT JOIN guacamole_user_history ON guacamole_user_history.user_id = guacamole_user.user_id | ||||
|         WHERE guacamole_user.username IN | ||||
|             <foreach collection="identifiers" item="identifier" | ||||
|                      open="(" separator="," close=")"> | ||||
|                 #{identifier,jdbcType=VARCHAR} | ||||
|             </foreach> | ||||
|         GROUP BY guacamole_user.user_id | ||||
|  | ||||
|     </select> | ||||
|  | ||||
| @@ -93,7 +97,7 @@ | ||||
|  | ||||
|         SELECT | ||||
|             guacamole_user.user_id, | ||||
|             username, | ||||
|             guacamole_user.username, | ||||
|             password_hash, | ||||
|             password_salt, | ||||
|             password_date, | ||||
| @@ -107,16 +111,19 @@ | ||||
|             full_name, | ||||
|             email_address, | ||||
|             organization, | ||||
|             organizational_role | ||||
|             organizational_role, | ||||
|             MAX(start_date) AS last_active | ||||
|         FROM guacamole_user | ||||
|         JOIN guacamole_user_permission ON affected_user_id = guacamole_user.user_id | ||||
|         WHERE username IN | ||||
|         LEFT JOIN guacamole_user_history ON guacamole_user_history.user_id = guacamole_user.user_id | ||||
|         WHERE guacamole_user.username IN | ||||
|             <foreach collection="identifiers" item="identifier" | ||||
|                      open="(" separator="," close=")"> | ||||
|                 #{identifier,jdbcType=VARCHAR} | ||||
|             </foreach> | ||||
|             AND guacamole_user_permission.user_id = #{user.objectID,jdbcType=INTEGER} | ||||
|             AND permission = 'READ' | ||||
|         GROUP BY guacamole_user.user_id | ||||
|  | ||||
|     </select> | ||||
|  | ||||
| @@ -124,8 +131,8 @@ | ||||
|     <select id="selectOne" resultMap="UserResultMap"> | ||||
|  | ||||
|         SELECT | ||||
|             user_id, | ||||
|             username, | ||||
|             guacamole_user.user_id, | ||||
|             guacamole_user.username, | ||||
|             password_hash, | ||||
|             password_salt, | ||||
|             password_date, | ||||
| @@ -139,10 +146,13 @@ | ||||
|             full_name, | ||||
|             email_address, | ||||
|             organization, | ||||
|             organizational_role | ||||
|             organizational_role, | ||||
|             MAX(start_date) AS last_active | ||||
|         FROM guacamole_user | ||||
|         LEFT JOIN guacamole_user_history ON guacamole_user_history.user_id = guacamole_user.user_id | ||||
|         WHERE | ||||
|             username = #{username,jdbcType=VARCHAR} | ||||
|             guacamole_user.username = #{username,jdbcType=VARCHAR} | ||||
|         GROUP BY guacamole_user.user_id | ||||
|  | ||||
|     </select> | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user