mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 17:13:21 +00:00 
			
		
		
		
	GUACAMOLE-1239: Add case-sensitivity configuration for UserGroup objects and remove per-extension configuration.
This commit is contained in:
		| @@ -51,11 +51,23 @@ | ||||
|                     JOIN guacamole_user_group ON guacamole_user_group.entity_id = guacamole_entity.entity_id | ||||
|                     WHERE | ||||
|                         type = 'USER_GROUP'::guacamole_entity_type | ||||
|                         AND name IN | ||||
|                             <foreach collection="${groups}" item="effectiveGroup" | ||||
|                                      open="(" separator="," close=")"> | ||||
|                                 #{effectiveGroup,jdbcType=VARCHAR} | ||||
|                             </foreach> | ||||
|                         AND  | ||||
|                         <choose> | ||||
|                             <when test="caseSensitivity.caseSensitiveGroupNames()"> | ||||
|                                 name IN | ||||
|                                 <foreach collection="${groups}" item="effectiveGroup" | ||||
|                                          open="(" separator="," close=")"> | ||||
|                                     #{effectiveGroup,jdbcType=VARCHAR} | ||||
|                                 </foreach> | ||||
|                             </when> | ||||
|                             <otherwise> | ||||
|                                 LOWER(name) IN | ||||
|                                 <foreach collection="${groups}" item="effectiveGroup" | ||||
|                                          open="(" separator="," close=")"> | ||||
|                                     LOWER(#{effectiveGroup,jdbcType=VARCHAR}) | ||||
|                                 </foreach> | ||||
|                             </otherwise> | ||||
|                         </choose> | ||||
|                         AND disabled = false | ||||
|                 ) | ||||
|             </if> | ||||
| @@ -81,11 +93,23 @@ | ||||
|                     JOIN guacamole_user_group ON guacamole_user_group.entity_id = guacamole_entity.entity_id | ||||
|                     WHERE | ||||
|                         type = 'USER_GROUP'::guacamole_entity_type | ||||
|                         AND name IN | ||||
|                             <foreach collection="effectiveGroups" item="effectiveGroup" | ||||
|                                      open="(" separator="," close=")"> | ||||
|                                 #{effectiveGroup,jdbcType=VARCHAR} | ||||
|                             </foreach> | ||||
|                         AND  | ||||
|                         <choose> | ||||
|                             <when test="caseSensitivity.caseSensitiveGroupNames()"> | ||||
|                                 name IN | ||||
|                                 <foreach collection="effectiveGroups" item="effectiveGroup" | ||||
|                                          open="(" separator="," close=")"> | ||||
|                                     #{effectiveGroup,jdbcType=VARCHAR} | ||||
|                                 </foreach> | ||||
|                             </when> | ||||
|                             <otherwise> | ||||
|                                 LOWER(name) IN | ||||
|                                 <foreach collection="effectiveGroups" item="effectiveGroup" | ||||
|                                          open="(" separator="," close=")"> | ||||
|                                     LOWER(#{effectiveGroup,jdbcType=VARCHAR}) | ||||
|                                 </foreach> | ||||
|                             </otherwise> | ||||
|                         </choose> | ||||
|                         AND guacamole_user_group.disabled = false | ||||
|             </if> | ||||
|             UNION | ||||
|   | ||||
| @@ -82,9 +82,10 @@ | ||||
|         FROM guacamole_connection_permission | ||||
|         WHERE | ||||
|             <include refid="org.apache.guacamole.auth.jdbc.base.EntityMapper.isRelatedEntity"> | ||||
|                 <property name="column"   value="entity_id"/> | ||||
|                 <property name="entityID" value="${entityID}"/> | ||||
|                 <property name="groups"   value="${groups}"/> | ||||
|                 <property name="column"          value="entity_id"/> | ||||
|                 <property name="entityID"        value="${entityID}"/> | ||||
|                 <property name="groups"          value="${groups}"/> | ||||
|                 <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|             </include> | ||||
|             AND permission = 'READ' | ||||
|     </sql> | ||||
| @@ -92,8 +93,9 @@ | ||||
|     <!-- Select identifiers of all readable connections --> | ||||
|     <select id="selectReadableIdentifiers" resultType="string"> | ||||
|         <include refid="org.apache.guacamole.auth.jdbc.connection.ConnectionMapper.getReadableIDs"> | ||||
|             <property name="entityID" value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|             <property name="groups"   value="effectiveGroups"/> | ||||
|             <property name="entityID"        value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|             <property name="groups"          value="effectiveGroups"/> | ||||
|             <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|         </include> | ||||
|     </select> | ||||
|  | ||||
| @@ -115,8 +117,9 @@ | ||||
|             <if test="parentIdentifier == null">parent_id IS NULL</if> | ||||
|             AND connection_id IN ( | ||||
|                 <include refid="org.apache.guacamole.auth.jdbc.connection.ConnectionMapper.getReadableIDs"> | ||||
|                     <property name="entityID" value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"   value="effectiveGroups"/> | ||||
|                     <property name="entityID"        value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"          value="effectiveGroups"/> | ||||
|                     <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|                 </include> | ||||
|             ) | ||||
|     </select> | ||||
| @@ -194,8 +197,9 @@ | ||||
|             </foreach> | ||||
|             AND guacamole_connection.connection_id IN ( | ||||
|                 <include refid="org.apache.guacamole.auth.jdbc.connection.ConnectionMapper.getReadableIDs"> | ||||
|                     <property name="entityID" value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"   value="effectiveGroups"/> | ||||
|                     <property name="entityID"        value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"          value="effectiveGroups"/> | ||||
|                     <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|                 </include> | ||||
|             ) | ||||
|         GROUP BY guacamole_connection.connection_id; | ||||
| @@ -209,8 +213,9 @@ | ||||
|             </foreach> | ||||
|             AND guacamole_sharing_profile.sharing_profile_id IN ( | ||||
|                 <include refid="org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileMapper.getReadableIDs"> | ||||
|                     <property name="entityID" value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"   value="effectiveGroups"/> | ||||
|                     <property name="entityID"        value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"          value="effectiveGroups"/> | ||||
|                     <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|                 </include> | ||||
|             ); | ||||
|  | ||||
| @@ -226,8 +231,9 @@ | ||||
|             </foreach> | ||||
|             AND guacamole_connection_attribute.connection_id IN ( | ||||
|                 <include refid="org.apache.guacamole.auth.jdbc.connection.ConnectionMapper.getReadableIDs"> | ||||
|                     <property name="entityID" value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"   value="effectiveGroups"/> | ||||
|                     <property name="entityID"        value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"          value="effectiveGroups"/> | ||||
|                     <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|                 </include> | ||||
|             ); | ||||
|  | ||||
|   | ||||
| @@ -62,7 +62,7 @@ | ||||
|              JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id | ||||
|              WHERE | ||||
|                 <choose> | ||||
|                     <when test="caseSensitive"> | ||||
|                     <when test="caseSensitivity.caseSensitiveUsernames()"> | ||||
|                         guacamole_entity.name = #{record.username,jdbcType=VARCHAR} | ||||
|                     </when> | ||||
|                     <otherwise> | ||||
| @@ -119,7 +119,7 @@ | ||||
|                         FROM guacamole_user | ||||
|                     WHERE | ||||
|                         <choose> | ||||
|                             <when test="caseSensitive"> | ||||
|                             <when test="caseSensitivity.caseSensitiveUsernames()"> | ||||
|                                 POSITION(#{term.term,jdbcType=VARCHAR} IN username) > 0 | ||||
|                             </when> | ||||
|                             <otherwise> | ||||
| @@ -188,16 +188,18 @@ | ||||
|             <!-- Restrict to readable connections --> | ||||
|             AND guacamole_connection_history.connection_id IN ( | ||||
|                 <include refid="org.apache.guacamole.auth.jdbc.connection.ConnectionMapper.getReadableIDs"> | ||||
|                     <property name="entityID" value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"   value="effectiveGroups"/> | ||||
|                     <property name="entityID"        value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"          value="effectiveGroups"/> | ||||
|                     <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|                 </include> | ||||
|             ) | ||||
|  | ||||
|             <!-- Restrict to readable users --> | ||||
|             AND guacamole_connection_history.user_id IN ( | ||||
|                 <include refid="org.apache.guacamole.auth.jdbc.user.UserMapper.getReadableIDs"> | ||||
|                     <property name="entityID" value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"   value="effectiveGroups"/> | ||||
|                     <property name="entityID"        value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"          value="effectiveGroups"/> | ||||
|                     <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|                 </include> | ||||
|             ) | ||||
|  | ||||
| @@ -214,7 +216,7 @@ | ||||
|                         JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id | ||||
|                         WHERE | ||||
|                             <choose> | ||||
|                                 <when test="caseSensitive"> | ||||
|                                 <when test="caseSensitivity.caseSensitiveUsernames()"> | ||||
|                                     POSITION(#{term.term,jdbcType=VARCHAR} IN guacamole_entity.name) > 0 | ||||
|                                 </when> | ||||
|                                 <otherwise> | ||||
|   | ||||
| @@ -83,9 +83,10 @@ | ||||
|         FROM guacamole_connection_group_permission | ||||
|         WHERE | ||||
|             <include refid="org.apache.guacamole.auth.jdbc.base.EntityMapper.isRelatedEntity"> | ||||
|                 <property name="column"   value="entity_id"/> | ||||
|                 <property name="entityID" value="${entityID}"/> | ||||
|                 <property name="groups"   value="${groups}"/> | ||||
|                 <property name="column"          value="entity_id"/> | ||||
|                 <property name="entityID"        value="${entityID}"/> | ||||
|                 <property name="groups"          value="${groups}"/> | ||||
|                 <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|             </include> | ||||
|             AND permission = 'READ' | ||||
|     </sql> | ||||
| @@ -93,8 +94,9 @@ | ||||
|     <!-- Select identifiers of all readable connection groups --> | ||||
|     <select id="selectReadableIdentifiers" resultType="string"> | ||||
|         <include refid="org.apache.guacamole.auth.jdbc.connectiongroup.ConnectionGroupMapper.getReadableIDs"> | ||||
|             <property name="entityID" value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|             <property name="groups"   value="effectiveGroups"/> | ||||
|             <property name="entityID"        value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|             <property name="groups"          value="effectiveGroups"/> | ||||
|             <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|         </include> | ||||
|     </select> | ||||
|  | ||||
| @@ -116,8 +118,9 @@ | ||||
|             <if test="parentIdentifier == null">parent_id IS NULL</if> | ||||
|             AND connection_group_id IN ( | ||||
|                 <include refid="org.apache.guacamole.auth.jdbc.connectiongroup.ConnectionGroupMapper.getReadableIDs"> | ||||
|                     <property name="entityID" value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"   value="effectiveGroups"/> | ||||
|                     <property name="entityID"        value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"          value="effectiveGroups"/> | ||||
|                     <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|                 </include> | ||||
|             ) | ||||
|     </select> | ||||
| @@ -190,8 +193,9 @@ | ||||
|             </foreach> | ||||
|             AND guacamole_connection_group.connection_group_id IN ( | ||||
|                 <include refid="org.apache.guacamole.auth.jdbc.connectiongroup.ConnectionGroupMapper.getReadableIDs"> | ||||
|                     <property name="entityID" value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"   value="effectiveGroups"/> | ||||
|                     <property name="entityID"        value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"          value="effectiveGroups"/> | ||||
|                     <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|                 </include> | ||||
|             ); | ||||
|  | ||||
| @@ -204,8 +208,9 @@ | ||||
|             </foreach> | ||||
|             AND guacamole_connection_group.connection_group_id IN ( | ||||
|                 <include refid="org.apache.guacamole.auth.jdbc.connectiongroup.ConnectionGroupMapper.getReadableIDs"> | ||||
|                     <property name="entityID" value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"   value="effectiveGroups"/> | ||||
|                     <property name="entityID"        value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"          value="effectiveGroups"/> | ||||
|                     <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|                 </include> | ||||
|             ); | ||||
|  | ||||
| @@ -218,8 +223,9 @@ | ||||
|             </foreach> | ||||
|             AND guacamole_connection.connection_id IN ( | ||||
|                 <include refid="org.apache.guacamole.auth.jdbc.connection.ConnectionMapper.getReadableIDs"> | ||||
|                     <property name="entityID" value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"   value="effectiveGroups"/> | ||||
|                     <property name="entityID"        value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"          value="effectiveGroups"/> | ||||
|                     <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|                 </include> | ||||
|             ); | ||||
|  | ||||
| @@ -235,8 +241,9 @@ | ||||
|             </foreach> | ||||
|             AND guacamole_connection_group_attribute.connection_group_id IN ( | ||||
|                 <include refid="org.apache.guacamole.auth.jdbc.connectiongroup.ConnectionGroupMapper.getReadableIDs"> | ||||
|                     <property name="entityID" value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"   value="effectiveGroups"/> | ||||
|                     <property name="entityID"        value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"          value="effectiveGroups"/> | ||||
|                     <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|                 </include> | ||||
|             ); | ||||
|  | ||||
|   | ||||
| @@ -41,9 +41,10 @@ | ||||
|         FROM guacamole_connection_group_permission | ||||
|         WHERE | ||||
|             <include refid="org.apache.guacamole.auth.jdbc.base.EntityMapper.isRelatedEntity"> | ||||
|                 <property name="column"   value="entity_id"/> | ||||
|                 <property name="entityID" value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"   value="effectiveGroups"/> | ||||
|                 <property name="column"          value="entity_id"/> | ||||
|                 <property name="entityID"        value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"          value="effectiveGroups"/> | ||||
|                 <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|             </include> | ||||
|  | ||||
|     </select> | ||||
| @@ -58,9 +59,10 @@ | ||||
|         FROM guacamole_connection_group_permission | ||||
|         WHERE | ||||
|             <include refid="org.apache.guacamole.auth.jdbc.base.EntityMapper.isRelatedEntity"> | ||||
|                 <property name="column"   value="entity_id"/> | ||||
|                 <property name="entityID" value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"   value="effectiveGroups"/> | ||||
|                 <property name="column"          value="entity_id"/> | ||||
|                 <property name="entityID"        value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"          value="effectiveGroups"/> | ||||
|                 <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|             </include> | ||||
|             AND permission = #{type,jdbcType=VARCHAR}::guacamole_object_permission_type | ||||
|             AND connection_group_id = #{identifier,jdbcType=INTEGER}::integer | ||||
| @@ -74,9 +76,10 @@ | ||||
|         FROM guacamole_connection_group_permission | ||||
|         WHERE | ||||
|             <include refid="org.apache.guacamole.auth.jdbc.base.EntityMapper.isRelatedEntity"> | ||||
|                 <property name="column"   value="entity_id"/> | ||||
|                 <property name="entityID" value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"   value="effectiveGroups"/> | ||||
|                 <property name="column"          value="entity_id"/> | ||||
|                 <property name="entityID"        value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"          value="effectiveGroups"/> | ||||
|                 <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|             </include> | ||||
|             AND connection_group_id IN | ||||
|                 <foreach collection="identifiers" item="identifier" | ||||
|   | ||||
| @@ -41,9 +41,10 @@ | ||||
|         FROM guacamole_connection_permission | ||||
|         WHERE | ||||
|             <include refid="org.apache.guacamole.auth.jdbc.base.EntityMapper.isRelatedEntity"> | ||||
|                 <property name="column"   value="entity_id"/> | ||||
|                 <property name="entityID" value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"   value="effectiveGroups"/> | ||||
|                 <property name="column"          value="entity_id"/> | ||||
|                 <property name="entityID"        value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"          value="effectiveGroups"/> | ||||
|                 <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|             </include> | ||||
|  | ||||
|     </select> | ||||
| @@ -58,9 +59,10 @@ | ||||
|         FROM guacamole_connection_permission | ||||
|         WHERE | ||||
|             <include refid="org.apache.guacamole.auth.jdbc.base.EntityMapper.isRelatedEntity"> | ||||
|                 <property name="column"   value="entity_id"/> | ||||
|                 <property name="entityID" value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"   value="effectiveGroups"/> | ||||
|                 <property name="column"          value="entity_id"/> | ||||
|                 <property name="entityID"        value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"          value="effectiveGroups"/> | ||||
|                 <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|             </include> | ||||
|             AND permission = #{type,jdbcType=VARCHAR}::guacamole_object_permission_type | ||||
|             AND connection_id = #{identifier,jdbcType=INTEGER}::integer | ||||
| @@ -74,9 +76,10 @@ | ||||
|         FROM guacamole_connection_permission | ||||
|         WHERE | ||||
|             <include refid="org.apache.guacamole.auth.jdbc.base.EntityMapper.isRelatedEntity"> | ||||
|                 <property name="column"   value="entity_id"/> | ||||
|                 <property name="entityID" value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"   value="effectiveGroups"/> | ||||
|                 <property name="column"          value="entity_id"/> | ||||
|                 <property name="entityID"        value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"          value="effectiveGroups"/> | ||||
|                 <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|             </include> | ||||
|             AND connection_id IN | ||||
|                 <foreach collection="identifiers" item="identifier" | ||||
|   | ||||
| @@ -41,9 +41,10 @@ | ||||
|         FROM guacamole_sharing_profile_permission | ||||
|         WHERE | ||||
|             <include refid="org.apache.guacamole.auth.jdbc.base.EntityMapper.isRelatedEntity"> | ||||
|                 <property name="column"   value="entity_id"/> | ||||
|                 <property name="entityID" value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"   value="effectiveGroups"/> | ||||
|                 <property name="column"          value="entity_id"/> | ||||
|                 <property name="entityID"        value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"          value="effectiveGroups"/> | ||||
|                 <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|             </include> | ||||
|  | ||||
|     </select> | ||||
| @@ -58,9 +59,10 @@ | ||||
|         FROM guacamole_sharing_profile_permission | ||||
|         WHERE | ||||
|             <include refid="org.apache.guacamole.auth.jdbc.base.EntityMapper.isRelatedEntity"> | ||||
|                 <property name="column"   value="entity_id"/> | ||||
|                 <property name="entityID" value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"   value="effectiveGroups"/> | ||||
|                 <property name="column"          value="entity_id"/> | ||||
|                 <property name="entityID"        value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"          value="effectiveGroups"/> | ||||
|                 <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|             </include> | ||||
|             AND permission = #{type,jdbcType=VARCHAR}::guacamole_object_permission_type | ||||
|             AND sharing_profile_id = #{identifier,jdbcType=INTEGER}::integer | ||||
| @@ -74,9 +76,10 @@ | ||||
|         FROM guacamole_sharing_profile_permission | ||||
|         WHERE | ||||
|             <include refid="org.apache.guacamole.auth.jdbc.base.EntityMapper.isRelatedEntity"> | ||||
|                 <property name="column"   value="entity_id"/> | ||||
|                 <property name="entityID" value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"   value="effectiveGroups"/> | ||||
|                 <property name="column"          value="entity_id"/> | ||||
|                 <property name="entityID"        value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"          value="effectiveGroups"/> | ||||
|                 <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|             </include> | ||||
|             AND sharing_profile_id IN | ||||
|                 <foreach collection="identifiers" item="identifier" | ||||
|   | ||||
| @@ -39,9 +39,10 @@ | ||||
|         FROM guacamole_system_permission | ||||
|         WHERE | ||||
|             <include refid="org.apache.guacamole.auth.jdbc.base.EntityMapper.isRelatedEntity"> | ||||
|                 <property name="column"   value="entity_id"/> | ||||
|                 <property name="entityID" value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"   value="effectiveGroups"/> | ||||
|                 <property name="column"          value="entity_id"/> | ||||
|                 <property name="entityID"        value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"          value="effectiveGroups"/> | ||||
|                 <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|             </include> | ||||
|  | ||||
|     </select> | ||||
| @@ -55,9 +56,10 @@ | ||||
|         FROM guacamole_system_permission | ||||
|         WHERE | ||||
|             <include refid="org.apache.guacamole.auth.jdbc.base.EntityMapper.isRelatedEntity"> | ||||
|                 <property name="column"   value="entity_id"/> | ||||
|                 <property name="entityID" value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"   value="effectiveGroups"/> | ||||
|                 <property name="column"          value="entity_id"/> | ||||
|                 <property name="entityID"        value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"          value="effectiveGroups"/> | ||||
|                 <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|             </include> | ||||
|             AND permission = #{type,jdbcType=VARCHAR}::guacamole_system_permission_type | ||||
|  | ||||
|   | ||||
| @@ -43,9 +43,10 @@ | ||||
|         JOIN guacamole_entity affected_entity ON affected_group.entity_id = affected_entity.entity_id | ||||
|         WHERE | ||||
|             <include refid="org.apache.guacamole.auth.jdbc.base.EntityMapper.isRelatedEntity"> | ||||
|                 <property name="column"   value="guacamole_user_group_permission.entity_id"/> | ||||
|                 <property name="entityID" value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"   value="effectiveGroups"/> | ||||
|                 <property name="column"          value="guacamole_user_group_permission.entity_id"/> | ||||
|                 <property name="entityID"        value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"          value="effectiveGroups"/> | ||||
|                 <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|             </include> | ||||
|             AND affected_entity.type = 'USER_GROUP'::guacamole_entity_type | ||||
|  | ||||
| @@ -63,13 +64,22 @@ | ||||
|         JOIN guacamole_entity affected_entity ON affected_group.entity_id = affected_entity.entity_id | ||||
|         WHERE | ||||
|             <include refid="org.apache.guacamole.auth.jdbc.base.EntityMapper.isRelatedEntity"> | ||||
|                 <property name="column"   value="guacamole_user_group_permission.entity_id"/> | ||||
|                 <property name="entityID" value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"   value="effectiveGroups"/> | ||||
|                 <property name="column"          value="guacamole_user_group_permission.entity_id"/> | ||||
|                 <property name="entityID"        value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"          value="effectiveGroups"/> | ||||
|                 <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|             </include> | ||||
|             AND permission = #{type,jdbcType=VARCHAR}::guacamole_object_permission_type | ||||
|             AND affected_entity.name = #{identifier,jdbcType=VARCHAR} | ||||
|             AND affected_entity.type = 'USER_GROUP'::guacamole_entity_type | ||||
|             AND | ||||
|             <choose> | ||||
|                 <when test="caseSensitivity.caseSensitiveGroupNames()"> | ||||
|                     affected_entity.name = #{identifier,jdbcType=VARCHAR} | ||||
|                 </when> | ||||
|                 <otherwise> | ||||
|                     LOWER(affected_entity.name) = LOWER(#{identifier,jdbcType=VARCHAR}) | ||||
|                 </otherwise> | ||||
|             </choose> | ||||
|  | ||||
|     </select> | ||||
|  | ||||
| @@ -82,21 +92,34 @@ | ||||
|         JOIN guacamole_entity affected_entity ON affected_group.entity_id = affected_entity.entity_id | ||||
|         WHERE | ||||
|             <include refid="org.apache.guacamole.auth.jdbc.base.EntityMapper.isRelatedEntity"> | ||||
|                 <property name="column"   value="guacamole_user_group_permission.entity_id"/> | ||||
|                 <property name="entityID" value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"   value="effectiveGroups"/> | ||||
|                 <property name="column"          value="guacamole_user_group_permission.entity_id"/> | ||||
|                 <property name="entityID"        value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"          value="effectiveGroups"/> | ||||
|                 <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|             </include> | ||||
|             AND affected_entity.name IN | ||||
|                 <foreach collection="identifiers" item="identifier" | ||||
|                          open="(" separator="," close=")"> | ||||
|                     #{identifier,jdbcType=VARCHAR} | ||||
|                 </foreach> | ||||
|             AND affected_entity.type = 'USER_GROUP'::guacamole_entity_type | ||||
|             AND | ||||
|             <choose> | ||||
|                 <when test="caseSensitivity.caseSensitiveGroupNames()"> | ||||
|                     affected_entity.name IN | ||||
|                     <foreach collection="identifiers" item="identifier" | ||||
|                              open="(" separator="," close=")"> | ||||
|                         #{identifier,jdbcType=VARCHAR} | ||||
|                     </foreach> | ||||
|                 </when> | ||||
|                 <otherwise> | ||||
|                     LOWER(affected_entity.name) IN | ||||
|                     <foreach collection="identifiers" item="identifier" | ||||
|                              open="(" separator="," close=")"> | ||||
|                         LOWER(#{identifier,jdbcType=VARCHAR}) | ||||
|                     </foreach> | ||||
|                 </otherwise> | ||||
|             </choose> | ||||
|             AND permission IN | ||||
|                 <foreach collection="permissions" item="permission" | ||||
|                          open="(" separator="," close=")"> | ||||
|                     #{permission,jdbcType=VARCHAR}::guacamole_object_permission_type | ||||
|                 </foreach> | ||||
|             AND affected_entity.type = 'USER_GROUP'::guacamole_entity_type | ||||
|  | ||||
|     </select> | ||||
|  | ||||
| @@ -108,12 +131,29 @@ | ||||
|         WHERE | ||||
|             guacamole_user_group_permission.affected_user_group_id = affected_group.user_group_id | ||||
|             AND affected_group.entity_id = affected_entity.entity_id | ||||
|             AND (guacamole_user_group_permission.entity_id, permission, affected_entity.name) IN | ||||
|             AND  | ||||
|                 <choose> | ||||
|                     <when test="caseSensitivity.caseSensitiveGroupNames()"> | ||||
|                         (guacamole_user_group_permission.entity_id, permission, affected_entity.name) | ||||
|                     </when> | ||||
|                     <otherwise> | ||||
|                         (guacamole_user_group_permission.entity_id, permission, LOWER(affected_entity.name)) | ||||
|                     </otherwise> | ||||
|                 </choose> | ||||
|                 IN | ||||
|                 <foreach collection="permissions" item="permission" | ||||
|                          open="(" separator="," close=")"> | ||||
|                     (#{permission.entityID,jdbcType=INTEGER}, | ||||
|                      #{permission.type,jdbcType=VARCHAR}::guacamole_object_permission_type, | ||||
|                      #{permission.objectIdentifier,jdbcType=INTEGER}) | ||||
|                     <choose> | ||||
|                         <when test="caseSensitivity.caseSensitiveGroupNames()"> | ||||
|                             #{permission.objectIdentifier,jdbcType=INTEGER} | ||||
|                         </when> | ||||
|                         <otherwise> | ||||
|                             LOWER(#{permission.objectIdentifier,jdbcType=INTEGER}) | ||||
|                         </otherwise> | ||||
|                     </choose> | ||||
|                     ) | ||||
|                 </foreach> | ||||
|             AND affected_entity.type = 'USER_GROUP'::guacamole_entity_type | ||||
|  | ||||
| @@ -140,7 +180,14 @@ | ||||
|             </foreach> | ||||
|         AS permissions | ||||
|         JOIN guacamole_entity affected_entity ON | ||||
|                 affected_entity.name = permissions.affected_name | ||||
|                 <choose> | ||||
|                     <when test="caseSensitivity.caseSensitiveGroupNames()"> | ||||
|                         affected_entity.name = permissions.affected_name | ||||
|                     </when> | ||||
|                     <otherwise> | ||||
|                         LOWER(affected_entity.name) = LOWER(permissions.affected_name) | ||||
|                     </otherwise> | ||||
|                 </choose> | ||||
|             AND affected_entity.type = 'USER_GROUP'::guacamole_entity_type | ||||
|         JOIN guacamole_user_group affected_group ON affected_group.entity_id = affected_entity.entity_id | ||||
|         WHERE (permissions.entity_id, permissions.permission, affected_group.user_group_id) NOT IN ( | ||||
|   | ||||
| @@ -43,9 +43,10 @@ | ||||
|         JOIN guacamole_entity affected_entity ON affected_user.entity_id = affected_entity.entity_id | ||||
|         WHERE | ||||
|             <include refid="org.apache.guacamole.auth.jdbc.base.EntityMapper.isRelatedEntity"> | ||||
|                 <property name="column"   value="guacamole_user_permission.entity_id"/> | ||||
|                 <property name="entityID" value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"   value="effectiveGroups"/> | ||||
|                 <property name="column"          value="guacamole_user_permission.entity_id"/> | ||||
|                 <property name="entityID"        value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"          value="effectiveGroups"/> | ||||
|                 <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|             </include> | ||||
|             AND affected_entity.type = 'USER'::guacamole_entity_type | ||||
|  | ||||
| @@ -63,22 +64,22 @@ | ||||
|         JOIN guacamole_entity affected_entity ON affected_user.entity_id = affected_entity.entity_id | ||||
|         WHERE | ||||
|             <include refid="org.apache.guacamole.auth.jdbc.base.EntityMapper.isRelatedEntity"> | ||||
|                 <property name="column"   value="guacamole_user_permission.entity_id"/> | ||||
|                 <property name="entityID" value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"   value="effectiveGroups"/> | ||||
|                 <property name="column"          value="guacamole_user_permission.entity_id"/> | ||||
|                 <property name="entityID"        value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"          value="effectiveGroups"/> | ||||
|                 <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|             </include> | ||||
|             AND permission = #{type,jdbcType=VARCHAR}::guacamole_object_permission_type | ||||
|             AND affected_entity.type = 'USER'::guacamole_entity_type | ||||
|             AND | ||||
|             <choose> | ||||
|                 <when test="caseSensitive"> | ||||
|                 <when test="caseSensitivity.caseSensitiveUsernames()"> | ||||
|                     affected_entity.name = #{identifier,jdbcType=VARCHAR} | ||||
|                 </when> | ||||
|                 <otherwise> | ||||
|                     LOWER(affected_entity.name) = LOWER(#{identifier,jdbcType=VARCHAR}) | ||||
|                 </otherwise> | ||||
|             </choose> | ||||
|              | ||||
|             AND affected_entity.type = 'USER'::guacamole_entity_type | ||||
|  | ||||
|     </select> | ||||
|  | ||||
| @@ -91,13 +92,15 @@ | ||||
|         JOIN guacamole_entity affected_entity ON affected_user.entity_id = affected_entity.entity_id | ||||
|         WHERE | ||||
|             <include refid="org.apache.guacamole.auth.jdbc.base.EntityMapper.isRelatedEntity"> | ||||
|                 <property name="column"   value="guacamole_user_permission.entity_id"/> | ||||
|                 <property name="entityID" value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"   value="effectiveGroups"/> | ||||
|                 <property name="column"          value="guacamole_user_permission.entity_id"/> | ||||
|                 <property name="entityID"        value="#{entity.entityID,jdbcType=INTEGER}"/> | ||||
|                 <property name="groups"          value="effectiveGroups"/> | ||||
|                 <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|             </include> | ||||
|             AND affected_entity.type = 'USER'::guacamole_entity_type | ||||
|             AND  | ||||
|                 <choose> | ||||
|                     <when test="caseSensitive"> | ||||
|                     <when test="caseSensitivity.caseSensitiveUsernames()"> | ||||
|                         affected_entity.name IN | ||||
|                         <foreach collection="identifiers" item="identifier" | ||||
|                          open="(" separator="," close=")"> | ||||
| @@ -117,8 +120,7 @@ | ||||
|                          open="(" separator="," close=")"> | ||||
|                     #{permission,jdbcType=VARCHAR}::guacamole_object_permission_type | ||||
|                 </foreach> | ||||
|             AND affected_entity.type = 'USER'::guacamole_entity_type | ||||
|  | ||||
|              | ||||
|     </select> | ||||
|  | ||||
|     <!-- Delete all given permissions --> | ||||
| @@ -129,9 +131,11 @@ | ||||
|         WHERE | ||||
|             guacamole_user_permission.affected_user_id = affected_user.user_id | ||||
|             AND affected_user.entity_id = affected_entity.entity_id | ||||
|             AND affected_entity.type = 'USER'::guacamole_entity_type | ||||
|             AND | ||||
|             <choose> | ||||
|                 <when test="caseSensitive"> | ||||
|                     AND (guacamole_user_permission.entity_id, permission, affected_entity.name) IN | ||||
|                 <when test="caseSensitivity.caseSensitiveUsernames()"> | ||||
|                     (guacamole_user_permission.entity_id, permission, affected_entity.name) IN | ||||
|                     <foreach collection="permissions" item="permission" | ||||
|                             open="(" separator="," close=")"> | ||||
|                         (#{permission.entityID,jdbcType=INTEGER}, | ||||
| @@ -140,7 +144,7 @@ | ||||
|                     </foreach> | ||||
|                 </when> | ||||
|                 <otherwise> | ||||
|                     AND (guacamole_user_permission.entity_id, permission, LOWER(affected_entity.name)) IN | ||||
|                     (guacamole_user_permission.entity_id, permission, LOWER(affected_entity.name)) IN | ||||
|                     <foreach collection="permissions" item="permission" | ||||
|                              open="(" separator="," close=")"> | ||||
|                         (#{permission.entityID,jdbcType=INTEGER}, | ||||
| @@ -149,7 +153,6 @@ | ||||
|                     </foreach> | ||||
|                 </otherwise> | ||||
|             </choose> | ||||
|             AND affected_entity.type = 'USER'::guacamole_entity_type | ||||
|  | ||||
|     </delete> | ||||
|  | ||||
| @@ -174,15 +177,16 @@ | ||||
|             </foreach> | ||||
|         AS permissions | ||||
|         JOIN guacamole_entity affected_entity ON | ||||
|             affected_entity.type = 'USER'::guacamole_entity_type | ||||
|             AND | ||||
|             <choose> | ||||
|                 <when test="caseSensitive"> | ||||
|                 <when test="caseSensitivity.caseSensitiveUsernames()"> | ||||
|                     affected_entity.name = permissions.affected_name | ||||
|                 </when> | ||||
|                 <otherwise> | ||||
|                     LOWER(affected_entity.name) = LOWER(permissions.affected_name) | ||||
|                 </otherwise> | ||||
|             </choose> | ||||
|             AND affected_entity.type = 'USER'::guacamole_entity_type | ||||
|         JOIN guacamole_user affected_user ON affected_user.entity_id = affected_entity.entity_id | ||||
|         WHERE (permissions.entity_id, permissions.permission, affected_user.user_id) NOT IN ( | ||||
|             SELECT | ||||
|   | ||||
| @@ -66,9 +66,10 @@ | ||||
|         FROM guacamole_sharing_profile_permission | ||||
|         WHERE | ||||
|             <include refid="org.apache.guacamole.auth.jdbc.base.EntityMapper.isRelatedEntity"> | ||||
|                 <property name="column"   value="entity_id"/> | ||||
|                 <property name="entityID" value="${entityID}"/> | ||||
|                 <property name="groups"   value="${groups}"/> | ||||
|                 <property name="column"          value="entity_id"/> | ||||
|                 <property name="entityID"        value="${entityID}"/> | ||||
|                 <property name="groups"          value="${groups}"/> | ||||
|                 <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|             </include> | ||||
|             AND permission = 'READ' | ||||
|     </sql> | ||||
| @@ -76,8 +77,9 @@ | ||||
|     <!-- Select identifiers of all readable sharing profiles --> | ||||
|     <select id="selectReadableIdentifiers" resultType="string"> | ||||
|         <include refid="org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileMapper.getReadableIDs"> | ||||
|             <property name="entityID" value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|             <property name="groups"   value="effectiveGroups"/> | ||||
|             <property name="entityID"        value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|             <property name="groups"          value="effectiveGroups"/> | ||||
|             <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|         </include> | ||||
|     </select> | ||||
|  | ||||
| @@ -125,8 +127,9 @@ | ||||
|             </foreach> | ||||
|             AND guacamole_sharing_profile.sharing_profile_id IN ( | ||||
|                 <include refid="org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileMapper.getReadableIDs"> | ||||
|                     <property name="entityID" value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"   value="effectiveGroups"/> | ||||
|                     <property name="entityID"        value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"          value="effectiveGroups"/> | ||||
|                     <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|                 </include> | ||||
|             ); | ||||
|  | ||||
| @@ -142,8 +145,9 @@ | ||||
|             </foreach> | ||||
|             AND guacamole_sharing_profile_attribute.sharing_profile_id IN ( | ||||
|                 <include refid="org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileMapper.getReadableIDs"> | ||||
|                     <property name="entityID" value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"   value="effectiveGroups"/> | ||||
|                     <property name="entityID"        value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"          value="effectiveGroups"/> | ||||
|                     <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|                 </include> | ||||
|             ); | ||||
|  | ||||
|   | ||||
| @@ -44,7 +44,7 @@ | ||||
|         JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id | ||||
|         WHERE | ||||
|             <choose> | ||||
|                 <when test="caseSensitive"> | ||||
|                 <when test="caseSensitivity.caseSensitiveUsernames()"> | ||||
|                     guacamole_entity.name = #{username,jdbcType=VARCHAR} | ||||
|                 </when> | ||||
|                 <otherwise> | ||||
|   | ||||
| @@ -82,9 +82,10 @@ | ||||
|         FROM guacamole_user_permission | ||||
|         WHERE | ||||
|             <include refid="org.apache.guacamole.auth.jdbc.base.EntityMapper.isRelatedEntity"> | ||||
|                 <property name="column"   value="entity_id"/> | ||||
|                 <property name="entityID" value="${entityID}"/> | ||||
|                 <property name="groups"   value="${groups}"/> | ||||
|                 <property name="column"          value="entity_id"/> | ||||
|                 <property name="entityID"        value="${entityID}"/> | ||||
|                 <property name="groups"          value="${groups}"/> | ||||
|                 <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|             </include> | ||||
|             AND permission = 'READ' | ||||
|     </sql> | ||||
| @@ -94,14 +95,14 @@ | ||||
|         SELECT guacamole_entity.name | ||||
|         FROM guacamole_user | ||||
|         JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id | ||||
|         WHERE | ||||
|             guacamole_user.user_id IN ( | ||||
|         WHERE guacamole_entity.type = 'USER'::guacamole_entity_type | ||||
|             AND guacamole_user.user_id IN ( | ||||
|                 <include refid="org.apache.guacamole.auth.jdbc.user.UserMapper.getReadableIDs"> | ||||
|                     <property name="entityID" value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"   value="effectiveGroups"/> | ||||
|                     <property name="entityID"        value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"          value="effectiveGroups"/> | ||||
|                     <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|                 </include> | ||||
|             ) | ||||
|             AND guacamole_entity.type = 'USER'::guacamole_entity_type | ||||
|     </select> | ||||
|  | ||||
|     <!-- Select multiple users by username --> | ||||
| @@ -130,9 +131,10 @@ | ||||
|         FROM guacamole_user | ||||
|         JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id | ||||
|         LEFT JOIN guacamole_user_history ON guacamole_user_history.user_id = guacamole_user.user_id | ||||
|         WHERE | ||||
|         WHERE guacamole_entity.type = 'USER'::guacamole_entity_type | ||||
|             AND | ||||
|             <choose> | ||||
|                 <when test="caseSensitive"> | ||||
|                 <when test="caseSensitivity.caseSensitiveUsernames()"> | ||||
|                     guacamole_entity.name | ||||
|                 </when> | ||||
|                 <otherwise> | ||||
| @@ -143,15 +145,14 @@ | ||||
|             <foreach collection="identifiers" item="identifier" | ||||
|                     open="(" separator="," close=")"> | ||||
|                 <choose> | ||||
|                     <when test="caseSensitive"> | ||||
|                     <when test="caseSensitivity.caseSensitiveUsernames()"> | ||||
|                         #{identifier,jdbcType=VARCHAR} | ||||
|                     </when> | ||||
|                     <otherwise> | ||||
|                         LOWER(#{identifier,jdbcType=VARCHAR}) | ||||
|                     </otherwise> | ||||
|                 </choose> | ||||
|             </foreach> | ||||
|             AND guacamole_entity.type = 'USER'::guacamole_entity_type | ||||
|             </foreach>     | ||||
|         GROUP BY guacamole_user.user_id, guacamole_entity.entity_id; | ||||
|  | ||||
|         SELECT | ||||
| @@ -161,9 +162,10 @@ | ||||
|         FROM guacamole_user_attribute | ||||
|         JOIN guacamole_user ON guacamole_user.user_id = guacamole_user_attribute.user_id | ||||
|         JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id | ||||
|         WHERE  | ||||
|         WHERE guacamole_entity.type = 'USER'::guacamole_entity_type | ||||
|             AND | ||||
|             <choose> | ||||
|                 <when test="caseSensitive"> | ||||
|                 <when test="caseSensitivity.caseSensitiveUsernames()"> | ||||
|                     guacamole_entity.name | ||||
|                 </when> | ||||
|                 <otherwise> | ||||
| @@ -174,7 +176,7 @@ | ||||
|             <foreach collection="identifiers" item="identifier" | ||||
|                     open="(" separator="," close=")"> | ||||
|                 <choose> | ||||
|                     <when test="caseSensitive"> | ||||
|                     <when test="caseSensitivity.caseSensitiveUsernames()"> | ||||
|                         #{identifier,jdbcType=VARCHAR} | ||||
|                     </when> | ||||
|                     <otherwise> | ||||
| @@ -182,7 +184,7 @@ | ||||
|                     </otherwise> | ||||
|                 </choose> | ||||
|             </foreach> | ||||
|             AND guacamole_entity.type = 'USER'::guacamole_entity_type; | ||||
|             ; | ||||
|  | ||||
|     </select> | ||||
|  | ||||
| @@ -212,9 +214,10 @@ | ||||
|         FROM guacamole_user | ||||
|         JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id | ||||
|         LEFT JOIN guacamole_user_history ON guacamole_user_history.user_id = guacamole_user.user_id | ||||
|         WHERE  | ||||
|         WHERE guacamole_entity.type = 'USER'::guacamole_entity_type | ||||
|             AND | ||||
|             <choose> | ||||
|                 <when test="caseSensitive"> | ||||
|                 <when test="caseSensitivity.caseSensitiveUsernames()"> | ||||
|                     guacamole_entity.name | ||||
|                 </when> | ||||
|                 <otherwise> | ||||
| @@ -225,7 +228,7 @@ | ||||
|             <foreach collection="identifiers" item="identifier" | ||||
|                      open="(" separator="," close=")"> | ||||
|                 <choose> | ||||
|                     <when test="caseSensitive"> | ||||
|                     <when test="caseSensitivity.caseSensitiveUsernames()"> | ||||
|                         #{identifier,jdbcType=VARCHAR} | ||||
|                     </when> | ||||
|                     <otherwise> | ||||
| @@ -233,11 +236,11 @@ | ||||
|                     </otherwise> | ||||
|                 </choose> | ||||
|             </foreach> | ||||
|             AND guacamole_entity.type = 'USER'::guacamole_entity_type | ||||
|             AND guacamole_user.user_id IN ( | ||||
|                 <include refid="org.apache.guacamole.auth.jdbc.user.UserMapper.getReadableIDs"> | ||||
|                     <property name="entityID" value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"   value="effectiveGroups"/> | ||||
|                     <property name="entityID"        value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"          value="effectiveGroups"/> | ||||
|                     <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|                 </include> | ||||
|             ) | ||||
|         GROUP BY guacamole_user.user_id, guacamole_entity.entity_id; | ||||
| @@ -249,9 +252,10 @@ | ||||
|         FROM guacamole_user_attribute | ||||
|         JOIN guacamole_user ON guacamole_user.user_id = guacamole_user_attribute.user_id | ||||
|         JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id | ||||
|         WHERE  | ||||
|         WHERE guacamole_entity.type = 'USER'::guacamole_entity_type | ||||
|             AND | ||||
|             <choose> | ||||
|                 <when test="caseSensitive"> | ||||
|                 <when test="caseSensitivity.caseSensitiveUsernames()"> | ||||
|                     guacamole_entity.name | ||||
|                 </when> | ||||
|                 <otherwise> | ||||
| @@ -262,7 +266,7 @@ | ||||
|             <foreach collection="identifiers" item="identifier" | ||||
|                      open="(" separator="," close=")"> | ||||
|                 <choose> | ||||
|                     <when test="caseSensitive"> | ||||
|                     <when test="caseSensitivity.caseSensitiveUsernames()"> | ||||
|                         #{identifier,jdbcType=VARCHAR} | ||||
|                     </when> | ||||
|                     <otherwise> | ||||
| @@ -270,11 +274,11 @@ | ||||
|                     </otherwise> | ||||
|                 </choose> | ||||
|             </foreach> | ||||
|             AND guacamole_entity.type = 'USER'::guacamole_entity_type | ||||
|             AND guacamole_user.user_id IN ( | ||||
|                 <include refid="org.apache.guacamole.auth.jdbc.user.UserMapper.getReadableIDs"> | ||||
|                     <property name="entityID" value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"   value="effectiveGroups"/> | ||||
|                     <property name="entityID"        value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"          value="effectiveGroups"/> | ||||
|                     <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|                 </include> | ||||
|             ); | ||||
|  | ||||
| @@ -306,16 +310,16 @@ | ||||
|         FROM guacamole_user | ||||
|         JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id | ||||
|         LEFT JOIN guacamole_user_history ON guacamole_user_history.user_id = guacamole_user.user_id | ||||
|         WHERE | ||||
|         WHERE guacamole_entity.type = 'USER'::guacamole_entity_type | ||||
|             AND | ||||
|             <choose> | ||||
|                 <when test="caseSensitive"> | ||||
|                 <when test="caseSensitivity.caseSensitiveUsernames()"> | ||||
|                     guacamole_entity.name = #{username,jdbcType=VARCHAR} | ||||
|                 </when> | ||||
|                 <otherwise> | ||||
|                     LOWER(guacamole_entity.name) = LOWER(#{username,jdbcType=VARCHAR}) | ||||
|                 </otherwise> | ||||
|             </choose> | ||||
|             AND guacamole_entity.type = 'USER'::guacamole_entity_type | ||||
|         GROUP BY guacamole_user.user_id, guacamole_entity.entity_id; | ||||
|  | ||||
|         SELECT | ||||
| @@ -325,31 +329,31 @@ | ||||
|         FROM guacamole_user_attribute | ||||
|         JOIN guacamole_user ON guacamole_user.user_id = guacamole_user_attribute.user_id | ||||
|         JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id | ||||
|         WHERE | ||||
|         WHERE guacamole_entity.type = 'USER'::guacamole_entity_type | ||||
|             AND | ||||
|             <choose> | ||||
|                 <when test="caseSensitive"> | ||||
|                 <when test="caseSensitivity.caseSensitiveUsernames()"> | ||||
|                     guacamole_entity.name = #{username,jdbcType=VARCHAR} | ||||
|                 </when> | ||||
|                 <otherwise> | ||||
|                     LOWER(guacamole_entity.name) = LOWER(#{username,jdbcType=VARCHAR}) | ||||
|                 </otherwise> | ||||
|             </choose> | ||||
|             AND guacamole_entity.type = 'USER'::guacamole_entity_type | ||||
|     </select> | ||||
|  | ||||
|     <!-- Delete single user by username --> | ||||
|     <delete id="delete"> | ||||
|         DELETE FROM guacamole_entity | ||||
|         WHERE | ||||
|         WHERE type = 'USER'::guacamole_entity_type | ||||
|             AND | ||||
|             <choose> | ||||
|                 <when test="caseSensitive"> | ||||
|                 <when test="caseSensitivity.caseSensitiveUsernames()"> | ||||
|                     name = #{identifier,jdbcType=VARCHAR} | ||||
|                 </when> | ||||
|                 <otherwise> | ||||
|                     LOWER(name) = LOWER(#{identifier,jdbcType=VARCHAR}) | ||||
|                 </otherwise> | ||||
|             </choose> | ||||
|             AND type = 'USER'::guacamole_entity_type | ||||
|     </delete> | ||||
|  | ||||
|     <!-- Insert single user --> | ||||
|   | ||||
| @@ -43,8 +43,9 @@ | ||||
|         WHERE | ||||
|             guacamole_user_group.user_group_id IN ( | ||||
|                 <include refid="org.apache.guacamole.auth.jdbc.usergroup.UserGroupMapper.getReadableIDs"> | ||||
|                     <property name="entityID" value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"   value="effectiveGroups"/> | ||||
|                     <property name="entityID"        value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"          value="effectiveGroups"/> | ||||
|                     <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|                 </include> | ||||
|             ) | ||||
|             AND guacamole_user_group_member.member_entity_id = #{parent.entityID,jdbcType=INTEGER} | ||||
| @@ -60,11 +61,24 @@ | ||||
|             AND guacamole_user_group.user_group_id = guacamole_user_group_member.user_group_id | ||||
|             AND guacamole_entity.entity_id = guacamole_user_group.entity_id | ||||
|             AND guacamole_entity.type = 'USER_GROUP'::guacamole_entity_type | ||||
|             AND guacamole_entity.name IN | ||||
|                 <foreach collection="children" item="identifier" | ||||
|                          open="(" separator="," close=")"> | ||||
|                     #{identifier,jdbcType=VARCHAR} | ||||
|                 </foreach> | ||||
|             AND  | ||||
|             <choose> | ||||
|                 <when test="caseSensitivity.caseSensitiveGroupNames()"> | ||||
|                     guacamole_entity.name IN | ||||
|                     <foreach collection="children" item="identifier" | ||||
|                              open="(" separator="," close=")"> | ||||
|                         #{identifier,jdbcType=VARCHAR} | ||||
|                     </foreach> | ||||
|                 </when> | ||||
|                 <otherwise> | ||||
|                     LOWER(guacamole_entity.name) IN | ||||
|                     <foreach collection="children" item="identifier" | ||||
|                              open="(" separator="," close=")"> | ||||
|                         LOWER(#{identifier,jdbcType=VARCHAR}) | ||||
|                     </foreach> | ||||
|                 </otherwise> | ||||
|             </choose> | ||||
|          | ||||
|     </delete> | ||||
|  | ||||
|     <!-- Insert parent groups by name --> | ||||
| @@ -78,13 +92,25 @@ | ||||
|             #{parent.entityID,jdbcType=INTEGER} | ||||
|         FROM guacamole_user_group | ||||
|         JOIN guacamole_entity ON guacamole_user_group.entity_id = guacamole_entity.entity_id | ||||
|         WHERE | ||||
|             guacamole_entity.name IN | ||||
|                 <foreach collection="children" item="identifier" | ||||
|                          open="(" separator="," close=")"> | ||||
|                     #{identifier,jdbcType=VARCHAR} | ||||
|                 </foreach> | ||||
|             AND guacamole_entity.type = 'USER_GROUP'::guacamole_entity_type | ||||
|         WHERE guacamole_entity.type = 'USER_GROUP'::guacamole_entity_type | ||||
|             AND | ||||
|             <choose> | ||||
|                 <when test="caseSensitivity.caseSensitiveGroupNames()"> | ||||
|                     guacamole_entity.name IN | ||||
|                     <foreach collection="children" item="identifier" | ||||
|                              open="(" separator="," close=")"> | ||||
|                         #{identifier,jdbcType=VARCHAR} | ||||
|                     </foreach> | ||||
|                 </when> | ||||
|                 <otherwise> | ||||
|                     LOWER(guacamole_entity.name) IN | ||||
|                     <foreach collection="children" item="identifier" | ||||
|                              open="(" separator="," close=")"> | ||||
|                         LOWER(#{identifier,jdbcType=VARCHAR}) | ||||
|                     </foreach> | ||||
|                 </otherwise> | ||||
|             </choose> | ||||
|              | ||||
|             AND guacamole_user_group.user_group_id NOT IN ( | ||||
|                 SELECT guacamole_user_group_member.user_group_id | ||||
|                 FROM guacamole_user_group_member | ||||
|   | ||||
| @@ -50,7 +50,7 @@ | ||||
|              JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id | ||||
|              WHERE | ||||
|                 <choose> | ||||
|                     <when test="caseSensitive"> | ||||
|                     <when test="caseSensitivity.caseSensitiveUsernames()"> | ||||
|                         guacamole_entity.name = #{record.username,jdbcType=VARCHAR} | ||||
|                     </when> | ||||
|                     <otherwise> | ||||
| @@ -89,7 +89,7 @@ | ||||
|              | ||||
|             <if test="identifier != null"> | ||||
|                 <choose> | ||||
|                     <when test="caseSensitive"> | ||||
|                     <when test="caseSensitivity.caseSensitiveUsernames()"> | ||||
|                         guacamole_user_history.username = #{identifier,jdbcType=VARCHAR} | ||||
|                     </when> | ||||
|                     <otherwise> | ||||
| @@ -107,7 +107,7 @@ | ||||
|                         JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id | ||||
|                         WHERE | ||||
|                             <choose> | ||||
|                                 <when test="caseSensitive"> | ||||
|                                 <when test="caseSensitivity.caseSensitiveUsernames()"> | ||||
|                                     POSITION(#{term.term,jdbcType=VARCHAR} IN guacamole_entity.name) > 0 | ||||
|                                 </when> | ||||
|                                 <otherwise> | ||||
| @@ -161,15 +161,16 @@ | ||||
|             <!-- Restrict to readable users --> | ||||
|             guacamole_connection_history.user_id IN ( | ||||
|                 <include refid="org.apache.guacamole.auth.jdbc.user.UserMapper.getReadableIDs"> | ||||
|                     <property name="entityID" value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"   value="effectiveGroups"/> | ||||
|                     <property name="entityID"        value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"          value="effectiveGroups"/> | ||||
|                     <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|                 </include> | ||||
|             ) | ||||
|  | ||||
|             <if test="identifier != null"> | ||||
|                 AND | ||||
|                 <choose> | ||||
|                     <when test="caseSensitive"> | ||||
|                     <when test="caseSensitivity.caseSensitiveUsernames()"> | ||||
|                         guacamole_entity.name = #{identifier,jdbcType=VARCHAR} | ||||
|                     </when> | ||||
|                     <otherwise> | ||||
| @@ -187,7 +188,7 @@ | ||||
|                         JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id | ||||
|                         WHERE | ||||
|                             <choose> | ||||
|                                 <when test="caseSensitive"> | ||||
|                                 <when test="caseSensitivity.caseSensitiveUsernames()"> | ||||
|                                     POSITION(#{term.term,jdbcType=VARCHAR} IN guacamole_entity.name) > 0 | ||||
|                                 </when> | ||||
|                                 <otherwise> | ||||
|   | ||||
| @@ -68,9 +68,10 @@ | ||||
|         FROM guacamole_user_group_permission | ||||
|         WHERE | ||||
|             <include refid="org.apache.guacamole.auth.jdbc.base.EntityMapper.isRelatedEntity"> | ||||
|                 <property name="column"   value="entity_id"/> | ||||
|                 <property name="entityID" value="${entityID}"/> | ||||
|                 <property name="groups"   value="${groups}"/> | ||||
|                 <property name="column"          value="entity_id"/> | ||||
|                 <property name="entityID"        value="${entityID}"/> | ||||
|                 <property name="groups"          value="${groups}"/> | ||||
|                 <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|             </include> | ||||
|             AND permission = 'READ' | ||||
|     </sql> | ||||
| @@ -80,14 +81,14 @@ | ||||
|         SELECT guacamole_entity.name | ||||
|         FROM guacamole_user_group | ||||
|         JOIN guacamole_entity ON guacamole_user_group.entity_id = guacamole_entity.entity_id | ||||
|         WHERE | ||||
|             guacamole_user_group.user_group_id IN ( | ||||
|         WHERE guacamole_entity.type = 'USER_GROUP'::guacamole_entity_type | ||||
|             AND guacamole_user_group.user_group_id IN ( | ||||
|                 <include refid="org.apache.guacamole.auth.jdbc.usergroup.UserGroupMapper.getReadableIDs"> | ||||
|                     <property name="entityID" value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"   value="effectiveGroups"/> | ||||
|                     <property name="entityID"        value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"          value="effectiveGroups"/> | ||||
|                     <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|                 </include> | ||||
|             ) | ||||
|             AND guacamole_entity.type = 'USER_GROUP'::guacamole_entity_type | ||||
|     </select> | ||||
|  | ||||
|     <!-- Select multiple groups by name --> | ||||
| @@ -101,12 +102,25 @@ | ||||
|             disabled | ||||
|         FROM guacamole_user_group | ||||
|         JOIN guacamole_entity ON guacamole_user_group.entity_id = guacamole_entity.entity_id | ||||
|         WHERE guacamole_entity.name IN | ||||
|             <foreach collection="identifiers" item="identifier" | ||||
|                      open="(" separator="," close=")"> | ||||
|                 #{identifier,jdbcType=VARCHAR} | ||||
|             </foreach> | ||||
|             AND guacamole_entity.type = 'USER_GROUP'::guacamole_entity_type; | ||||
|         WHERE guacamole_entity.type = 'USER_GROUP'::guacamole_entity_type | ||||
|             AND  | ||||
|             <choose> | ||||
|                 <when test="caseSensitivity.caseSensitiveGroupNames()"> | ||||
|                     guacamole_entity.name IN | ||||
|                     <foreach collection="identifiers" item="identifier" | ||||
|                              open="(" separator="," close=")"> | ||||
|                         #{identifier,jdbcType=VARCHAR} | ||||
|                     </foreach> | ||||
|                 </when> | ||||
|                 <otherwise> | ||||
|                     LOWER(guacamole_entity.name) IN | ||||
|                     <foreach collection="identifiers" item="identifier" | ||||
|                              open="(" separator="," close=")"> | ||||
|                         LOWER(#{identifier,jdbcType=VARCHAR}) | ||||
|                     </foreach> | ||||
|                 </otherwise> | ||||
|             </choose> | ||||
|             ; | ||||
|  | ||||
|         SELECT | ||||
|             guacamole_user_group_attribute.user_group_id, | ||||
| @@ -115,12 +129,25 @@ | ||||
|         FROM guacamole_user_group_attribute | ||||
|         JOIN guacamole_user_group ON guacamole_user_group.user_group_id = guacamole_user_group_attribute.user_group_id | ||||
|         JOIN guacamole_entity ON guacamole_user_group.entity_id = guacamole_entity.entity_id | ||||
|         WHERE guacamole_entity.name IN | ||||
|             <foreach collection="identifiers" item="identifier" | ||||
|                      open="(" separator="," close=")"> | ||||
|                 #{identifier,jdbcType=VARCHAR} | ||||
|             </foreach> | ||||
|             AND guacamole_entity.type = 'USER_GROUP'::guacamole_entity_type; | ||||
|         WHERE guacamole_entity.type = 'USER_GROUP'::guacamole_entity_type | ||||
|             AND | ||||
|             <choose> | ||||
|                 <when test="caseSensitivity.caseSensitiveGroupNames()"> | ||||
|                     guacamole_entity.name IN | ||||
|                     <foreach collection="identifiers" item="identifier" | ||||
|                              open="(" separator="," close=")"> | ||||
|                         #{identifier,jdbcType=VARCHAR} | ||||
|                     </foreach> | ||||
|                 </when> | ||||
|                 <otherwise> | ||||
|                     LOWER(guacamole_entity.name) IN | ||||
|                     <foreach collection="identifiers" item="identifier" | ||||
|                              open="(" separator="," close=")"> | ||||
|                         LOWER(#{identifier,jdbcType=VARCHAR}) | ||||
|                     </foreach> | ||||
|                 </otherwise> | ||||
|             </choose> | ||||
|             ; | ||||
|  | ||||
|     </select> | ||||
|  | ||||
| @@ -135,16 +162,29 @@ | ||||
|             disabled | ||||
|         FROM guacamole_user_group | ||||
|         JOIN guacamole_entity ON guacamole_user_group.entity_id = guacamole_entity.entity_id | ||||
|         WHERE guacamole_entity.name IN | ||||
|             <foreach collection="identifiers" item="identifier" | ||||
|                      open="(" separator="," close=")"> | ||||
|                 #{identifier,jdbcType=VARCHAR} | ||||
|             </foreach> | ||||
|             AND guacamole_entity.type = 'USER_GROUP'::guacamole_entity_type | ||||
|         WHERE guacamole_entity.type = 'USER_GROUP'::guacamole_entity_type | ||||
|             AND | ||||
|             <choose> | ||||
|                 <when test="caseSensitivity.caseSensitiveGroupNames()"> | ||||
|                     guacamole_entity.name IN | ||||
|                     <foreach collection="identifiers" item="identifier" | ||||
|                              open="(" separator="," close=")"> | ||||
|                         #{identifier,jdbcType=VARCHAR} | ||||
|                     </foreach> | ||||
|                 </when> | ||||
|                 <otherwise> | ||||
|                     LOWER(guacamole_entity.name) IN | ||||
|                     <foreach collection="identifiers" item="identifier" | ||||
|                              open="(" separator="," close=")"> | ||||
|                         LOWER(#{identifier,jdbcType=VARCHAR}) | ||||
|                     </foreach> | ||||
|                 </otherwise> | ||||
|             </choose> | ||||
|             AND guacamole_user_group.user_group_id IN ( | ||||
|                 <include refid="org.apache.guacamole.auth.jdbc.usergroup.UserGroupMapper.getReadableIDs"> | ||||
|                     <property name="entityID" value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"   value="effectiveGroups"/> | ||||
|                     <property name="entityID"        value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"          value="effectiveGroups"/> | ||||
|                     <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|                 </include> | ||||
|             ); | ||||
|  | ||||
| @@ -155,16 +195,29 @@ | ||||
|         FROM guacamole_user_group_attribute | ||||
|         JOIN guacamole_user_group ON guacamole_user_group.user_group_id = guacamole_user_group_attribute.user_group_id | ||||
|         JOIN guacamole_entity ON guacamole_user_group.entity_id = guacamole_entity.entity_id | ||||
|         WHERE guacamole_entity.name IN | ||||
|             <foreach collection="identifiers" item="identifier" | ||||
|                      open="(" separator="," close=")"> | ||||
|                 #{identifier,jdbcType=VARCHAR} | ||||
|             </foreach> | ||||
|             AND guacamole_entity.type = 'USER_GROUP'::guacamole_entity_type | ||||
|         WHERE guacamole_entity.type = 'USER_GROUP'::guacamole_entity_type | ||||
|             AND | ||||
|             <choose> | ||||
|                 <when test="caseSensitivity.caseSensitiveGroupNames()"> | ||||
|                     guacamole_entity.name IN | ||||
|                     <foreach collection="identifiers" item="identifier" | ||||
|                              open="(" separator="," close=")"> | ||||
|                         #{identifier,jdbcType=VARCHAR} | ||||
|                     </foreach> | ||||
|                 </when> | ||||
|                 <otherwise> | ||||
|                     LOWER(guacamole_entity.name) IN | ||||
|                     <foreach collection="identifiers" item="identifier" | ||||
|                              open="(" separator="," close=")"> | ||||
|                         LOWER(#{identifier,jdbcType=VARCHAR}) | ||||
|                     </foreach> | ||||
|                 </otherwise> | ||||
|             </choose> | ||||
|             AND  guacamole_user_group.user_group_id IN ( | ||||
|                 <include refid="org.apache.guacamole.auth.jdbc.usergroup.UserGroupMapper.getReadableIDs"> | ||||
|                     <property name="entityID" value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"   value="effectiveGroups"/> | ||||
|                     <property name="entityID"        value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"          value="effectiveGroups"/> | ||||
|                     <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|                 </include> | ||||
|             ); | ||||
|  | ||||
| @@ -181,9 +234,17 @@ | ||||
|             disabled | ||||
|         FROM guacamole_user_group | ||||
|         JOIN guacamole_entity ON guacamole_user_group.entity_id = guacamole_entity.entity_id | ||||
|         WHERE | ||||
|             guacamole_entity.name = #{name,jdbcType=VARCHAR} | ||||
|             AND guacamole_entity.type = 'USER_GROUP'::guacamole_entity_type; | ||||
|         WHERE guacamole_entity.type = 'USER_GROUP'::guacamole_entity_type | ||||
|             AND | ||||
|             <choose> | ||||
|                 <when test="caseSensitivity.caseSensitiveGroupNames()"> | ||||
|                     guacamole_entity.name = #{name,jdbcType=VARCHAR} | ||||
|                 </when> | ||||
|                 <otherwise> | ||||
|                     LOWER(guacamole_entity.name) = LOWER(#{name,jdbcType=VARCHAR}) | ||||
|                 </otherwise> | ||||
|             </choose> | ||||
|             ; | ||||
|  | ||||
|         SELECT | ||||
|             guacamole_user_group_attribute.user_group_id, | ||||
| @@ -192,18 +253,34 @@ | ||||
|         FROM guacamole_user_group_attribute | ||||
|         JOIN guacamole_user_group ON guacamole_user_group.user_group_id = guacamole_user_group_attribute.user_group_id | ||||
|         JOIN guacamole_entity ON guacamole_user_group.entity_id = guacamole_entity.entity_id | ||||
|         WHERE | ||||
|             guacamole_entity.name = #{name,jdbcType=VARCHAR} | ||||
|             AND guacamole_entity.type = 'USER_GROUP'::guacamole_entity_type | ||||
|         WHERE guacamole_entity.type = 'USER_GROUP'::guacamole_entity_type | ||||
|             AND | ||||
|             <choose> | ||||
|                 <when test="caseSensitivity.caseSensitiveGroupNames()"> | ||||
|                     guacamole_entity.name = #{name,jdbcType=VARCHAR} | ||||
|                 </when> | ||||
|                 <otherwise> | ||||
|                     LOWER(guacamole_entity.name) = LOWER(#{name,jdbcType=VARCHAR}) | ||||
|                 </otherwise> | ||||
|             </choose> | ||||
|             ;  | ||||
|  | ||||
|     </select> | ||||
|  | ||||
|     <!-- Delete single group by name --> | ||||
|     <delete id="delete"> | ||||
|         DELETE FROM guacamole_entity | ||||
|         WHERE | ||||
|             name = #{identifier,jdbcType=VARCHAR} | ||||
|             AND type = 'USER_GROUP'::guacamole_entity_type | ||||
|         WHERE type = 'USER_GROUP'::guacamole_entity_type | ||||
|             AND | ||||
|             <choose> | ||||
|                 <when test="caseSensitivity.caseSensitiveGroupNames()"> | ||||
|                     name = #{identifier,jdbcType=VARCHAR} | ||||
|                 </when> | ||||
|                 <otherwise> | ||||
|                     LOWER(name) = LOWER(#{identifier,jdbcType=VARCHAR}) | ||||
|                 </otherwise> | ||||
|             </choose> | ||||
|              | ||||
|     </delete> | ||||
|  | ||||
|     <!-- Insert single group --> | ||||
|   | ||||
| @@ -42,8 +42,9 @@ | ||||
|         WHERE | ||||
|             guacamole_user_group.user_group_id IN ( | ||||
|                 <include refid="org.apache.guacamole.auth.jdbc.usergroup.UserGroupMapper.getReadableIDs"> | ||||
|                     <property name="entityID" value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"   value="effectiveGroups"/> | ||||
|                     <property name="entityID"        value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"          value="effectiveGroups"/> | ||||
|                     <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|                 </include> | ||||
|             ) | ||||
|             AND guacamole_user_group_member.user_group_id = #{parent.objectID,jdbcType=INTEGER} | ||||
| @@ -58,11 +59,24 @@ | ||||
|             user_group_id = #{parent.objectID,jdbcType=INTEGER} | ||||
|             AND guacamole_entity.entity_id = member_entity_id | ||||
|             AND guacamole_entity.type = 'USER_GROUP'::guacamole_entity_type | ||||
|             AND guacamole_entity.name IN | ||||
|                 <foreach collection="children" item="identifier" | ||||
|                          open="(" separator="," close=")"> | ||||
|                     #{identifier,jdbcType=VARCHAR} | ||||
|                 </foreach> | ||||
|             AND  | ||||
|             <choose> | ||||
|                 <when test="caseSensitivity.caseSensitiveGroupNames()"> | ||||
|                     guacamole_entity.name IN | ||||
|                     <foreach collection="children" item="identifier" | ||||
|                              open="(" separator="," close=")"> | ||||
|                         #{identifier,jdbcType=VARCHAR} | ||||
|                     </foreach> | ||||
|                 </when> | ||||
|                 <otherwise> | ||||
|                     LOWER(guacamole_entity.name) IN | ||||
|                     <foreach collection="children" item="identifier" | ||||
|                              open="(" separator="," close=")"> | ||||
|                         LOWER(#{identifier,jdbcType=VARCHAR}) | ||||
|                     </foreach> | ||||
|                 </otherwise> | ||||
|             </choose> | ||||
|          | ||||
|     </delete> | ||||
|  | ||||
|     <!-- Insert member groups by name --> | ||||
| @@ -75,13 +89,24 @@ | ||||
|             #{parent.objectID,jdbcType=INTEGER}, | ||||
|             guacamole_entity.entity_id | ||||
|         FROM guacamole_entity | ||||
|         WHERE | ||||
|             guacamole_entity.name IN | ||||
|                 <foreach collection="children" item="identifier" | ||||
|                          open="(" separator="," close=")"> | ||||
|                     #{identifier} | ||||
|                 </foreach> | ||||
|             AND guacamole_entity.type = 'USER_GROUP'::guacamole_entity_type | ||||
|         WHERE guacamole_entity.type = 'USER_GROUP'::guacamole_entity_type | ||||
|             AND | ||||
|             <choose> | ||||
|                 <when test="caseSensitivity.caseSensitiveGroupNames()"> | ||||
|                     guacamole_entity.name IN | ||||
|                     <foreach collection="children" item="identifier" | ||||
|                              open="(" separator="," close=")"> | ||||
|                         #{identifier} | ||||
|                     </foreach> | ||||
|                 </when> | ||||
|                 <otherwise> | ||||
|                     LOWER(guacamole_entity.name) IN | ||||
|                     <foreach collection="children" item="identifier" | ||||
|                              open="(" separator="," close=")"> | ||||
|                         LOWER(#{identifier}) | ||||
|                     </foreach> | ||||
|                 </otherwise> | ||||
|             </choose>  | ||||
|             AND guacamole_entity.entity_id NOT IN ( | ||||
|                 SELECT guacamole_user_group_member.member_entity_id | ||||
|                 FROM guacamole_user_group_member | ||||
|   | ||||
| @@ -42,8 +42,9 @@ | ||||
|         WHERE | ||||
|             guacamole_user.user_id IN ( | ||||
|                 <include refid="org.apache.guacamole.auth.jdbc.user.UserMapper.getReadableIDs"> | ||||
|                     <property name="entityID" value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"   value="effectiveGroups"/> | ||||
|                     <property name="entityID"        value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"          value="effectiveGroups"/> | ||||
|                     <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|                 </include> | ||||
|             ) | ||||
|             AND guacamole_user_group_member.user_group_id = #{parent.objectID,jdbcType=INTEGER} | ||||
| @@ -60,7 +61,7 @@ | ||||
|             AND guacamole_entity.type = 'USER'::guacamole_entity_type | ||||
|             AND | ||||
|             <choose> | ||||
|                 <when test="caseSensitive"> | ||||
|                 <when test="caseSensitivity.caseSensitiveUsernames()"> | ||||
|                     guacamole_entity.name | ||||
|                 </when> | ||||
|                 <otherwise> | ||||
| @@ -71,7 +72,7 @@ | ||||
|             <foreach collection="children" item="identifier" | ||||
|                      open="(" separator="," close=")"> | ||||
|                 <choose> | ||||
|                     <when test="caseSensitive"> | ||||
|                     <when test="caseSensitivity.caseSensitiveUsernames()"> | ||||
|                         #{identifier,jdbcType=VARCHAR} | ||||
|                     </when> | ||||
|                     <otherwise> | ||||
| @@ -93,7 +94,7 @@ | ||||
|         FROM guacamole_entity | ||||
|         WHERE | ||||
|             <choose> | ||||
|                 <when test="caseSensitive"> | ||||
|                 <when test="caseSensitivity.caseSensitiveUsernames()"> | ||||
|                     guacamole_entity.name | ||||
|                 </when> | ||||
|                 <otherwise> | ||||
| @@ -104,7 +105,7 @@ | ||||
|             <foreach collection="children" item="identifier" | ||||
|                      open="(" separator="," close=")"> | ||||
|                 <choose> | ||||
|                     <when test="caseSensitive"> | ||||
|                     <when test="caseSensitivity.caseSensitiveUsernames()"> | ||||
|                         #{identifier} | ||||
|                     </when> | ||||
|                     <otherwise> | ||||
|   | ||||
| @@ -43,8 +43,9 @@ | ||||
|         WHERE | ||||
|             guacamole_user_group.user_group_id IN ( | ||||
|                 <include refid="org.apache.guacamole.auth.jdbc.usergroup.UserGroupMapper.getReadableIDs"> | ||||
|                     <property name="entityID" value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"   value="effectiveGroups"/> | ||||
|                     <property name="entityID"        value="#{user.entityID,jdbcType=INTEGER}"/> | ||||
|                     <property name="groups"          value="effectiveGroups"/> | ||||
|                     <property name="caseSensitivity" value="${caseSensitivity}"/> | ||||
|                 </include> | ||||
|             ) | ||||
|             AND guacamole_user_group_member.member_entity_id = #{parent.entityID,jdbcType=INTEGER} | ||||
| @@ -60,11 +61,24 @@ | ||||
|             AND guacamole_user_group.user_group_id = guacamole_user_group_member.user_group_id | ||||
|             AND guacamole_entity.entity_id = guacamole_user_group.entity_id | ||||
|             AND guacamole_entity.type = 'USER_GROUP'::guacamole_entity_type | ||||
|             AND guacamole_entity.name IN | ||||
|                 <foreach collection="children" item="identifier" | ||||
|                          open="(" separator="," close=")"> | ||||
|                     #{identifier,jdbcType=VARCHAR} | ||||
|                 </foreach> | ||||
|             AND  | ||||
|             <choose> | ||||
|                 <when test="caseSensitivity.caseSensitiveGroupNames()"> | ||||
|                     guacamole_entity.name IN | ||||
|                     <foreach collection="children" item="identifier" | ||||
|                              open="(" separator="," close=")"> | ||||
|                         #{identifier,jdbcType=VARCHAR} | ||||
|                     </foreach> | ||||
|                 </when> | ||||
|                 <otherwise> | ||||
|                     LOWER(guacamole_entity.name) IN | ||||
|                     <foreach collection="children" item="identifier" | ||||
|                              open="(" separator="," close=")"> | ||||
|                         LOWER(#{identifier,jdbcType=VARCHAR}) | ||||
|                     </foreach> | ||||
|                 </otherwise> | ||||
|             </choose> | ||||
|                  | ||||
|     </delete> | ||||
|  | ||||
|     <!-- Insert parent groups by name --> | ||||
| @@ -78,13 +92,24 @@ | ||||
|             #{parent.entityID,jdbcType=INTEGER} | ||||
|         FROM guacamole_user_group | ||||
|         JOIN guacamole_entity ON guacamole_user_group.entity_id = guacamole_entity.entity_id | ||||
|         WHERE | ||||
|             guacamole_entity.name IN | ||||
|                 <foreach collection="children" item="identifier" | ||||
|                          open="(" separator="," close=")"> | ||||
|                     #{identifier,jdbcType=VARCHAR} | ||||
|                 </foreach> | ||||
|             AND guacamole_entity.type = 'USER_GROUP'::guacamole_entity_type | ||||
|         WHERE guacamole_entity.type = 'USER_GROUP'::guacamole_entity_type | ||||
|             AND | ||||
|             <choose> | ||||
|                 <when test="caseSensitivity.caseSensitiveGroupNames()"> | ||||
|                     guacamole_entity.name IN | ||||
|                     <foreach collection="children" item="identifier" | ||||
|                              open="(" separator="," close=")"> | ||||
|                         #{identifier,jdbcType=VARCHAR} | ||||
|                     </foreach>  | ||||
|                 </when> | ||||
|                 <otherwise> | ||||
|                     LOWER(guacamole_entity.name) IN | ||||
|                     <foreach collection="children" item="identifier" | ||||
|                              open="(" separator="," close=")"> | ||||
|                         LOWER(#{identifier,jdbcType=VARCHAR}) | ||||
|                     </foreach>  | ||||
|                 </otherwise> | ||||
|             </choose> | ||||
|             AND guacamole_user_group.user_group_id NOT IN ( | ||||
|                 SELECT guacamole_user_group_member.user_group_id | ||||
|                 FROM guacamole_user_group_member | ||||
|   | ||||
		Reference in New Issue
	
	Block a user