mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 09:03:21 +00:00 
			
		
		
		
	GUACAMOLE-1123: Add RecordMapper support for searching history limited by the identifier of a record.
This commit is contained in:
		| @@ -108,28 +108,35 @@ | ||||
|         LEFT JOIN guacamole_user       ON guacamole_connection_history.user_id       = guacamole_user.user_id | ||||
|  | ||||
|         <!-- Search terms --> | ||||
|         <foreach collection="terms" item="term" | ||||
|                  open="WHERE " separator=" AND "> | ||||
|             ( | ||||
|         <where> | ||||
|              | ||||
|             <if test="identifier != null"> | ||||
|                 guacamole_connection_history.connection_id = #{identifier,jdbcType=VARCHAR} | ||||
|             </if> | ||||
|              | ||||
|             <foreach collection="terms" item="term" open=" AND " separator=" AND "> | ||||
|                 ( | ||||
|  | ||||
|                     guacamole_connection_history.user_id IN ( | ||||
|                         SELECT user_id | ||||
|                         FROM guacamole_user | ||||
|                         WHERE POSITION(#{term.term,jdbcType=VARCHAR} IN username) > 0 | ||||
|                     ) | ||||
|  | ||||
|                     OR guacamole_connection_history.connection_id IN ( | ||||
|                         SELECT connection_id | ||||
|                         FROM guacamole_connection | ||||
|                         WHERE POSITION(#{term.term,jdbcType=VARCHAR} IN connection_name) > 0 | ||||
|                     ) | ||||
|  | ||||
|                     <if test="term.startDate != null and term.endDate != null"> | ||||
|                         OR start_date BETWEEN #{term.startDate,jdbcType=TIMESTAMP} AND #{term.endDate,jdbcType=TIMESTAMP} | ||||
|                     </if> | ||||
|  | ||||
|                 guacamole_connection_history.user_id IN ( | ||||
|                     SELECT user_id | ||||
|                     FROM guacamole_user | ||||
|                     WHERE POSITION(#{term.term,jdbcType=VARCHAR} IN username) > 0 | ||||
|                 ) | ||||
|  | ||||
|                 OR guacamole_connection_history.connection_id IN ( | ||||
|                     SELECT connection_id | ||||
|                     FROM guacamole_connection | ||||
|                     WHERE POSITION(#{term.term,jdbcType=VARCHAR} IN connection_name) > 0 | ||||
|                 ) | ||||
|  | ||||
|                 <if test="term.startDate != null and term.endDate != null"> | ||||
|                     OR start_date BETWEEN #{term.startDate,jdbcType=TIMESTAMP} AND #{term.endDate,jdbcType=TIMESTAMP} | ||||
|                 </if> | ||||
|  | ||||
|             ) | ||||
|         </foreach> | ||||
|             </foreach> | ||||
|              | ||||
|         </where> | ||||
|  | ||||
|         <!-- Bind sort property enum values for sake of readability --> | ||||
|         <bind name="START_DATE" value="@org.apache.guacamole.net.auth.ActivityRecordSet$SortableProperty@START_DATE"/> | ||||
| @@ -186,31 +193,38 @@ | ||||
|             AND guacamole_user_permission.permission = 'READ' | ||||
|  | ||||
|         <!-- Search terms --> | ||||
|         <foreach collection="terms" item="term" | ||||
|                  open="WHERE " separator=" AND "> | ||||
|             ( | ||||
|         <where> | ||||
|              | ||||
|             <if test="identifier != null"> | ||||
|                 guacamole_connection_history.connection_id = #{identifier,jdbcType=VARCHAR} | ||||
|             </if> | ||||
|              | ||||
|             <foreach collection="terms" item="term" open=" AND " separator=" AND "> | ||||
|                 ( | ||||
|  | ||||
|                     guacamole_connection_history.user_id IN ( | ||||
|                         SELECT user_id | ||||
|                         FROM guacamole_user | ||||
|                         JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id | ||||
|                         WHERE | ||||
|                                 POSITION(#{term.term,jdbcType=VARCHAR} IN guacamole_entity.name) > 0 | ||||
|                             AND guacamole_entity.type = 'USER' | ||||
|                     ) | ||||
|  | ||||
|                     OR guacamole_connection_history.connection_id IN ( | ||||
|                         SELECT connection_id | ||||
|                         FROM guacamole_connection | ||||
|                         WHERE POSITION(#{term.term,jdbcType=VARCHAR} IN connection_name) > 0 | ||||
|                     ) | ||||
|  | ||||
|                     <if test="term.startDate != null and term.endDate != null"> | ||||
|                         OR start_date BETWEEN #{term.startDate,jdbcType=TIMESTAMP} AND #{term.endDate,jdbcType=TIMESTAMP} | ||||
|                     </if> | ||||
|  | ||||
|                 guacamole_connection_history.user_id IN ( | ||||
|                     SELECT user_id | ||||
|                     FROM guacamole_user | ||||
|                     JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id | ||||
|                     WHERE | ||||
|                             POSITION(#{term.term,jdbcType=VARCHAR} IN guacamole_entity.name) > 0 | ||||
|                         AND guacamole_entity.type = 'USER' | ||||
|                 ) | ||||
|  | ||||
|                 OR guacamole_connection_history.connection_id IN ( | ||||
|                     SELECT connection_id | ||||
|                     FROM guacamole_connection | ||||
|                     WHERE POSITION(#{term.term,jdbcType=VARCHAR} IN connection_name) > 0 | ||||
|                 ) | ||||
|  | ||||
|                 <if test="term.startDate != null and term.endDate != null"> | ||||
|                     OR start_date BETWEEN #{term.startDate,jdbcType=TIMESTAMP} AND #{term.endDate,jdbcType=TIMESTAMP} | ||||
|                 </if> | ||||
|  | ||||
|             ) | ||||
|         </foreach> | ||||
|             </foreach> | ||||
|          | ||||
|         </where> | ||||
|  | ||||
|         <!-- Bind sort property enum values for sake of readability --> | ||||
|         <bind name="START_DATE" value="@org.apache.guacamole.net.auth.ActivityRecordSet$SortableProperty@START_DATE"/> | ||||
|   | ||||
| @@ -105,25 +105,32 @@ | ||||
|         FROM guacamole_user_history | ||||
|  | ||||
|         <!-- Search terms --> | ||||
|         <foreach collection="terms" item="term" | ||||
|                  open="WHERE " separator=" AND "> | ||||
|             ( | ||||
|         <where> | ||||
|              | ||||
|             <if test="username != null"> | ||||
|                 guacamole_user_history.username = #{username,jdbcType=VARCHAR} | ||||
|             </if> | ||||
|              | ||||
|             <foreach collection="terms" item="term" open=" AND " separator=" AND "> | ||||
|                 ( | ||||
|  | ||||
|                     guacamole_user_history.user_id IN ( | ||||
|                         SELECT user_id | ||||
|                         FROM guacamole_user | ||||
|                         JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id | ||||
|                         WHERE | ||||
|                                 POSITION(#{term.term,jdbcType=VARCHAR} IN guacamole_entity.name) > 0 | ||||
|                             AND guacamole_entity.type = 'USER'), | ||||
|                     ) | ||||
|  | ||||
|                     <if test="term.startDate != null and term.endDate != null"> | ||||
|                         OR start_date BETWEEN #{term.startDate,jdbcType=TIMESTAMP} AND #{term.endDate,jdbcType=TIMESTAMP} | ||||
|                     </if> | ||||
|  | ||||
|                 guacamole_user_history.user_id IN ( | ||||
|                     SELECT user_id | ||||
|                     FROM guacamole_user | ||||
|                     JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id | ||||
|                     WHERE | ||||
|                             POSITION(#{term.term,jdbcType=VARCHAR} IN guacamole_entity.name) > 0 | ||||
|                         AND guacamole_entity.type = 'USER'), | ||||
|                 ) | ||||
|  | ||||
|                 <if test="term.startDate != null and term.endDate != null"> | ||||
|                     OR start_date BETWEEN #{term.startDate,jdbcType=TIMESTAMP} AND #{term.endDate,jdbcType=TIMESTAMP} | ||||
|                 </if> | ||||
|  | ||||
|             ) | ||||
|         </foreach> | ||||
|             </foreach> | ||||
|              | ||||
|         </where> | ||||
|  | ||||
|         <!-- Bind sort property enum values for sake of readability --> | ||||
|         <bind name="START_DATE" value="@org.apache.guacamole.net.auth.ActivityRecordSet$SortableProperty@START_DATE"/> | ||||
| @@ -164,25 +171,32 @@ | ||||
|             AND guacamole_user_permission.permission = 'READ' | ||||
|  | ||||
|         <!-- Search terms --> | ||||
|         <foreach collection="terms" item="term" | ||||
|                  open="WHERE " separator=" AND "> | ||||
|             ( | ||||
|         <where> | ||||
|              | ||||
|             <if test="username != null"> | ||||
|                 guacamole_entity.name = #{username,jdbcType=VARCHAR} | ||||
|             </if> | ||||
|              | ||||
|             <foreach collection="terms" item="term" open=" AND " separator=" AND "> | ||||
|                 ( | ||||
|  | ||||
|                     guacamole_user_history.user_id IN ( | ||||
|                         SELECT user_id | ||||
|                         FROM guacamole_user | ||||
|                         JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id | ||||
|                         WHERE | ||||
|                                 POSITION(#{term.term,jdbcType=VARCHAR} IN guacamole_entity.name) > 0 | ||||
|                             AND guacamole_entity.type = 'USER' | ||||
|                     ) | ||||
|  | ||||
|                     <if test="term.startDate != null and term.endDate != null"> | ||||
|                         OR start_date BETWEEN #{term.startDate,jdbcType=TIMESTAMP} AND #{term.endDate,jdbcType=TIMESTAMP} | ||||
|                     </if> | ||||
|  | ||||
|                 guacamole_user_history.user_id IN ( | ||||
|                     SELECT user_id | ||||
|                     FROM guacamole_user | ||||
|                     JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id | ||||
|                     WHERE | ||||
|                             POSITION(#{term.term,jdbcType=VARCHAR} IN guacamole_entity.name) > 0 | ||||
|                         AND guacamole_entity.type = 'USER' | ||||
|                 ) | ||||
|  | ||||
|                 <if test="term.startDate != null and term.endDate != null"> | ||||
|                     OR start_date BETWEEN #{term.startDate,jdbcType=TIMESTAMP} AND #{term.endDate,jdbcType=TIMESTAMP} | ||||
|                 </if> | ||||
|  | ||||
|             ) | ||||
|         </foreach> | ||||
|             </foreach> | ||||
|              | ||||
|         </where> | ||||
|  | ||||
|         <!-- Bind sort property enum values for sake of readability --> | ||||
|         <bind name="START_DATE" value="@org.apache.guacamole.net.auth.ActivityRecordSet$SortableProperty@START_DATE"/> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user