mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-715: Include all provided effective user groups that exist within the database in results of effective groups query, regardless of whether the user is declared as a member of those groups within the database.
While this query is generally functioning as described above for all supported databases, it is not functioning properly for the non-recursive variant of the MySQL/MariaDB query. This change corrects that behavior.
This commit is contained in:
@@ -73,27 +73,31 @@
|
||||
JOIN guacamole_user_group_member ON guacamole_user_group.user_group_id = guacamole_user_group_member.user_group_id
|
||||
WHERE
|
||||
guacamole_user_group.disabled = false
|
||||
AND (
|
||||
guacamole_user_group_member.member_entity_id = #{entity.entityID}
|
||||
<if test="!effectiveGroups.isEmpty()">
|
||||
OR guacamole_user_group_member.member_entity_id IN (
|
||||
SELECT entity_id FROM guacamole_entity
|
||||
WHERE type = 'USER_GROUP' AND name IN
|
||||
<foreach collection="effectiveGroups" item="effectiveGroup"
|
||||
open="(" separator="," close=")">
|
||||
#{effectiveGroup,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
)
|
||||
OR guacamole_user_group.entity_id IN (
|
||||
SELECT entity_id FROM guacamole_entity
|
||||
WHERE type = 'USER_GROUP' AND name IN
|
||||
<foreach collection="effectiveGroups" item="effectiveGroup"
|
||||
open="(" separator="," close=")">
|
||||
#{effectiveGroup,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
)
|
||||
AND guacamole_user_group_member.member_entity_id = #{entity.entityID}
|
||||
<if test="!effectiveGroups.isEmpty()">
|
||||
UNION SELECT
|
||||
guacamole_entity.name
|
||||
FROM guacamole_user_group
|
||||
JOIN guacamole_entity ON guacamole_user_group.entity_id = guacamole_entity.entity_id
|
||||
JOIN guacamole_user_group_member ON guacamole_user_group.user_group_id = guacamole_user_group_member.user_group_id
|
||||
JOIN guacamole_entity member_entity ON guacamole_user_group_member.member_entity_id = member_entity.entity_id
|
||||
WHERE
|
||||
guacamole_user_group.disabled = false
|
||||
AND member_entity.type = 'USER_GROUP' AND member_entity.name IN
|
||||
<foreach collection="effectiveGroups" item="effectiveGroup"
|
||||
open="(" separator="," close=")">
|
||||
#{effectiveGroup,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
UNION SELECT
|
||||
guacamole_entity.name
|
||||
FROM guacamole_user_group
|
||||
JOIN guacamole_entity ON guacamole_user_group.entity_id = guacamole_entity.entity_id
|
||||
WHERE type = 'USER_GROUP' AND name IN
|
||||
<foreach collection="effectiveGroups" item="effectiveGroup"
|
||||
open="(" separator="," close=")">
|
||||
#{effectiveGroup,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</if>
|
||||
</if>
|
||||
|
||||
<if test="recursive">
|
||||
|
Reference in New Issue
Block a user