diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionMapper.xml
index 0b109f6ba..c238c78e7 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionMapper.xml
@@ -68,7 +68,7 @@
SELECT connection_id
FROM guacamole_connection_permission
WHERE
- user_id = #{user.objectID,jdbcType=INTEGER}
+ entity_id = #{user.entityID,jdbcType=INTEGER}
AND permission = 'READ'
@@ -89,7 +89,7 @@
WHERE
parent_id = #{parentIdentifier,jdbcType=INTEGER}::integer
parent_id IS NULL
- AND user_id = #{user.objectID,jdbcType=INTEGER}
+ AND entity_id = #{user.entityID,jdbcType=INTEGER}
AND permission = 'READ'
@@ -165,7 +165,7 @@
open="(" separator="," close=")">
#{identifier,jdbcType=INTEGER}::integer
- AND guacamole_connection_permission.user_id = #{user.objectID,jdbcType=INTEGER}
+ AND guacamole_connection_permission.entity_id = #{user.entityID,jdbcType=INTEGER}
AND permission = 'READ'
GROUP BY guacamole_connection.connection_id;
@@ -177,7 +177,7 @@
open="(" separator="," close=")">
#{identifier,jdbcType=INTEGER}::integer
- AND user_id = #{user.objectID,jdbcType=INTEGER}
+ AND entity_id = #{user.entityID,jdbcType=INTEGER}
AND permission = 'READ';
SELECT
@@ -191,7 +191,7 @@
open="(" separator="," close=")">
#{identifier,jdbcType=INTEGER}::integer
- AND user_id = #{user.objectID,jdbcType=INTEGER}
+ AND entity_id = #{user.entityID,jdbcType=INTEGER}
AND permission = 'READ';
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
index 4545332b5..b4407bd08 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
@@ -79,7 +79,10 @@
#{record.sharingProfileIdentifier,jdbcType=INTEGER}::integer,
#{record.sharingProfileName,jdbcType=VARCHAR},
(SELECT user_id FROM guacamole_user
- WHERE username = #{record.username,jdbcType=VARCHAR}),
+ JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id
+ WHERE
+ guacamole_entity.name = #{record.username,jdbcType=VARCHAR}
+ AND guacamole_entity.type = 'USER'::guacamole_entity_type),
#{record.username,jdbcType=VARCHAR},
#{record.startDate,jdbcType=TIMESTAMP},
#{record.endDate,jdbcType=TIMESTAMP}
@@ -180,7 +183,10 @@
guacamole_connection_history.user_id IN (
SELECT user_id
FROM guacamole_user
- WHERE POSITION(#{term.term,jdbcType=VARCHAR} IN username) > 0
+ JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id
+ WHERE
+ POSITION(#{term.term,jdbcType=VARCHAR} IN guacamole_entity.name) > 0
+ AND guacamole_entity.type = 'USER'::guacamole_entity_type
)
OR guacamole_connection_history.connection_id IN (
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/connectiongroup/ConnectionGroupMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/connectiongroup/ConnectionGroupMapper.xml
index 7cc4ac7fa..7e0b1883e 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/connectiongroup/ConnectionGroupMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/connectiongroup/ConnectionGroupMapper.xml
@@ -69,7 +69,7 @@
SELECT connection_group_id
FROM guacamole_connection_group_permission
WHERE
- user_id = #{user.objectID,jdbcType=INTEGER}
+ entity_id = #{user.entityID,jdbcType=INTEGER}
AND permission = 'READ'
@@ -90,7 +90,7 @@
WHERE
parent_id = #{parentIdentifier,jdbcType=INTEGER}::integer
parent_id IS NULL
- AND user_id = #{user.objectID,jdbcType=INTEGER}
+ AND entity_id = #{user.entityID,jdbcType=INTEGER}
AND permission = 'READ'
@@ -161,7 +161,7 @@
open="(" separator="," close=")">
#{identifier,jdbcType=INTEGER}::integer
- AND user_id = #{user.objectID,jdbcType=INTEGER}
+ AND entity_id = #{user.entityID,jdbcType=INTEGER}
AND permission = 'READ';
SELECT parent_id, guacamole_connection_group.connection_group_id
@@ -172,7 +172,7 @@
open="(" separator="," close=")">
#{identifier,jdbcType=INTEGER}::integer
- AND user_id = #{user.objectID,jdbcType=INTEGER}
+ AND entity_id = #{user.entityID,jdbcType=INTEGER}
AND permission = 'READ';
SELECT parent_id, guacamole_connection.connection_id
@@ -183,7 +183,7 @@
open="(" separator="," close=")">
#{identifier,jdbcType=INTEGER}::integer
- AND user_id = #{user.objectID,jdbcType=INTEGER}
+ AND entity_id = #{user.entityID,jdbcType=INTEGER}
AND permission = 'READ';
SELECT
@@ -197,7 +197,7 @@
open="(" separator="," close=")">
#{identifier,jdbcType=INTEGER}::integer
- AND user_id = #{user.objectID,jdbcType=INTEGER}
+ AND entity_id = #{user.entityID,jdbcType=INTEGER}
AND permission = 'READ';
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionGroupPermissionMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionGroupPermissionMapper.xml
index 5ab114a43..c8ec936fc 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionGroupPermissionMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionGroupPermissionMapper.xml
@@ -25,24 +25,21 @@
-
-
+
-
+
@@ -50,26 +47,24 @@
-
+
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/user/PasswordRecordMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/user/PasswordRecordMapper.xml
index 41591fada..e9c857afd 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/user/PasswordRecordMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/user/PasswordRecordMapper.xml
@@ -41,8 +41,9 @@
guacamole_user_password_history.password_date
FROM guacamole_user_password_history
JOIN guacamole_user ON guacamole_user_password_history.user_id = guacamole_user.user_id
+ JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id
WHERE
- guacamole_user.username = #{username,jdbcType=VARCHAR}
+ guacamole_entity.name = #{username,jdbcType=VARCHAR}
ORDER BY
guacamole_user_password_history.password_date DESC
LIMIT #{maxHistorySize}
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserMapper.xml
index e183fe295..796962d69 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserMapper.xml
@@ -28,7 +28,8 @@
-
+
+
@@ -57,17 +58,20 @@
- SELECT username
- FROM guacamole_user
+ SELECT name
+ FROM guacamole_entity
+ WHERE guacamole_entity.type = 'USER'::guacamole_entity_type
- SELECT username
+ SELECT guacamole_entity.name
FROM guacamole_user
+ JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id
JOIN guacamole_user_permission ON affected_user_id = guacamole_user.user_id
WHERE
- guacamole_user_permission.user_id = #{user.objectID,jdbcType=INTEGER}
+ guacamole_user_permission.entity_id = #{user.entityID,jdbcType=INTEGER}
+ AND guacamole_entity.type = 'USER'::guacamole_entity_type
AND permission = 'READ'
@@ -77,7 +81,8 @@
SELECT
guacamole_user.user_id,
- guacamole_user.username,
+ guacamole_entity.entity_id,
+ guacamole_entity.name,
password_hash,
password_salt,
password_date,
@@ -94,13 +99,15 @@
organizational_role,
MAX(start_date) AS last_active
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 guacamole_user.username IN
+ WHERE guacamole_entity.name IN
#{identifier,jdbcType=VARCHAR}
- GROUP BY guacamole_user.user_id;
+ AND guacamole_entity.type = 'USER'::guacamole_entity_type
+ GROUP BY guacamole_user.user_id, guacamole_entity.entity_id;
SELECT
guacamole_user_attribute.user_id,
@@ -108,11 +115,13 @@
guacamole_user_attribute.attribute_value
FROM guacamole_user_attribute
JOIN guacamole_user ON guacamole_user.user_id = guacamole_user_attribute.user_id
- WHERE username IN
+ JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id
+ WHERE guacamole_entity.name IN
#{identifier,jdbcType=VARCHAR}
- ;
+
+ AND guacamole_entity.type = 'USER'::guacamole_entity_type;
@@ -122,7 +131,8 @@
SELECT
guacamole_user.user_id,
- guacamole_user.username,
+ guacamole_entity.entity_id,
+ guacamole_entity.name,
password_hash,
password_salt,
password_date,
@@ -139,16 +149,18 @@
organizational_role,
MAX(start_date) AS last_active
FROM guacamole_user
+ JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id
JOIN guacamole_user_permission ON affected_user_id = guacamole_user.user_id
LEFT JOIN guacamole_user_history ON guacamole_user_history.user_id = guacamole_user.user_id
- WHERE guacamole_user.username IN
+ WHERE guacamole_entity.name IN
#{identifier,jdbcType=VARCHAR}
- AND guacamole_user_permission.user_id = #{user.objectID,jdbcType=INTEGER}
+ AND guacamole_entity.type = 'USER'::guacamole_entity_type
+ AND guacamole_user_permission.entity_id = #{user.entityID,jdbcType=INTEGER}
AND permission = 'READ'
- GROUP BY guacamole_user.user_id;
+ GROUP BY guacamole_user.user_id, guacamole_entity.entity_id;
SELECT
guacamole_user_attribute.user_id,
@@ -156,13 +168,15 @@
guacamole_user_attribute.attribute_value
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
JOIN guacamole_user_permission ON affected_user_id = guacamole_user.user_id
- WHERE username IN
+ WHERE guacamole_entity.name IN
#{identifier,jdbcType=VARCHAR}
- AND guacamole_user_permission.user_id = #{user.objectID,jdbcType=INTEGER}
+ AND guacamole_entity.type = 'USER'::guacamole_entity_type
+ AND guacamole_user_permission.entity_id = #{user.entityID,jdbcType=INTEGER}
AND permission = 'READ';
@@ -173,7 +187,8 @@
SELECT
guacamole_user.user_id,
- guacamole_user.username,
+ guacamole_entity.entity_id,
+ guacamole_entity.name,
password_hash,
password_salt,
password_date,
@@ -190,10 +205,12 @@
organizational_role,
MAX(start_date) AS last_active
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
- guacamole_user.username = #{username,jdbcType=VARCHAR}
- GROUP BY guacamole_user.user_id;
+ guacamole_entity.name = #{username,jdbcType=VARCHAR}
+ AND guacamole_entity.type = 'USER'::guacamole_entity_type
+ GROUP BY guacamole_user.user_id, guacamole_entity.entity_id;
SELECT
guacamole_user_attribute.user_id,
@@ -201,14 +218,19 @@
guacamole_user_attribute.attribute_value
FROM guacamole_user_attribute
JOIN guacamole_user ON guacamole_user.user_id = guacamole_user_attribute.user_id
- WHERE username = #{username,jdbcType=VARCHAR};
+ JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id
+ WHERE
+ guacamole_entity.name = #{username,jdbcType=VARCHAR}
+ AND guacamole_entity.type = 'USER'::guacamole_entity_type
- DELETE FROM guacamole_user
- WHERE username = #{identifier,jdbcType=VARCHAR}
+ DELETE FROM guacamole_entity
+ WHERE
+ name = #{identifier,jdbcType=VARCHAR}
+ AND type = 'USER'::guacamole_entity_type
@@ -216,7 +238,7 @@
parameterType="org.apache.guacamole.auth.jdbc.user.UserModel">
INSERT INTO guacamole_user (
- username,
+ entity_id,
password_hash,
password_salt,
password_date,
@@ -233,7 +255,7 @@
organizational_role
)
VALUES (
- #{object.identifier,jdbcType=VARCHAR},
+ #{object.entityID,jdbcType=VARCHAR},
#{object.passwordHash,jdbcType=BINARY},
#{object.passwordSalt,jdbcType=BINARY},
#{object.passwordDate,jdbcType=TIMESTAMP},
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserRecordMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserRecordMapper.xml
index 014b38aca..20cb2a809 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserRecordMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserRecordMapper.xml
@@ -44,8 +44,9 @@
guacamole_user_history.end_date
FROM guacamole_user_history
JOIN guacamole_user ON guacamole_user_history.user_id = guacamole_user.user_id
+ JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id
WHERE
- guacamole_user.username = #{username,jdbcType=VARCHAR}
+ guacamole_entity.name = #{username,jdbcType=VARCHAR}
ORDER BY
guacamole_user_history.start_date DESC,
guacamole_user_history.end_date DESC
@@ -66,7 +67,10 @@
VALUES (
#{record.remoteHost,jdbcType=VARCHAR},
(SELECT user_id FROM guacamole_user
- WHERE username = #{record.username,jdbcType=VARCHAR}),
+ JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id
+ WHERE
+ guacamole_entity.name = #{record.username,jdbcType=VARCHAR}
+ AND guacamole_entity.type = 'USER'::guacamole_entity_type),
#{record.username,jdbcType=VARCHAR},
#{record.startDate,jdbcType=TIMESTAMP},
#{record.endDate,jdbcType=TIMESTAMP}
@@ -79,7 +83,10 @@
UPDATE guacamole_user_history
SET remote_host = #{record.remoteHost,jdbcType=VARCHAR},
user_id = (SELECT user_id FROM guacamole_user
- WHERE username = #{record.username,jdbcType=VARCHAR}),
+ JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id
+ WHERE
+ guacamole_entity.name = #{record.username,jdbcType=VARCHAR}
+ AND guacamole_entity.type = 'USER'::guacamole_entity_type),
username = #{record.username,jdbcType=VARCHAR},
start_date = #{record.startDate,jdbcType=TIMESTAMP},
end_date = #{record.endDate,jdbcType=TIMESTAMP}
@@ -105,7 +112,10 @@
guacamole_user_history.user_id IN (
SELECT user_id
FROM guacamole_user
- WHERE POSITION(#{term.term,jdbcType=VARCHAR} IN username) > 0
+ JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id
+ WHERE
+ POSITION(#{term.term,jdbcType=VARCHAR} IN guacamole_entity.name) > 0
+ AND guacamole_entity.type = 'USER'::guacamole_entity_type),
)
@@ -157,7 +167,10 @@
guacamole_user_history.user_id IN (
SELECT user_id
FROM guacamole_user
- WHERE POSITION(#{term.term,jdbcType=VARCHAR} IN username) > 0
+ JOIN guacamole_entity ON guacamole_user.entity_id = guacamole_entity.entity_id
+ WHERE
+ POSITION(#{term.term,jdbcType=VARCHAR} IN guacamole_entity.name) > 0
+ AND guacamole_entity.type = 'USER'::guacamole_entity_type
)