You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by vn...@apache.org on 2018/10/01 18:08:28 UTC
[27/38] guacamole-client git commit: GUACAMOLE-220: Detect cycles
within recursive query. SQL Server cannot deal with cycles on its own.
GUACAMOLE-220: Detect cycles within recursive query. SQL Server cannot deal with cycles on its own.
Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/8399b252
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/8399b252
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/8399b252
Branch: refs/heads/master
Commit: 8399b252cd335d4d0e4b977cd8613e0fe2ed4a4a
Parents: ee35620
Author: Michael Jumper <mj...@apache.org>
Authored: Sun Sep 16 22:33:12 2018 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Wed Sep 19 23:56:53 2018 -0700
----------------------------------------------------------------------
.../apache/guacamole/auth/jdbc/base/EntityMapper.xml | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/8399b252/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/base/EntityMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/base/EntityMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/base/EntityMapper.xml
index f61463a..a13279e 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/base/EntityMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/base/EntityMapper.xml
@@ -65,9 +65,10 @@
<!-- Select names of all effective groups (including inherited) -->
<select id="selectEffectiveGroupIdentifiers" resultType="string">
- WITH [related_entity] ([entity_id]) AS (
+ WITH [related_entity] ([entity_id], [path]) AS (
SELECT
- [guacamole_user_group].entity_id
+ [guacamole_user_group].entity_id,
+ '{' + CAST([guacamole_user_group].entity_id AS VARCHAR(MAX)) + '}'
FROM [guacamole_user_group]
JOIN [guacamole_user_group_member] ON [guacamole_user_group].user_group_id = [guacamole_user_group_member].user_group_id
WHERE
@@ -76,7 +77,8 @@
<if test="!effectiveGroups.isEmpty()">
UNION ALL
SELECT
- [guacamole_entity].entity_id
+ [guacamole_entity].entity_id,
+ '{' + CAST([guacamole_entity].entity_id AS VARCHAR(MAX)) + '}'
FROM [guacamole_entity]
JOIN [guacamole_user_group] ON [guacamole_user_group].entity_id = [guacamole_entity].entity_id
WHERE
@@ -90,12 +92,14 @@
</if>
UNION ALL
SELECT
- [guacamole_user_group].entity_id
+ [guacamole_user_group].entity_id,
+ [related_entity].path + '{' + CAST([guacamole_user_group].entity_id AS VARCHAR(MAX)) + '}'
FROM [related_entity]
JOIN [guacamole_user_group_member] ON [related_entity].entity_id = [guacamole_user_group_member].member_entity_id
JOIN [guacamole_user_group] ON [guacamole_user_group].user_group_id = [guacamole_user_group_member].user_group_id
WHERE
[guacamole_user_group].disabled = 0
+ AND [related_entity].path NOT LIKE '%{' + CAST([guacamole_user_group].entity_id AS VARCHAR(MAX)) + '}%'
)
SELECT DISTINCT name
FROM [related_entity]