GUACAMOLE-363: Standardize table names with other JDBC modules; switch back to dbo schema for now.

This commit is contained in:
Nick Couchman
2017-08-27 16:08:33 -04:00
parent c803be5c7a
commit 66c4b86b0a
15 changed files with 316 additions and 316 deletions

View File

@@ -20,13 +20,13 @@
/** /**
* Create the guacamole schema. * Create the guacamole schema.
*/ */
CREATE SCHEMA [guacamole] CREATE SCHEMA [dbo]
GO GO
/** /**
* List for permission data type. * List for permission data type.
*/ */
CREATE RULE [guacamole].[guacamole_permission_list] CREATE RULE [dbo].[guacamole_permission_list]
AS AS
@list IN ('READ','UPDATE','DELETE','ADMINISTER') @list IN ('READ','UPDATE','DELETE','ADMINISTER')
GO GO
@@ -34,7 +34,7 @@ GO
/** /**
* List for system permission data type. * List for system permission data type.
*/ */
CREATE RULE [guacamole].[guacamole_system_permission_list] CREATE RULE [dbo].[guacamole_system_permission_list]
AS AS
@list IN ('CREATE_CONNECTION', @list IN ('CREATE_CONNECTION',
'CREATE_CONNECTION_GROUP', 'CREATE_CONNECTION_GROUP',
@@ -46,12 +46,12 @@ GO
/** /**
* The permission data type. * The permission data type.
*/ */
CREATE TYPE [guacamole].[guacamole_permission] FROM [nvarchar](10) NOT NULL CREATE TYPE [dbo].[guacamole_permission] FROM [nvarchar](10) NOT NULL
/** /**
* The system permission data type. * The system permission data type.
*/ */
CREATE TYPE [guacamole].[guacamole_system_permission] FROM [nvarchar](32) NOT NULL CREATE TYPE [dbo].[guacamole_system_permission] FROM [nvarchar](32) NOT NULL
GO GO
/** /**
@@ -59,7 +59,7 @@ GO
*/ */
SET ANSI_NULLS ON SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON SET QUOTED_IDENTIFIER ON
CREATE TABLE [guacamole].[guacamole_connection_group]( CREATE TABLE [dbo].[guacamole_connection_group](
[connection_group_id] [int] IDENTITY(1,1) NOT NULL, [connection_group_id] [int] IDENTITY(1,1) NOT NULL,
[parent_id] [int] NULL, [parent_id] [int] NULL,
[connection_group_name] [nvarchar](128) NOT NULL, [connection_group_name] [nvarchar](128) NOT NULL,
@@ -81,23 +81,23 @@ CREATE TABLE [guacamole].[guacamole_connection_group](
/** /**
* Foreign keys for connection_group table. * Foreign keys for connection_group table.
*/ */
ALTER TABLE [guacamole].[guacamole_connection_group] ALTER TABLE [dbo].[guacamole_connection_group]
WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_group_connection_group_id] FOREIGN KEY([parent_id]) WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_group_connection_group_id] FOREIGN KEY([parent_id])
REFERENCES [guacamole].[guacamole_connection_group] ([connection_group_id]) REFERENCES [dbo].[guacamole_connection_group] ([connection_group_id])
ALTER TABLE [guacamole].[guacamole_connection_group] ALTER TABLE [dbo].[guacamole_connection_group]
CHECK CONSTRAINT [FK_guacamole_connection_group_connection_group_id] CHECK CONSTRAINT [FK_guacamole_connection_group_connection_group_id]
ALTER TABLE [guacamole].[guacamole_connection_group] ALTER TABLE [dbo].[guacamole_connection_group]
WITH CHECK ADD CONSTRAINT [CK_guacamole_connection_group_type] WITH CHECK ADD CONSTRAINT [CK_guacamole_connection_group_type]
CHECK (([type]='BALANCING' OR [type]='ORGANIZATIONAL')) CHECK (([type]='BALANCING' OR [type]='ORGANIZATIONAL'))
ALTER TABLE [guacamole].[guacamole_connection_group] ALTER TABLE [dbo].[guacamole_connection_group]
CHECK CONSTRAINT [CK_guacamole_connection_group_type] CHECK CONSTRAINT [CK_guacamole_connection_group_type]
/** /**
* Default values for connection_group table. * Default values for connection_group table.
*/ */
ALTER TABLE [guacamole].[guacamole_connection_group] ALTER TABLE [dbo].[guacamole_connection_group]
ADD CONSTRAINT [DF_guacamole_connection_group_type] DEFAULT (N'ORGANIZATIONAL') FOR [type] ADD CONSTRAINT [DF_guacamole_connection_group_type] DEFAULT (N'ORGANIZATIONAL') FOR [type]
ALTER TABLE [guacamole].[guacamole_connection_group] ALTER TABLE [dbo].[guacamole_connection_group]
ADD CONSTRAINT [DF_guacamole_connection_group_enable_session_affinity] DEFAULT ((0)) FOR [enable_session_affinity] ADD CONSTRAINT [DF_guacamole_connection_group_enable_session_affinity] DEFAULT ((0)) FOR [enable_session_affinity]
GO GO
@@ -106,7 +106,7 @@ GO
*/ */
SET ANSI_NULLS ON SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON SET QUOTED_IDENTIFIER ON
CREATE TABLE [guacamole].[guacamole_connection]( CREATE TABLE [dbo].[guacamole_connection](
[connection_id] [int] IDENTITY(1,1) NOT NULL, [connection_id] [int] IDENTITY(1,1) NOT NULL,
[connection_name] [nvarchar](128) NOT NULL, [connection_name] [nvarchar](128) NOT NULL,
[parent_id] [int] NULL, [parent_id] [int] NULL,
@@ -129,17 +129,17 @@ CREATE TABLE [guacamole].[guacamole_connection](
ON [PRIMARY] ON [PRIMARY]
) ON [PRIMARY] ) ON [PRIMARY]
ALTER TABLE [guacamole].[guacamole_connection] ALTER TABLE [dbo].[guacamole_connection]
WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_connection_group] FOREIGN KEY([parent_id]) WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_connection_group] FOREIGN KEY([parent_id])
REFERENCES [guacamole].[guacamole_connection_group] ([connection_group_id]) REFERENCES [dbo].[guacamole_connection_group] ([connection_group_id])
ALTER TABLE [guacamole].[guacamole_connection] ALTER TABLE [dbo].[guacamole_connection]
CHECK CONSTRAINT [FK_guacamole_connection_connection_group] CHECK CONSTRAINT [FK_guacamole_connection_connection_group]
ALTER TABLE [guacamole].[guacamole_connection] ALTER TABLE [dbo].[guacamole_connection]
WITH CHECK ADD CONSTRAINT [CK_proxy_encryption_method] WITH CHECK ADD CONSTRAINT [CK_proxy_encryption_method]
CHECK (([proxy_encryption_method]='SSL' OR [proxy_encryption_method]='NONE')) CHECK (([proxy_encryption_method]='SSL' OR [proxy_encryption_method]='NONE'))
ALTER TABLE [guacamole].[guacamole_connection] ALTER TABLE [dbo].[guacamole_connection]
CHECK CONSTRAINT [CK_proxy_encryption_method] CHECK CONSTRAINT [CK_proxy_encryption_method]
ALTER TABLE [guacamole].[guacamole_connection] ALTER TABLE [dbo].[guacamole_connection]
ADD CONSTRAINT [DF_guacamole_connection_failover_only] DEFAULT ((0)) FOR [failover_only] ADD CONSTRAINT [DF_guacamole_connection_failover_only] DEFAULT ((0)) FOR [failover_only]
GO GO
@@ -148,7 +148,7 @@ GO
*/ */
SET ANSI_NULLS ON SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON SET QUOTED_IDENTIFIER ON
CREATE TABLE [guacamole].[guacamole_user]( CREATE TABLE [dbo].[guacamole_user](
[user_id] [int] IDENTITY(1,1) NOT NULL, [user_id] [int] IDENTITY(1,1) NOT NULL,
[username] [nvarchar](128) NOT NULL, [username] [nvarchar](128) NOT NULL,
[password_hash] [binary](32) NOT NULL, [password_hash] [binary](32) NOT NULL,
@@ -179,9 +179,9 @@ CREATE TABLE [guacamole].[guacamole_user](
/** /**
* Defaults for user table * Defaults for user table
*/ */
ALTER TABLE [guacamole].[guacamole_user] ALTER TABLE [dbo].[guacamole_user]
ADD CONSTRAINT [DF_guacamole_user_disabled] DEFAULT ((0)) FOR [disabled] ADD CONSTRAINT [DF_guacamole_user_disabled] DEFAULT ((0)) FOR [disabled]
ALTER TABLE [guacamole].[guacamole_user] ALTER TABLE [dbo].[guacamole_user]
ADD CONSTRAINT [DF_guacamole_user_expired] DEFAULT ((0)) FOR [expired] ADD CONSTRAINT [DF_guacamole_user_expired] DEFAULT ((0)) FOR [expired]
GO GO
@@ -191,7 +191,7 @@ GO
*/ */
SET ANSI_NULLS ON SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON SET QUOTED_IDENTIFIER ON
CREATE TABLE [guacamole].[guacamole_sharing_profile]( CREATE TABLE [dbo].[guacamole_sharing_profile](
[sharing_profile_id] [int] IDENTITY(1,1) NOT NULL, [sharing_profile_id] [int] IDENTITY(1,1) NOT NULL,
[sharing_profile_name] [nvarchar](128) NOT NULL, [sharing_profile_name] [nvarchar](128) NOT NULL,
[primary_connection_id] [int] NOT NULL, [primary_connection_id] [int] NOT NULL,
@@ -209,12 +209,12 @@ CREATE TABLE [guacamole].[guacamole_sharing_profile](
/** /**
* Foreign keys for sharing_profile table. * Foreign keys for sharing_profile table.
*/ */
ALTER TABLE [guacamole].[guacamole_sharing_profile] ALTER TABLE [dbo].[guacamole_sharing_profile]
WITH CHECK ADD CONSTRAINT [FK_guacamole_sharing_profile_connection] FOREIGN KEY([primary_connection_id]) WITH CHECK ADD CONSTRAINT [FK_guacamole_sharing_profile_connection] FOREIGN KEY([primary_connection_id])
REFERENCES [guacamole].[guacamole_connection] ([connection_id]) REFERENCES [dbo].[guacamole_connection] ([connection_id])
ON UPDATE CASCADE ON UPDATE CASCADE
ON DELETE CASCADE ON DELETE CASCADE
ALTER TABLE [guacamole].[guacamole_sharing_profile] ALTER TABLE [dbo].[guacamole_sharing_profile]
CHECK CONSTRAINT [FK_guacamole_sharing_profile_connection] CHECK CONSTRAINT [FK_guacamole_sharing_profile_connection]
GO GO
@@ -224,7 +224,7 @@ GO
*/ */
SET ANSI_NULLS ON SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON SET QUOTED_IDENTIFIER ON
CREATE TABLE [guacamole].[guacamole_connection_parameter]( CREATE TABLE [dbo].[guacamole_connection_parameter](
[connection_id] [int] NOT NULL, [connection_id] [int] NOT NULL,
[parameter_name] [nvarchar](128) NOT NULL, [parameter_name] [nvarchar](128) NOT NULL,
[parameter_value] [nvarchar](max) NOT NULL, [parameter_value] [nvarchar](max) NOT NULL,
@@ -242,12 +242,12 @@ CREATE TABLE [guacamole].[guacamole_connection_parameter](
/** /**
* Foreign keys for the connection_parameter table. * Foreign keys for the connection_parameter table.
*/ */
ALTER TABLE [guacamole].[guacamole_connection_parameter] ALTER TABLE [dbo].[guacamole_connection_parameter]
WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_parameter_connection] FOREIGN KEY([connection_id]) WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_parameter_connection] FOREIGN KEY([connection_id])
REFERENCES [guacamole].[guacamole_connection] ([connection_id]) REFERENCES [dbo].[guacamole_connection] ([connection_id])
ON UPDATE CASCADE ON UPDATE CASCADE
ON DELETE CASCADE ON DELETE CASCADE
ALTER TABLE [guacamole].[guacamole_connection_parameter] ALTER TABLE [dbo].[guacamole_connection_parameter]
CHECK CONSTRAINT [FK_guacamole_connection_parameter_connection] CHECK CONSTRAINT [FK_guacamole_connection_parameter_connection]
GO GO
@@ -257,7 +257,7 @@ GO
*/ */
SET ANSI_NULLS ON SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON SET QUOTED_IDENTIFIER ON
CREATE TABLE [guacamole].[guacamole_sharing_profile_parameter]( CREATE TABLE [dbo].[guacamole_sharing_profile_parameter](
[sharing_profile_id] [int] NOT NULL, [sharing_profile_id] [int] NOT NULL,
[parameter_name] [nvarchar](128) NOT NULL, [parameter_name] [nvarchar](128) NOT NULL,
[parameter_value] [nvarchar](max) NOT NULL, [parameter_value] [nvarchar](max) NOT NULL,
@@ -276,12 +276,12 @@ CREATE TABLE [guacamole].[guacamole_sharing_profile_parameter](
* Foreign keys for the sharing_profile_parameter * Foreign keys for the sharing_profile_parameter
* table. * table.
*/ */
ALTER TABLE [guacamole].[guacamole_sharing_profile_parameter] ALTER TABLE [dbo].[guacamole_sharing_profile_parameter]
WITH CHECK ADD CONSTRAINT [FK_guacamole_sharing_profile_parameter_sharing_profile] FOREIGN KEY([sharing_profile_id]) WITH CHECK ADD CONSTRAINT [FK_guacamole_sharing_profile_parameter_sharing_profile] FOREIGN KEY([sharing_profile_id])
REFERENCES [guacamole].[guacamole_sharing_profile] ([sharing_profile_id]) REFERENCES [dbo].[guacamole_sharing_profile] ([sharing_profile_id])
ON UPDATE CASCADE ON UPDATE CASCADE
ON DELETE CASCADE ON DELETE CASCADE
ALTER TABLE [guacamole].[guacamole_sharing_profile_parameter] ALTER TABLE [dbo].[guacamole_sharing_profile_parameter]
CHECK CONSTRAINT [FK_guacamole_sharing_profile_parameter_sharing_profile] CHECK CONSTRAINT [FK_guacamole_sharing_profile_parameter_sharing_profile]
GO GO
@@ -291,10 +291,10 @@ GO
*/ */
SET ANSI_NULLS ON SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON SET QUOTED_IDENTIFIER ON
CREATE TABLE [guacamole].[guacamole_connection_permission]( CREATE TABLE [dbo].[guacamole_connection_permission](
[user_id] [int] NOT NULL, [user_id] [int] NOT NULL,
[connection_id] [int] NOT NULL, [connection_id] [int] NOT NULL,
[permission] [guacamole].[guacamole_permission] NOT NULL, [permission] [dbo].[guacamole_permission] NOT NULL,
CONSTRAINT [PK_guacamole_connection_permission] PRIMARY KEY CLUSTERED CONSTRAINT [PK_guacamole_connection_permission] PRIMARY KEY CLUSTERED
([user_id] ASC, [connection_id] ASC, [permission] ASC) ([user_id] ASC, [connection_id] ASC, [permission] ASC)
@@ -309,19 +309,19 @@ CREATE TABLE [guacamole].[guacamole_connection_permission](
/** /**
* Foreign keys for the connection_permission table. * Foreign keys for the connection_permission table.
*/ */
ALTER TABLE [guacamole].[guacamole_connection_permission] ALTER TABLE [dbo].[guacamole_connection_permission]
WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_permission_connection1] FOREIGN KEY([connection_id]) WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_permission_connection1] FOREIGN KEY([connection_id])
REFERENCES [guacamole].[guacamole_connection] ([connection_id]) REFERENCES [dbo].[guacamole_connection] ([connection_id])
ON UPDATE CASCADE ON UPDATE CASCADE
ON DELETE CASCADE ON DELETE CASCADE
ALTER TABLE [guacamole].[guacamole_connection_permission] ALTER TABLE [dbo].[guacamole_connection_permission]
CHECK CONSTRAINT [FK_guacamole_connection_permission_connection1] CHECK CONSTRAINT [FK_guacamole_connection_permission_connection1]
ALTER TABLE [guacamole].[guacamole_connection_permission] ALTER TABLE [dbo].[guacamole_connection_permission]
WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_permission_user1] FOREIGN KEY([user_id]) WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_permission_user1] FOREIGN KEY([user_id])
REFERENCES [guacamole].[guacamole_user] ([user_id]) REFERENCES [dbo].[guacamole_user] ([user_id])
ON UPDATE CASCADE ON UPDATE CASCADE
ON DELETE CASCADE ON DELETE CASCADE
ALTER TABLE [guacamole].[guacamole_connection_permission] ALTER TABLE [dbo].[guacamole_connection_permission]
CHECK CONSTRAINT [FK_guacamole_connection_permission_user1] CHECK CONSTRAINT [FK_guacamole_connection_permission_user1]
GO GO
@@ -331,10 +331,10 @@ GO
*/ */
SET ANSI_NULLS ON SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON SET QUOTED_IDENTIFIER ON
CREATE TABLE [guacamole].[guacamole_connection_group_permission]( CREATE TABLE [dbo].[guacamole_connection_group_permission](
[user_id] [int] NOT NULL, [user_id] [int] NOT NULL,
[connection_group_id] [int] NOT NULL, [connection_group_id] [int] NOT NULL,
[permission] [guacamole].[guacamole_permission] NOT NULL, [permission] [dbo].[guacamole_permission] NOT NULL,
CONSTRAINT [PK_guacamole_connection_group_permission] PRIMARY KEY CLUSTERED CONSTRAINT [PK_guacamole_connection_group_permission] PRIMARY KEY CLUSTERED
([user_id] ASC, [connection_group_id] ASC, [permission] ASC) ([user_id] ASC, [connection_group_id] ASC, [permission] ASC)
@@ -349,19 +349,19 @@ CREATE TABLE [guacamole].[guacamole_connection_group_permission](
/** /**
* Foreign keys for the connection_group_permission table. * Foreign keys for the connection_group_permission table.
*/ */
ALTER TABLE [guacamole].[guacamole_connection_group_permission] ALTER TABLE [dbo].[guacamole_connection_group_permission]
WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_group_permission_connection_group] FOREIGN KEY([connection_group_id]) WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_group_permission_connection_group] FOREIGN KEY([connection_group_id])
REFERENCES [guacamole].[guacamole_connection_group] ([connection_group_id]) REFERENCES [dbo].[guacamole_connection_group] ([connection_group_id])
ON UPDATE CASCADE ON UPDATE CASCADE
ON DELETE CASCADE ON DELETE CASCADE
ALTER TABLE [guacamole].[guacamole_connection_group_permission] ALTER TABLE [dbo].[guacamole_connection_group_permission]
CHECK CONSTRAINT [FK_guacamole_connection_group_permission_connection_group] CHECK CONSTRAINT [FK_guacamole_connection_group_permission_connection_group]
ALTER TABLE [guacamole].[guacamole_connection_group_permission] ALTER TABLE [dbo].[guacamole_connection_group_permission]
WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_group_permission_user] FOREIGN KEY([user_id]) WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_group_permission_user] FOREIGN KEY([user_id])
REFERENCES [guacamole].[guacamole_user] ([user_id]) REFERENCES [dbo].[guacamole_user] ([user_id])
ON UPDATE CASCADE ON UPDATE CASCADE
ON DELETE CASCADE ON DELETE CASCADE
ALTER TABLE [guacamole].[guacamole_connection_group_permission] ALTER TABLE [dbo].[guacamole_connection_group_permission]
CHECK CONSTRAINT [FK_guacamole_connection_group_permission_user] CHECK CONSTRAINT [FK_guacamole_connection_group_permission_user]
GO GO
@@ -371,10 +371,10 @@ GO
*/ */
SET ANSI_NULLS ON SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON SET QUOTED_IDENTIFIER ON
CREATE TABLE [guacamole].[guacamole_sharing_profile_permission]( CREATE TABLE [dbo].[guacamole_sharing_profile_permission](
[user_id] [int] NOT NULL, [user_id] [int] NOT NULL,
[sharing_profile_id] [int] NOT NULL, [sharing_profile_id] [int] NOT NULL,
[permission] [guacamole].[guacamole_permission] NOT NULL, [permission] [dbo].[guacamole_permission] NOT NULL,
CONSTRAINT [PK_guacamole_sharing_profile_permission] PRIMARY KEY CLUSTERED CONSTRAINT [PK_guacamole_sharing_profile_permission] PRIMARY KEY CLUSTERED
([user_id] ASC, [sharing_profile_id] ASC, [permission] ASC) ([user_id] ASC, [sharing_profile_id] ASC, [permission] ASC)
@@ -389,19 +389,19 @@ CREATE TABLE [guacamole].[guacamole_sharing_profile_permission](
/** /**
* Foreign keys for the sharing_profile_permission table. * Foreign keys for the sharing_profile_permission table.
*/ */
ALTER TABLE [guacamole].[guacamole_sharing_profile_permission] ALTER TABLE [dbo].[guacamole_sharing_profile_permission]
WITH CHECK ADD CONSTRAINT [FK_guacamole_sharing_profile_permission_sharing_profile] FOREIGN KEY([sharing_profile_id]) WITH CHECK ADD CONSTRAINT [FK_guacamole_sharing_profile_permission_sharing_profile] FOREIGN KEY([sharing_profile_id])
REFERENCES [guacamole].[guacamole_sharing_profile] ([sharing_profile_id]) REFERENCES [dbo].[guacamole_sharing_profile] ([sharing_profile_id])
ON UPDATE CASCADE ON UPDATE CASCADE
ON DELETE CASCADE ON DELETE CASCADE
ALTER TABLE [guacamole].[guacamole_sharing_profile_permission] ALTER TABLE [dbo].[guacamole_sharing_profile_permission]
CHECK CONSTRAINT [FK_guacamole_sharing_profile_permission_sharing_profile] CHECK CONSTRAINT [FK_guacamole_sharing_profile_permission_sharing_profile]
ALTER TABLE [guacamole].[guacamole_sharing_profile_permission] ALTER TABLE [dbo].[guacamole_sharing_profile_permission]
WITH CHECK ADD CONSTRAINT [FK_guacamole_sharing_profile_permission_user] FOREIGN KEY([user_id]) WITH CHECK ADD CONSTRAINT [FK_guacamole_sharing_profile_permission_user] FOREIGN KEY([user_id])
REFERENCES [guacamole].[guacamole_user] ([user_id]) REFERENCES [dbo].[guacamole_user] ([user_id])
ON UPDATE CASCADE ON UPDATE CASCADE
ON DELETE CASCADE ON DELETE CASCADE
ALTER TABLE [guacamole].[guacamole_sharing_profile_permission] ALTER TABLE [dbo].[guacamole_sharing_profile_permission]
CHECK CONSTRAINT [FK_guacamole_sharing_profile_permission_user] CHECK CONSTRAINT [FK_guacamole_sharing_profile_permission_user]
GO GO
@@ -411,9 +411,9 @@ GO
*/ */
SET ANSI_NULLS ON SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON SET QUOTED_IDENTIFIER ON
CREATE TABLE [guacamole].[guacamole_system_permission]( CREATE TABLE [dbo].[guacamole_system_permission](
[user_id] [int] NOT NULL, [user_id] [int] NOT NULL,
[permission] [guacamole].[guacamole_system_permission] NOT NULL, [permission] [dbo].[guacamole_system_permission] NOT NULL,
CONSTRAINT [PK_guacamole_system_permission] PRIMARY KEY CLUSTERED CONSTRAINT [PK_guacamole_system_permission] PRIMARY KEY CLUSTERED
([user_id] ASC, [permission] ASC) ([user_id] ASC, [permission] ASC)
@@ -428,12 +428,12 @@ CREATE TABLE [guacamole].[guacamole_system_permission](
/** /**
* Foreign keys for system_permission table. * Foreign keys for system_permission table.
*/ */
ALTER TABLE [guacamole].[guacamole_system_permission] ALTER TABLE [dbo].[guacamole_system_permission]
WITH CHECK ADD CONSTRAINT [FK_guacamole_system_permission_user] FOREIGN KEY([user_id]) WITH CHECK ADD CONSTRAINT [FK_guacamole_system_permission_user] FOREIGN KEY([user_id])
REFERENCES [guacamole].[guacamole_user] ([user_id]) REFERENCES [dbo].[guacamole_user] ([user_id])
ON UPDATE CASCADE ON UPDATE CASCADE
ON DELETE CASCADE ON DELETE CASCADE
ALTER TABLE [guacamole].[guacamole_system_permission] ALTER TABLE [dbo].[guacamole_system_permission]
CHECK CONSTRAINT [FK_guacamole_system_permission_user] CHECK CONSTRAINT [FK_guacamole_system_permission_user]
GO GO
@@ -443,10 +443,10 @@ GO
*/ */
SET ANSI_NULLS ON SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON SET QUOTED_IDENTIFIER ON
CREATE TABLE [guacamole].[guacamole_user_permission]( CREATE TABLE [dbo].[guacamole_user_permission](
[user_id] [int] NOT NULL, [user_id] [int] NOT NULL,
[affected_user_id] [int] NOT NULL, [affected_user_id] [int] NOT NULL,
[permission] [guacamole].[guacamole_permission] NOT NULL, [permission] [dbo].[guacamole_permission] NOT NULL,
CONSTRAINT [PK_guacamole_user_permission] PRIMARY KEY CLUSTERED CONSTRAINT [PK_guacamole_user_permission] PRIMARY KEY CLUSTERED
([user_id] ASC, [affected_user_id] ASC, [permission] ASC) ([user_id] ASC, [affected_user_id] ASC, [permission] ASC)
@@ -461,17 +461,17 @@ CREATE TABLE [guacamole].[guacamole_user_permission](
/** /**
* Foreign keys for user_permission table. * Foreign keys for user_permission table.
*/ */
ALTER TABLE [guacamole].[guacamole_user_permission] ALTER TABLE [dbo].[guacamole_user_permission]
WITH CHECK ADD CONSTRAINT [FK_guacamole_user_permission_user] FOREIGN KEY([user_id]) WITH CHECK ADD CONSTRAINT [FK_guacamole_user_permission_user] FOREIGN KEY([user_id])
REFERENCES [guacamole].[guacamole_user] ([user_id]) REFERENCES [dbo].[guacamole_user] ([user_id])
ON UPDATE CASCADE ON UPDATE CASCADE
ON DELETE CASCADE ON DELETE CASCADE
ALTER TABLE [guacamole].[guacamole_user_permission] ALTER TABLE [dbo].[guacamole_user_permission]
CHECK CONSTRAINT [FK_guacamole_user_permission_user] CHECK CONSTRAINT [FK_guacamole_user_permission_user]
ALTER TABLE [guacamole].[guacamole_user_permission] ALTER TABLE [dbo].[guacamole_user_permission]
WITH CHECK ADD CONSTRAINT [FK_guacamole_user_permission_user1] FOREIGN KEY([affected_user_id]) WITH CHECK ADD CONSTRAINT [FK_guacamole_user_permission_user1] FOREIGN KEY([affected_user_id])
REFERENCES [guacamole].[guacamole_user] ([user_id]) REFERENCES [dbo].[guacamole_user] ([user_id])
ALTER TABLE [guacamole].[guacamole_user_permission] ALTER TABLE [dbo].[guacamole_user_permission]
CHECK CONSTRAINT [FK_guacamole_user_permission_user1] CHECK CONSTRAINT [FK_guacamole_user_permission_user1]
GO GO
@@ -481,7 +481,7 @@ GO
*/ */
SET ANSI_NULLS ON SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON SET QUOTED_IDENTIFIER ON
CREATE TABLE [guacamole].[guacamole_connection_history]( CREATE TABLE [dbo].[guacamole_connection_history](
[history_id] [int] IDENTITY(1,1) NOT NULL, [history_id] [int] IDENTITY(1,1) NOT NULL,
[user_id] [int] NULL, [user_id] [int] NULL,
[username] [nvarchar](128) NOT NULL, [username] [nvarchar](128) NOT NULL,
@@ -506,24 +506,24 @@ CREATE TABLE [guacamole].[guacamole_connection_history](
/** /**
* Foreign keys for connection_history table * Foreign keys for connection_history table
*/ */
ALTER TABLE [guacamole].[guacamole_connection_history] ALTER TABLE [dbo].[guacamole_connection_history]
WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_history_connection] FOREIGN KEY([connection_id]) WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_history_connection] FOREIGN KEY([connection_id])
REFERENCES [guacamole].[guacamole_connection] ([connection_id]) REFERENCES [dbo].[guacamole_connection] ([connection_id])
ON UPDATE CASCADE ON UPDATE CASCADE
ON DELETE SET NULL ON DELETE SET NULL
ALTER TABLE [guacamole].[guacamole_connection_history] ALTER TABLE [dbo].[guacamole_connection_history]
CHECK CONSTRAINT [FK_guacamole_connection_history_connection] CHECK CONSTRAINT [FK_guacamole_connection_history_connection]
ALTER TABLE [guacamole].[guacamole_connection_history] ALTER TABLE [dbo].[guacamole_connection_history]
WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_history_sharing_profile] FOREIGN KEY([sharing_profile_id]) WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_history_sharing_profile] FOREIGN KEY([sharing_profile_id])
REFERENCES [guacamole].[guacamole_sharing_profile] ([sharing_profile_id]) REFERENCES [dbo].[guacamole_sharing_profile] ([sharing_profile_id])
ALTER TABLE [guacamole].[guacamole_connection_history] ALTER TABLE [dbo].[guacamole_connection_history]
CHECK CONSTRAINT [FK_guacamole_connection_history_sharing_profile] CHECK CONSTRAINT [FK_guacamole_connection_history_sharing_profile]
ALTER TABLE [guacamole].[guacamole_connection_history] ALTER TABLE [dbo].[guacamole_connection_history]
WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_history_user] FOREIGN KEY([user_id]) WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_history_user] FOREIGN KEY([user_id])
REFERENCES [guacamole].[guacamole_user] ([user_id]) REFERENCES [dbo].[guacamole_user] ([user_id])
ON UPDATE CASCADE ON UPDATE CASCADE
ON DELETE SET NULL ON DELETE SET NULL
ALTER TABLE [guacamole].[guacamole_connection_history] ALTER TABLE [dbo].[guacamole_connection_history]
CHECK CONSTRAINT [FK_guacamole_connection_history_user] CHECK CONSTRAINT [FK_guacamole_connection_history_user]
GO GO
@@ -534,7 +534,7 @@ GO
*/ */
SET ANSI_NULLS ON SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON SET QUOTED_IDENTIFIER ON
CREATE TABLE [guacamole].[guacamole_user_password_history]( CREATE TABLE [dbo].[guacamole_user_password_history](
[password_history_id] [int] IDENTITY(1,1) NOT NULL, [password_history_id] [int] IDENTITY(1,1) NOT NULL,
[user_id] [int] NOT NULL, [user_id] [int] NOT NULL,
[password_hash] [binary](32) NOT NULL, [password_hash] [binary](32) NOT NULL,
@@ -554,11 +554,11 @@ CREATE TABLE [guacamole].[guacamole_user_password_history](
/** /**
* Foreign keys for user_password_history table * Foreign keys for user_password_history table
*/ */
ALTER TABLE [guacamole].[guacamole_user_password_history] ALTER TABLE [dbo].[guacamole_user_password_history]
WITH CHECK ADD CONSTRAINT [FK_guacamole_user_password_history_user] FOREIGN KEY([user_id]) WITH CHECK ADD CONSTRAINT [FK_guacamole_user_password_history_user] FOREIGN KEY([user_id])
REFERENCES [guacamole].[guacamole_user] ([user_id]) REFERENCES [dbo].[guacamole_user] ([user_id])
ON UPDATE CASCADE ON UPDATE CASCADE
ON DELETE CASCADE ON DELETE CASCADE
ALTER TABLE [guacamole].[guacamole_user_password_history] ALTER TABLE [dbo].[guacamole_user_password_history]
CHECK CONSTRAINT [FK_guacamole_user_password_history_user] CHECK CONSTRAINT [FK_guacamole_user_password_history_user]
GO GO

View File

@@ -20,20 +20,20 @@
/** /**
* Create the default admin user account and set up full privileges. * Create the default admin user account and set up full privileges.
*/ */
INSERT INTO [guacamole].[guacamole_user] (username, password_hash, password_date) INSERT INTO [dbo].[guacamole_user] (username, password_hash, password_date)
VALUES ('guacadmin', HASHBYTES('SHA2_256', 'guacadmin'), getdate()); VALUES ('guacadmin', HASHBYTES('SHA2_256', 'guacadmin'), getdate());
INSERT INTO [guacamole].[guacamole_user_permission] INSERT INTO [dbo].[guacamole_user_permission]
SELECT [guacamole].[guacamole_user].[user_id], [affected].[user_id], permission SELECT [dbo].[guacamole_user].[user_id], [affected].[user_id], permission
FROM ( FROM (
SELECT 'guacadmin' AS username, 'guacadmin' AS affected_username, 'READ' AS permission SELECT 'guacadmin' AS username, 'guacadmin' AS affected_username, 'READ' AS permission
UNION SELECT 'guacadmin' AS username, 'guacadmin' AS affected_username, 'UPDATE' AS permission UNION SELECT 'guacadmin' AS username, 'guacadmin' AS affected_username, 'UPDATE' AS permission
UNION SELECT 'guacadmin' AS username, 'guacadmin' AS affected_username, 'ADMINISTER' AS permission) UNION SELECT 'guacadmin' AS username, 'guacadmin' AS affected_username, 'ADMINISTER' AS permission)
permissions permissions
JOIN [guacamole].[guacamole_user] ON permissions.username = [guacamole].[guacamole_user].[username] JOIN [dbo].[guacamole_user] ON permissions.username = [dbo].[guacamole_user].[username]
JOIN [guacamole].[guacamole_user] affected ON permissions.affected_username = affected.username; JOIN [dbo].[guacamole_user] affected ON permissions.affected_username = affected.username;
INSERT INTO [guacamole].[system_permission] INSERT INTO [dbo].[system_permission]
SELECT user_id, permission SELECT user_id, permission
FROM ( FROM (
SELECT 'guacadmin' AS username, 'CREATE_CONNECTION' AS permission SELECT 'guacadmin' AS username, 'CREATE_CONNECTION' AS permission
@@ -42,5 +42,5 @@ FROM (
UNION SELECT 'guacadmin' AS username, 'CREATE_USER' AS permission UNION SELECT 'guacadmin' AS username, 'CREATE_USER' AS permission
UNION SELECT 'guacadmin' AS username, 'ADMINISTER' AS permission) UNION SELECT 'guacadmin' AS username, 'ADMINISTER' AS permission)
permissions permissions
JOIN [guacamole].[guacamole_user] ON permissions.username = [guacamole].[guacamole_user].[username]; JOIN [dbo].[guacamole_user] ON permissions.username = [dbo].[guacamole_user].[username];
GO GO

View File

@@ -51,13 +51,13 @@
<!-- Select all connection identifiers --> <!-- Select all connection identifiers -->
<select id="selectIdentifiers" resultType="string"> <select id="selectIdentifiers" resultType="string">
SELECT connection_id SELECT connection_id
FROM [guacamole].[connection] FROM [dbo].[guacamole_connection]
</select> </select>
<!-- Select identifiers of all readable connections --> <!-- Select identifiers of all readable connections -->
<select id="selectReadableIdentifiers" resultType="string"> <select id="selectReadableIdentifiers" resultType="string">
SELECT connection_id SELECT connection_id
FROM [guacamole].[connection_permission] FROM [dbo].[guacamole_connection_permission]
WHERE WHERE
user_id = #{user.objectID,jdbcType=INTEGER} user_id = #{user.objectID,jdbcType=INTEGER}
AND permission = 'READ' AND permission = 'READ'
@@ -66,7 +66,7 @@
<!-- Select all connection identifiers within a particular connection group --> <!-- Select all connection identifiers within a particular connection group -->
<select id="selectIdentifiersWithin" resultType="string"> <select id="selectIdentifiersWithin" resultType="string">
SELECT connection_id SELECT connection_id
FROM [guacamole].[connection] FROM [dbo].[guacamole_connection]
WHERE WHERE
<if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if> <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if>
<if test="parentIdentifier == null">parent_id IS NULL</if> <if test="parentIdentifier == null">parent_id IS NULL</if>
@@ -74,9 +74,9 @@
<!-- Select identifiers of all readable connections within a particular connection group --> <!-- Select identifiers of all readable connections within a particular connection group -->
<select id="selectReadableIdentifiersWithin" resultType="string"> <select id="selectReadableIdentifiersWithin" resultType="string">
SELECT [guacamole].[connection].connection_id SELECT [dbo].[guacamole_connection].connection_id
FROM [guacamole].[connection] FROM [dbo].[guacamole_connection]
JOIN [guacamole].[connection_permission] ON [guacamole].[connection_permission].connection_id = [guacamole].[connection].connection_id JOIN [dbo].[guacamole_connection_permission] ON [dbo].[guacamole_connection_permission].connection_id = [dbo].[guacamole_connection].connection_id
WHERE WHERE
<if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if> <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if>
<if test="parentIdentifier == null">parent_id IS NULL</if> <if test="parentIdentifier == null">parent_id IS NULL</if>
@@ -100,7 +100,7 @@
proxy_encryption_method, proxy_encryption_method,
connection_weight, connection_weight,
failover_only failover_only
FROM [guacamole].[connection] FROM [dbo].[guacamole_connection]
WHERE connection_id IN WHERE connection_id IN
<foreach collection="identifiers" item="identifier" <foreach collection="identifiers" item="identifier"
open="(" separator="," close=")"> open="(" separator="," close=")">
@@ -108,7 +108,7 @@
</foreach>; </foreach>;
SELECT primary_connection_id, sharing_profile_id SELECT primary_connection_id, sharing_profile_id
FROM [guacamole].[sharing_profile] FROM [dbo].[guacamole_sharing_profile]
WHERE primary_connection_id IN WHERE primary_connection_id IN
<foreach collection="identifiers" item="identifier" <foreach collection="identifiers" item="identifier"
open="(" separator="," close=")"> open="(" separator="," close=")">
@@ -122,7 +122,7 @@
resultSets="connections,sharingProfiles"> resultSets="connections,sharingProfiles">
SELECT SELECT
[guacamole].[connection].connection_id, [dbo].[guacamole_connection].connection_id,
connection_name, connection_name,
parent_id, parent_id,
protocol, protocol,
@@ -133,9 +133,9 @@
proxy_encryption_method, proxy_encryption_method,
connection_weight, connection_weight,
failover_only failover_only
FROM [guacamole].[connection] FROM [dbo].[guacamole_connection]
JOIN [guacamole].[connection_permission] ON [guacamole].[connection_permission].connection_id = [guacamole].[connection].connection_id JOIN [dbo].[guacamole_connection_permission] ON [dbo].[guacamole_connection_permission].connection_id = [dbo].[guacamole_connection].connection_id
WHERE [guacamole].[connection].connection_id IN WHERE [dbo].[guacamole_connection].connection_id IN
<foreach collection="identifiers" item="identifier" <foreach collection="identifiers" item="identifier"
open="(" separator="," close=")"> open="(" separator="," close=")">
#{identifier,jdbcType=INTEGER} #{identifier,jdbcType=INTEGER}
@@ -143,9 +143,9 @@
AND user_id = #{user.objectID,jdbcType=INTEGER} AND user_id = #{user.objectID,jdbcType=INTEGER}
AND permission = 'READ'; AND permission = 'READ';
SELECT primary_connection_id, [guacamole].[sharing_profile].sharing_profile_id SELECT primary_connection_id, [dbo].[guacamole_sharing_profile].sharing_profile_id
FROM [guacamole].[sharing_profile] FROM [dbo].[guacamole_sharing_profile]
JOIN [guacamole].[sharing_profile_permission] ON [guacamole].[sharing_profile_permission].sharing_profile_id = [guacamole].[sharing_profile].sharing_profile_id JOIN [dbo].[guacamole_sharing_profile_permission] ON [dbo].[guacamole_sharing_profile_permission].sharing_profile_id = [dbo].[guacamole_sharing_profile].sharing_profile_id
WHERE primary_connection_id IN WHERE primary_connection_id IN
<foreach collection="identifiers" item="identifier" <foreach collection="identifiers" item="identifier"
open="(" separator="," close=")"> open="(" separator="," close=")">
@@ -171,7 +171,7 @@
proxy_encryption_method, proxy_encryption_method,
connection_weight, connection_weight,
failover_only failover_only
FROM [guacamole].[connection] FROM [dbo].[guacamole_connection]
WHERE WHERE
<if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if> <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if>
<if test="parentIdentifier == null">parent_id IS NULL</if> <if test="parentIdentifier == null">parent_id IS NULL</if>
@@ -181,7 +181,7 @@
<!-- Delete single connection by identifier --> <!-- Delete single connection by identifier -->
<delete id="delete"> <delete id="delete">
DELETE FROM [guacamole].[connection] DELETE FROM [dbo].[guacamole_connection]
WHERE connection_id = #{identifier,jdbcType=INTEGER} WHERE connection_id = #{identifier,jdbcType=INTEGER}
</delete> </delete>
@@ -189,7 +189,7 @@
<insert id="insert" useGeneratedKeys="true" keyProperty="object.objectID" <insert id="insert" useGeneratedKeys="true" keyProperty="object.objectID"
parameterType="org.apache.guacamole.auth.jdbc.connection.ConnectionModel"> parameterType="org.apache.guacamole.auth.jdbc.connection.ConnectionModel">
INSERT INTO [guacamole].[connection] ( INSERT INTO [dbo].[guacamole_connection] (
connection_name, connection_name,
parent_id, parent_id,
protocol, protocol,
@@ -218,7 +218,7 @@
<!-- Update single connection --> <!-- Update single connection -->
<update id="update" parameterType="org.apache.guacamole.auth.jdbc.connection.ConnectionModel"> <update id="update" parameterType="org.apache.guacamole.auth.jdbc.connection.ConnectionModel">
UPDATE [guacamole].[connection] UPDATE [dbo].[guacamole_connection]
SET connection_name = #{object.name,jdbcType=VARCHAR}, SET connection_name = #{object.name,jdbcType=VARCHAR},
parent_id = #{object.parentIdentifier,jdbcType=INTEGER}, parent_id = #{object.parentIdentifier,jdbcType=INTEGER},
protocol = #{object.protocol,jdbcType=VARCHAR}, protocol = #{object.protocol,jdbcType=VARCHAR},

View File

@@ -36,21 +36,21 @@
connection_id, connection_id,
parameter_name, parameter_name,
parameter_value parameter_value
FROM [guacamole].[connection_parameter] FROM [dbo].[guacamole_connection_parameter]
WHERE WHERE
connection_id = #{identifier,jdbcType=INTEGER} connection_id = #{identifier,jdbcType=INTEGER}
</select> </select>
<!-- Delete all parameters of a given connection --> <!-- Delete all parameters of a given connection -->
<delete id="delete"> <delete id="delete">
DELETE FROM [guacamole].[connection_parameter] DELETE FROM [dbo].[guacamole_connection_parameter]
WHERE connection_id = #{identifier,jdbcType=INTEGER} WHERE connection_id = #{identifier,jdbcType=INTEGER}
</delete> </delete>
<!-- Insert all given parameters --> <!-- Insert all given parameters -->
<insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.connection.ConnectionParameterModel"> <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.connection.ConnectionParameterModel">
INSERT INTO [guacamole].[connection_parameter] ( INSERT INTO [dbo].[guacamole_connection_parameter] (
connection_id, connection_id,
parameter_name, parameter_name,
parameter_value parameter_value

View File

@@ -40,28 +40,28 @@
<select id="select" resultMap="ConnectionRecordResultMap"> <select id="select" resultMap="ConnectionRecordResultMap">
SELECT SELECT
[guacamole].[connection_history].connection_id, [dbo].[guacamole_connection_history].connection_id,
[guacamole].[connection_history].connection_name, [dbo].[guacamole_connection_history].connection_name,
[guacamole].[connection_history].remote_host, [dbo].[guacamole_connection_history].remote_host,
[guacamole].[connection_history].sharing_profile_id, [dbo].[guacamole_connection_history].sharing_profile_id,
[guacamole].[connection_history].sharing_profile_name, [dbo].[guacamole_connection_history].sharing_profile_name,
[guacamole].[connection_history].user_id, [dbo].[guacamole_connection_history].user_id,
[guacamole].[connection_history].username, [dbo].[guacamole_connection_history].username,
[guacamole].[connection_history].start_date, [dbo].[guacamole_connection_history].start_date,
[guacamole].[connection_history].end_date [dbo].[guacamole_connection_history].end_date
FROM [guacamole].[connection_history] FROM [dbo].[guacamole_connection_history]
WHERE WHERE
[guacamole].[connection_history].connection_id = #{identifier,jdbcType=INTEGER} [dbo].[guacamole_connection_history].connection_id = #{identifier,jdbcType=INTEGER}
ORDER BY ORDER BY
[guacamole].[connection_history].start_date DESC, [dbo].[guacamole_connection_history].start_date DESC,
[guacamole].[connection_history].end_date DESC [dbo].[guacamole_connection_history].end_date DESC
</select> </select>
<!-- Insert the given connection record --> <!-- Insert the given connection record -->
<insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.connection.ConnectionRecordModel"> <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.connection.ConnectionRecordModel">
INSERT INTO [guacamole].[connection_history] ( INSERT INTO [dbo].[guacamole_connection_history] (
connection_id, connection_id,
connection_name, connection_name,
remote_host, remote_host,
@@ -78,7 +78,7 @@
#{record.remoteHost,jdbcType=VARCHAR}, #{record.remoteHost,jdbcType=VARCHAR},
#{record.sharingProfileIdentifier,jdbcType=INTEGER}, #{record.sharingProfileIdentifier,jdbcType=INTEGER},
#{record.sharingProfileName,jdbcType=VARCHAR}, #{record.sharingProfileName,jdbcType=VARCHAR},
(SELECT user_id FROM [guacamole].[user] (SELECT user_id FROM [dbo].[guacamole_user]
WHERE username = #{record.username,jdbcType=VARCHAR}), WHERE username = #{record.username,jdbcType=VARCHAR}),
#{record.username,jdbcType=VARCHAR}, #{record.username,jdbcType=VARCHAR},
#{record.startDate,jdbcType=TIMESTAMP}, #{record.startDate,jdbcType=TIMESTAMP},
@@ -91,31 +91,31 @@
<select id="search" resultMap="ConnectionRecordResultMap"> <select id="search" resultMap="ConnectionRecordResultMap">
SELECT TOP (#{limit,jdbcType=INTEGER}) SELECT TOP (#{limit,jdbcType=INTEGER})
[guacamole].[connection_history].connection_id, [dbo].[guacamole_connection_history].connection_id,
[guacamole].[connection_history].connection_name, [dbo].[guacamole_connection_history].connection_name,
[guacamole].[connection_history].remote_host, [dbo].[guacamole_connection_history].remote_host,
[guacamole].[connection_history].sharing_profile_id, [dbo].[guacamole_connection_history].sharing_profile_id,
[guacamole].[connection_history].sharing_profile_name, [dbo].[guacamole_connection_history].sharing_profile_name,
[guacamole].[connection_history].user_id, [dbo].[guacamole_connection_history].user_id,
[guacamole].[connection_history].username, [dbo].[guacamole_connection_history].username,
[guacamole].[connection_history].start_date, [dbo].[guacamole_connection_history].start_date,
[guacamole].[connection_history].end_date [dbo].[guacamole_connection_history].end_date
FROM [guacamole].[connection_history] FROM [dbo].[guacamole_connection_history]
<!-- Search terms --> <!-- Search terms -->
<foreach collection="terms" item="term" <foreach collection="terms" item="term"
open="WHERE " separator=" AND "> open="WHERE " separator=" AND ">
( (
[guacamole].[connection_history].user_id IN ( [dbo].[guacamole_connection_history].user_id IN (
SELECT user_id SELECT user_id
FROM [guacamole].[user] FROM [dbo].[guacamole_user]
WHERE POSITION(#{term.term,jdbcType=VARCHAR} IN username) > 0 WHERE POSITION(#{term.term,jdbcType=VARCHAR} IN username) > 0
) )
OR [guacamole].[connection_history].connection_id IN ( OR [dbo].[guacamole_connection_history].connection_id IN (
SELECT connection_id SELECT connection_id
FROM [guacamole].[connection] FROM [dbo].[guacamole_connection]
WHERE POSITION(#{term.term,jdbcType=VARCHAR} IN connection_name) > 0 WHERE POSITION(#{term.term,jdbcType=VARCHAR} IN connection_name) > 0
) )
@@ -133,7 +133,7 @@
<foreach collection="sortPredicates" item="sortPredicate" <foreach collection="sortPredicates" item="sortPredicate"
open="ORDER BY " separator=", "> open="ORDER BY " separator=", ">
<choose> <choose>
<when test="sortPredicate.property == START_DATE">[guacamole].[connection_history].start_date</when> <when test="sortPredicate.property == START_DATE">[dbo].[guacamole_connection_history].start_date</when>
<otherwise>1</otherwise> <otherwise>1</otherwise>
</choose> </choose>
<if test="sortPredicate.descending">DESC</if> <if test="sortPredicate.descending">DESC</if>
@@ -145,45 +145,45 @@
<select id="searchReadable" resultMap="ConnectionRecordResultMap"> <select id="searchReadable" resultMap="ConnectionRecordResultMap">
SELECT TOP (#{limit,jdbcType=INTEGER}) SELECT TOP (#{limit,jdbcType=INTEGER})
[guacamole].[connection_history].connection_id, [dbo].[guacamole_connection_history].connection_id,
[guacamole].[connection_history].connection_name, [dbo].[guacamole_connection_history].connection_name,
[guacamole].[connection_history].remote_host, [dbo].[guacamole_connection_history].remote_host,
[guacamole].[connection_history].sharing_profile_id, [dbo].[guacamole_connection_history].sharing_profile_id,
[guacamole].[connection_history].sharing_profile_name, [dbo].[guacamole_connection_history].sharing_profile_name,
[guacamole].[connection_history].user_id, [dbo].[guacamole_connection_history].user_id,
[guacamole].[connection_history].username, [dbo].[guacamole_connection_history].username,
[guacamole].[connection_history].start_date, [dbo].[guacamole_connection_history].start_date,
[guacamole].[connection_history].end_date [dbo].[guacamole_connection_history].end_date
FROM [guacamole].[connection_history] FROM [dbo].[guacamole_connection_history]
LEFT JOIN [guacamole].[connection] ON [guacamole].[connection_history].connection_id = [guacamole].[connection].connection_id LEFT JOIN [dbo].[guacamole_connection] ON [dbo].[guacamole_connection_history].connection_id = [dbo].[guacamole_connection].connection_id
LEFT JOIN [guacamole].[user] ON [guacamole].[connection_history].user_id = [guacamole].[user].user_id LEFT JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_connection_history].user_id = [dbo].[guacamole_user].user_id
<!-- Restrict to readable connections --> <!-- Restrict to readable connections -->
JOIN [guacamole].[connection_permission] ON JOIN [dbo].[guacamole_connection_permission] ON
[guacamole].[connection_history].connection_id = [guacamole].[connection_permission].connection_id [dbo].[guacamole_connection_history].connection_id = [dbo].[guacamole_connection_permission].connection_id
AND [guacamole].[connection_permission].user_id = #{user.objectID,jdbcType=INTEGER} AND [dbo].[guacamole_connection_permission].user_id = #{user.objectID,jdbcType=INTEGER}
AND [guacamole].[connection_permission].permission = 'READ' AND [dbo].[guacamole_connection_permission].permission = 'READ'
<!-- Restrict to readable users --> <!-- Restrict to readable users -->
JOIN [guacamole].[user_permission] ON JOIN [dbo].[guacamole_user_permission] ON
[guacamole].[connection_history].user_id = [guacamole].[user_permission].affected_user_id [dbo].[guacamole_connection_history].user_id = [dbo].[guacamole_user_permission].affected_user_id
AND [guacamole].[user_permission].user_id = #{user.objectID,jdbcType=INTEGER} AND [dbo].[guacamole_user_permission].user_id = #{user.objectID,jdbcType=INTEGER}
AND [guacamole].[user_permission].permission = 'READ' AND [dbo].[guacamole_user_permission].permission = 'READ'
<!-- Search terms --> <!-- Search terms -->
<foreach collection="terms" item="term" <foreach collection="terms" item="term"
open="WHERE " separator=" AND "> open="WHERE " separator=" AND ">
( (
[guacamole].[connection_history].user_id IN ( [dbo].[guacamole_connection_history].user_id IN (
SELECT user_id SELECT user_id
FROM [guacamole].[user] FROM [dbo].[guacamole_user]
WHERE POSITION(#{term.term,jdbcType=VARCHAR} IN username) > 0 WHERE POSITION(#{term.term,jdbcType=VARCHAR} IN username) > 0
) )
OR [guacamole].[connection_history].connection_id IN ( OR [dbo].[guacamole_connection_history].connection_id IN (
SELECT connection_id SELECT connection_id
FROM [guacamole].[connection] FROM [dbo].[guacamole_connection]
WHERE POSITION(#{term.term,jdbcType=VARCHAR} IN connection_name) > 0 WHERE POSITION(#{term.term,jdbcType=VARCHAR} IN connection_name) > 0
) )
@@ -201,7 +201,7 @@
<foreach collection="sortPredicates" item="sortPredicate" <foreach collection="sortPredicates" item="sortPredicate"
open="ORDER BY " separator=", "> open="ORDER BY " separator=", ">
<choose> <choose>
<when test="sortPredicate.property == START_DATE">[guacamole].[connection_history].start_date</when> <when test="sortPredicate.property == START_DATE">[dbo].[guacamole_connection_history].start_date</when>
<otherwise>1</otherwise> <otherwise>1</otherwise>
</choose> </choose>
<if test="sortPredicate.descending">DESC</if> <if test="sortPredicate.descending">DESC</if>

View File

@@ -53,13 +53,13 @@
<!-- Select all connection group identifiers --> <!-- Select all connection group identifiers -->
<select id="selectIdentifiers" resultType="string"> <select id="selectIdentifiers" resultType="string">
SELECT connection_group_id SELECT connection_group_id
FROM [guacamole].[connection_group] FROM [dbo].[guacamole_connection_group]
</select> </select>
<!-- Select identifiers of all readable connection groups --> <!-- Select identifiers of all readable connection groups -->
<select id="selectReadableIdentifiers" resultType="string"> <select id="selectReadableIdentifiers" resultType="string">
SELECT connection_group_id SELECT connection_group_id
FROM [guacamole].[connection_group_permission] FROM [dbo].[guacamole_connection_group_permission]
WHERE WHERE
user_id = #{user.objectID,jdbcType=INTEGER} user_id = #{user.objectID,jdbcType=INTEGER}
AND permission = 'READ' AND permission = 'READ'
@@ -68,7 +68,7 @@
<!-- Select all connection identifiers within a particular connection group --> <!-- Select all connection identifiers within a particular connection group -->
<select id="selectIdentifiersWithin" resultType="string"> <select id="selectIdentifiersWithin" resultType="string">
SELECT connection_group_id SELECT connection_group_id
FROM [guacamole].[connection_group] FROM [dbo].[guacamole_connection_group]
WHERE WHERE
<if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if> <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if>
<if test="parentIdentifier == null">parent_id IS NULL</if> <if test="parentIdentifier == null">parent_id IS NULL</if>
@@ -76,9 +76,9 @@
<!-- Select identifiers of all readable connection groups within a particular connection group --> <!-- Select identifiers of all readable connection groups within a particular connection group -->
<select id="selectReadableIdentifiersWithin" resultType="string"> <select id="selectReadableIdentifiersWithin" resultType="string">
SELECT [guacamole].[connection_group].connection_group_id SELECT [dbo].[guacamole_connection_group].connection_group_id
FROM [guacamole].[connection_group] FROM [dbo].[guacamole_connection_group]
JOIN [guacamole].[connection_group_permission] ON [guacamole].[connection_group_permission].connection_group_id = [guacamole].[connection_group].connection_group_id JOIN [dbo].[guacamole_connection_group_permission] ON [dbo].[guacamole_connection_group_permission].connection_group_id = [dbo].[guacamole_connection_group].connection_group_id
WHERE WHERE
<if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if> <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if>
<if test="parentIdentifier == null">parent_id IS NULL</if> <if test="parentIdentifier == null">parent_id IS NULL</if>
@@ -98,7 +98,7 @@
max_connections, max_connections,
max_connections_per_user, max_connections_per_user,
enable_session_affinity enable_session_affinity
FROM [guacamole].[connection_group] FROM [dbo].[guacamole_connection_group]
WHERE connection_group_id IN WHERE connection_group_id IN
<foreach collection="identifiers" item="identifier" <foreach collection="identifiers" item="identifier"
open="(" separator="," close=")"> open="(" separator="," close=")">
@@ -106,7 +106,7 @@
</foreach>; </foreach>;
SELECT parent_id, connection_group_id SELECT parent_id, connection_group_id
FROM [guacamole].[connection_group] FROM [dbo].[guacamole_connection_group]
WHERE parent_id IN WHERE parent_id IN
<foreach collection="identifiers" item="identifier" <foreach collection="identifiers" item="identifier"
open="(" separator="," close=")"> open="(" separator="," close=")">
@@ -114,7 +114,7 @@
</foreach>; </foreach>;
SELECT parent_id, connection_id SELECT parent_id, connection_id
FROM [guacamole].[connection] FROM [dbo].[guacamole_connection]
WHERE parent_id IN WHERE parent_id IN
<foreach collection="identifiers" item="identifier" <foreach collection="identifiers" item="identifier"
open="(" separator="," close=")"> open="(" separator="," close=")">
@@ -128,16 +128,16 @@
resultSets="connectionGroups,childConnectionGroups,childConnections"> resultSets="connectionGroups,childConnectionGroups,childConnections">
SELECT SELECT
[guacamole].[connection_group].connection_group_id, [dbo].[guacamole_connection_group].connection_group_id,
connection_group_name, connection_group_name,
parent_id, parent_id,
type, type,
max_connections, max_connections,
max_connections_per_user, max_connections_per_user,
enable_session_affinity enable_session_affinity
FROM [guacamole].[connection_group] FROM [dbo].[guacamole_connection_group]
JOIN [guacamole].[connection_group_permission] ON [guacamole].[connection_group_permission].connection_group_id = [guacamole].[connection_group].connection_group_id JOIN [dbo].[guacamole_connection_group_permission] ON [dbo].[guacamole_connection_group_permission].connection_group_id = [dbo].[guacamole_connection_group].connection_group_id
WHERE [guacamole].[connection_group].connection_group_id IN WHERE [dbo].[guacamole_connection_group].connection_group_id IN
<foreach collection="identifiers" item="identifier" <foreach collection="identifiers" item="identifier"
open="(" separator="," close=")"> open="(" separator="," close=")">
#{identifier,jdbcType=INTEGER} #{identifier,jdbcType=INTEGER}
@@ -145,9 +145,9 @@
AND user_id = #{user.objectID,jdbcType=INTEGER} AND user_id = #{user.objectID,jdbcType=INTEGER}
AND permission = 'READ'; AND permission = 'READ';
SELECT parent_id, [guacamole].[connection_group].connection_group_id SELECT parent_id, [dbo].[guacamole_connection_group].connection_group_id
FROM [guacamole].[connection_group] FROM [dbo].[guacamole_connection_group]
JOIN [guacamole].[connection_group_permission] ON [guacamole].[connection_group_permission].connection_group_id = [guacamole].[connection_group].connection_group_id JOIN [dbo].[guacamole_connection_group_permission] ON [dbo].[guacamole_connection_group_permission].connection_group_id = [dbo].[guacamole_connection_group].connection_group_id
WHERE parent_id IN WHERE parent_id IN
<foreach collection="identifiers" item="identifier" <foreach collection="identifiers" item="identifier"
open="(" separator="," close=")"> open="(" separator="," close=")">
@@ -156,9 +156,9 @@
AND user_id = #{user.objectID,jdbcType=INTEGER} AND user_id = #{user.objectID,jdbcType=INTEGER}
AND permission = 'READ'; AND permission = 'READ';
SELECT parent_id, [guacamole].[connection].connection_id SELECT parent_id, [dbo].[guacamole_connection].connection_id
FROM [guacamole].[connection] FROM [dbo].[guacamole_connection]
JOIN [guacamole].[connection_permission] ON [guacamole].[connection_permission].connection_id = [guacamole].[connection].connection_id JOIN [dbo].[guacamole_connection_permission] ON [dbo].[guacamole_connection_permission].connection_id = [dbo].[guacamole_connection].connection_id
WHERE parent_id IN WHERE parent_id IN
<foreach collection="identifiers" item="identifier" <foreach collection="identifiers" item="identifier"
open="(" separator="," close=")"> open="(" separator="," close=")">
@@ -180,7 +180,7 @@
max_connections, max_connections,
max_connections_per_user, max_connections_per_user,
enable_session_affinity enable_session_affinity
FROM [guacamole].[connection_group] FROM [dbo].[guacamole_connection_group]
WHERE WHERE
<if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if> <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if>
<if test="parentIdentifier == null">parent_id IS NULL</if> <if test="parentIdentifier == null">parent_id IS NULL</if>
@@ -190,7 +190,7 @@
<!-- Delete single connection group by identifier --> <!-- Delete single connection group by identifier -->
<delete id="delete"> <delete id="delete">
DELETE FROM [guacamole].[connection_group] DELETE FROM [dbo].[guacamole_connection_group]
WHERE connection_group_id = #{identifier,jdbcType=INTEGER} WHERE connection_group_id = #{identifier,jdbcType=INTEGER}
</delete> </delete>
@@ -198,7 +198,7 @@
<insert id="insert" useGeneratedKeys="true" keyProperty="object.objectID" <insert id="insert" useGeneratedKeys="true" keyProperty="object.objectID"
parameterType="org.apache.guacamole.auth.jdbc.connectiongroup.ConnectionGroupModel"> parameterType="org.apache.guacamole.auth.jdbc.connectiongroup.ConnectionGroupModel">
INSERT INTO [guacamole].[connection_group] ( INSERT INTO [dbo].[guacamole_connection_group] (
connection_group_name, connection_group_name,
parent_id, parent_id,
type, type,
@@ -219,7 +219,7 @@
<!-- Update single connection group --> <!-- Update single connection group -->
<update id="update" parameterType="org.apache.guacamole.auth.jdbc.connectiongroup.ConnectionGroupModel"> <update id="update" parameterType="org.apache.guacamole.auth.jdbc.connectiongroup.ConnectionGroupModel">
UPDATE [guacamole].[connection_group] UPDATE [dbo].[guacamole_connection_group]
SET connection_group_name = #{object.name,jdbcType=VARCHAR}, SET connection_group_name = #{object.name,jdbcType=VARCHAR},
parent_id = #{object.parentIdentifier,jdbcType=INTEGER}, parent_id = #{object.parentIdentifier,jdbcType=INTEGER},
type = #{object.type,jdbcType=VARCHAR}, type = #{object.type,jdbcType=VARCHAR},

View File

@@ -36,13 +36,13 @@
<select id="select" resultMap="ConnectionGroupPermissionResultMap"> <select id="select" resultMap="ConnectionGroupPermissionResultMap">
SELECT SELECT
[guacamole].[connection_group_permission].user_id, [dbo].[guacamole_connection_group_permission].user_id,
username, username,
permission, permission,
connection_group_id connection_group_id
FROM [guacamole].[connection_group_permission] FROM [dbo].[guacamole_connection_group_permission]
JOIN [guacamole].[user] ON [guacamole].[connection_group_permission].user_id = [guacamole].[user].user_id JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_connection_group_permission].user_id = [dbo].[guacamole_user].user_id
WHERE [guacamole].[connection_group_permission].user_id = #{user.objectID,jdbcType=INTEGER} WHERE [dbo].[guacamole_connection_group_permission].user_id = #{user.objectID,jdbcType=INTEGER}
</select> </select>
@@ -50,14 +50,14 @@
<select id="selectOne" resultMap="ConnectionGroupPermissionResultMap"> <select id="selectOne" resultMap="ConnectionGroupPermissionResultMap">
SELECT SELECT
[guacamole].[connection_group_permission].user_id, [dbo].[guacamole_connection_group_permission].user_id,
username, username,
permission, permission,
connection_group_id connection_group_id
FROM [guacamole].[connection_group_permission] FROM [dbo].[guacamole_connection_group_permission]
JOIN [guacamole].[user] ON [guacamole].[connection_group_permission].user_id = [guacamole].[user].user_id JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_connection_group_permission].user_id = [dbo].[guacamole_user].user_id
WHERE WHERE
[guacamole].[connection_group_permission].user_id = #{user.objectID,jdbcType=INTEGER} [dbo].[guacamole_connection_group_permission].user_id = #{user.objectID,jdbcType=INTEGER}
AND permission = #{type,jdbcType=VARCHAR} AND permission = #{type,jdbcType=VARCHAR}
AND connection_group_id = #{identifier,jdbcType=INTEGER} AND connection_group_id = #{identifier,jdbcType=INTEGER}
@@ -67,7 +67,7 @@
<select id="selectAccessibleIdentifiers" resultType="string"> <select id="selectAccessibleIdentifiers" resultType="string">
SELECT DISTINCT connection_group_id SELECT DISTINCT connection_group_id
FROM [guacamole].[connection_group_permission] FROM [dbo].[guacamole_connection_group_permission]
WHERE WHERE
user_id = #{user.objectID,jdbcType=INTEGER} user_id = #{user.objectID,jdbcType=INTEGER}
AND connection_group_id IN AND connection_group_id IN
@@ -86,7 +86,7 @@
<!-- Delete all given permissions --> <!-- Delete all given permissions -->
<delete id="delete" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel"> <delete id="delete" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
DELETE FROM [guacamole].[connection_group_permission] DELETE FROM [dbo].[guacamole_connection_group_permission]
WHERE (user_id, permission, connection_group_id) IN WHERE (user_id, permission, connection_group_id) IN
<foreach collection="permissions" item="permission" <foreach collection="permissions" item="permission"
open="(" separator="," close=")"> open="(" separator="," close=")">
@@ -100,7 +100,7 @@
<!-- Insert all given permissions --> <!-- Insert all given permissions -->
<insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel"> <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
INSERT INTO [guacamole].[connection_group_permission] ( INSERT INTO [dbo].[guacamole_connection_group_permission] (
user_id, user_id,
permission, permission,
connection_group_id connection_group_id
@@ -117,10 +117,10 @@
#{permission.objectIdentifier,jdbcType=INTEGER} AS connection_group_id #{permission.objectIdentifier,jdbcType=INTEGER} AS connection_group_id
</foreach> </foreach>
AS permissions AS permissions
WHERE NOT EXISTS (SELECT 1 FROM [guacamole].[connection_group_permission] WHERE NOT EXISTS (SELECT 1 FROM [dbo].[guacamole_connection_group_permission]
WHERE [guacamole].[connection_group_permission].user_id = permissions.user_id AND WHERE [dbo].[guacamole_connection_group_permission].user_id = permissions.user_id AND
[guacamole].[connection_group_permission].permission = permissions.permission AND [dbo].[guacamole_connection_group_permission].permission = permissions.permission AND
[guacamole].[connection_group_permission].connection_group_id = permissions.connection_group_id [dbo].[guacamole_connection_group_permission].connection_group_id = permissions.connection_group_id
); );
</insert> </insert>

View File

@@ -36,13 +36,13 @@
<select id="select" resultMap="ConnectionPermissionResultMap"> <select id="select" resultMap="ConnectionPermissionResultMap">
SELECT SELECT
[guacamole].[connection_permission].user_id, [dbo].[guacamole_connection_permission].user_id,
username, username,
permission, permission,
connection_id connection_id
FROM [guacamole].[connection_permission] FROM [dbo].[guacamole_connection_permission]
JOIN [guacamole].[user] ON [guacamole].[connection_permission].user_id = [guacamole].[user].user_id JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_connection_permission].user_id = [dbo].[guacamole_user].user_id
WHERE [guacamole].[connection_permission].user_id = #{user.objectID,jdbcType=INTEGER} WHERE [dbo].[guacamole_connection_permission].user_id = #{user.objectID,jdbcType=INTEGER}
</select> </select>
@@ -50,14 +50,14 @@
<select id="selectOne" resultMap="ConnectionPermissionResultMap"> <select id="selectOne" resultMap="ConnectionPermissionResultMap">
SELECT SELECT
[guacamole].[connection_permission].user_id, [dbo].[guacamole_connection_permission].user_id,
username, username,
permission, permission,
connection_id connection_id
FROM [guacamole].[connection_permission] FROM [dbo].[guacamole_connection_permission]
JOIN [guacamole].[user] ON [guacamole].[connection_permission].user_id = [guacamole].[user].user_id JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_connection_permission].user_id = [dbo].[guacamole_user].user_id
WHERE WHERE
[guacamole].[connection_permission].user_id = #{user.objectID,jdbcType=INTEGER} [dbo].[guacamole_connection_permission].user_id = #{user.objectID,jdbcType=INTEGER}
AND permission = #{type,jdbcType=VARCHAR} AND permission = #{type,jdbcType=VARCHAR}
AND connection_id = #{identifier,jdbcType=INTEGER} AND connection_id = #{identifier,jdbcType=INTEGER}
@@ -67,7 +67,7 @@
<select id="selectAccessibleIdentifiers" resultType="string"> <select id="selectAccessibleIdentifiers" resultType="string">
SELECT DISTINCT connection_id SELECT DISTINCT connection_id
FROM [guacamole].[connection_permission] FROM [dbo].[guacamole_connection_permission]
WHERE WHERE
user_id = #{user.objectID,jdbcType=INTEGER} user_id = #{user.objectID,jdbcType=INTEGER}
AND connection_id IN AND connection_id IN
@@ -86,7 +86,7 @@
<!-- Delete all given permissions --> <!-- Delete all given permissions -->
<delete id="delete" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel"> <delete id="delete" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
DELETE FROM [guacamole].[connection_permission] DELETE FROM [dbo].[guacamole_connection_permission]
WHERE WHERE
<foreach collection="permissions" item="permission" <foreach collection="permissions" item="permission"
open="(" separator=" OR " close=")"> open="(" separator=" OR " close=")">
@@ -100,7 +100,7 @@
<!-- Insert all given permissions --> <!-- Insert all given permissions -->
<insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel"> <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
INSERT INTO [guacamole].[connection_permission] ( INSERT INTO [dbo].[guacamole_connection_permission] (
user_id, user_id,
permission, permission,
connection_id connection_id
@@ -117,10 +117,10 @@
#{permission.objectIdentifier,jdbcType=INTEGER} AS connection_id #{permission.objectIdentifier,jdbcType=INTEGER} AS connection_id
</foreach> </foreach>
AS permissions AS permissions
WHERE NOT EXISTS ( SELECT 1 FROM [guacamole].[connection_permission] WHERE NOT EXISTS ( SELECT 1 FROM [dbo].[guacamole_connection_permission]
WHERE [guacamole].[connection_permission].user_id = permissions.user_id AND WHERE [dbo].[guacamole_connection_permission].user_id = permissions.user_id AND
[guacamole].[connection_permission].permission = permissions.permission AND [dbo].[guacamole_connection_permission].permission = permissions.permission AND
[guacamole].[connection_permission].connection_id = permissions.connection_id [dbo].[guacamole_connection_permission].connection_id = permissions.connection_id
); );
</insert> </insert>

View File

@@ -36,13 +36,13 @@
<select id="select" resultMap="SharingProfilePermissionResultMap"> <select id="select" resultMap="SharingProfilePermissionResultMap">
SELECT SELECT
[guacamole].[sharing_profile_permission].user_id, [dbo].[guacamole_sharing_profile_permission].user_id,
username, username,
permission, permission,
sharing_profile_id sharing_profile_id
FROM [guacamole].[sharing_profile_permission] FROM [dbo].[guacamole_sharing_profile_permission]
JOIN [guacamole].[user] ON [guacamole].[sharing_profile_permission].user_id = [guacamole].[user].user_id JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_sharing_profile_permission].user_id = [dbo].[guacamole_user].user_id
WHERE [guacamole].[sharing_profile_permission].user_id = #{user.objectID,jdbcType=INTEGER} WHERE [dbo].[guacamole_sharing_profile_permission].user_id = #{user.objectID,jdbcType=INTEGER}
</select> </select>
@@ -50,14 +50,14 @@
<select id="selectOne" resultMap="SharingProfilePermissionResultMap"> <select id="selectOne" resultMap="SharingProfilePermissionResultMap">
SELECT SELECT
[guacamole].[sharing_profile_permission].user_id, [dbo].[guacamole_sharing_profile_permission].user_id,
username, username,
permission, permission,
sharing_profile_id sharing_profile_id
FROM [guacamole].[sharing_profile_permission] FROM [dbo].[guacamole_sharing_profile_permission]
JOIN [guacamole].[user] ON [guacamole].[sharing_profile_permission].user_id = [guacamole].[user].user_id JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_sharing_profile_permission].user_id = [dbo].[guacamole_user].user_id
WHERE WHERE
[guacamole].[sharing_profile_permission].user_id = #{user.objectID,jdbcType=INTEGER} [dbo].[guacamole_sharing_profile_permission].user_id = #{user.objectID,jdbcType=INTEGER}
AND permission = #{type,jdbcType=VARCHAR} AND permission = #{type,jdbcType=VARCHAR}
AND sharing_profile_id = #{identifier,jdbcType=INTEGER} AND sharing_profile_id = #{identifier,jdbcType=INTEGER}
@@ -67,7 +67,7 @@
<select id="selectAccessibleIdentifiers" resultType="string"> <select id="selectAccessibleIdentifiers" resultType="string">
SELECT DISTINCT sharing_profile_id SELECT DISTINCT sharing_profile_id
FROM [guacamole].[sharing_profile_permission] FROM [dbo].[guacamole_sharing_profile_permission]
WHERE WHERE
user_id = #{user.objectID,jdbcType=INTEGER} user_id = #{user.objectID,jdbcType=INTEGER}
AND sharing_profile_id IN AND sharing_profile_id IN
@@ -86,7 +86,7 @@
<!-- Delete all given permissions --> <!-- Delete all given permissions -->
<delete id="delete" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel"> <delete id="delete" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
DELETE FROM [guacamole].[sharing_profile_permission] DELETE FROM [dbo].[guacamole_sharing_profile_permission]
WHERE WHERE
<foreach collection="permissions" item="permission" <foreach collection="permissions" item="permission"
open="(" separator=" OR " close=")"> open="(" separator=" OR " close=")">
@@ -100,7 +100,7 @@
<!-- Insert all given permissions --> <!-- Insert all given permissions -->
<insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel"> <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
INSERT INTO [guacamole].[sharing_profile_permission] ( INSERT INTO [dbo].[guacamole_sharing_profile_permission] (
user_id, user_id,
permission, permission,
sharing_profile_id sharing_profile_id
@@ -117,10 +117,10 @@
#{permission.objectIdentifier,jdbcType=INTEGER} AS sharing_profile_id #{permission.objectIdentifier,jdbcType=INTEGER} AS sharing_profile_id
</foreach> </foreach>
AS permissions AS permissions
WHERE NOT EXISTS (SELECT 1 FROM [guacamole].[sharing_profile_permission] WHERE NOT EXISTS (SELECT 1 FROM [dbo].[guacamole_sharing_profile_permission]
WHERE [guacamole].[sharing_profile_permission].user_id = permissions.user_id WHERE [dbo].[guacamole_sharing_profile_permission].user_id = permissions.user_id
AND [guacamole].[sharing_profile_permission].permission = permissions.permission AND [dbo].[guacamole_sharing_profile_permission].permission = permissions.permission
AND [guacamole].[sharing_profile_permission].sharing_profile_id = permissions.sharing_profile_id AND [dbo].[guacamole_sharing_profile_permission].sharing_profile_id = permissions.sharing_profile_id
); );
</insert> </insert>

View File

@@ -35,12 +35,12 @@
<select id="select" resultMap="SystemPermissionResultMap"> <select id="select" resultMap="SystemPermissionResultMap">
SELECT SELECT
[guacamole].[system_permission].user_id, [dbo].[guacamole_system_permission].user_id,
username, username,
permission permission
FROM [guacamole].[system_permission] FROM [dbo].[guacamole_system_permission]
JOIN [guacamole].[user] ON [guacamole].[system_permission].user_id = [guacamole].[user].user_id JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_system_permission].user_id = [dbo].[guacamole_user].user_id
WHERE [guacamole].[system_permission].user_id = #{user.objectID,jdbcType=INTEGER} WHERE [dbo].[guacamole_system_permission].user_id = #{user.objectID,jdbcType=INTEGER}
</select> </select>
@@ -48,13 +48,13 @@
<select id="selectOne" resultMap="SystemPermissionResultMap"> <select id="selectOne" resultMap="SystemPermissionResultMap">
SELECT SELECT
[guacamole].[system_permission].user_id, [dbo].[guacamole_system_permission].user_id,
username, username,
permission permission
FROM [guacamole].[system_permission] FROM [dbo].[guacamole_system_permission]
JOIN [guacamole].[user] ON [guacamole].[system_permission].user_id = [guacamole].[user].user_id JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_system_permission].user_id = [dbo].[guacamole_user].user_id
WHERE WHERE
[guacamole].[system_permission].user_id = #{user.objectID,jdbcType=INTEGER} [dbo].[guacamole_system_permission].user_id = #{user.objectID,jdbcType=INTEGER}
AND permission = #{type,jdbcType=VARCHAR} AND permission = #{type,jdbcType=VARCHAR}
</select> </select>
@@ -62,7 +62,7 @@
<!-- Delete all given permissions --> <!-- Delete all given permissions -->
<delete id="delete" parameterType="org.apache.guacamole.auth.jdbc.permission.SystemPermissionModel"> <delete id="delete" parameterType="org.apache.guacamole.auth.jdbc.permission.SystemPermissionModel">
DELETE FROM [guacamole].[system_permission] DELETE FROM [dbo].[guacamole_system_permission]
WHERE WHERE
<foreach collection="permissions" item="permission" <foreach collection="permissions" item="permission"
open="(" separator=" OR " close=")"> open="(" separator=" OR " close=")">
@@ -75,7 +75,7 @@
<!-- Insert all given permissions --> <!-- Insert all given permissions -->
<insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.permission.SystemPermissionModel"> <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.permission.SystemPermissionModel">
INSERT INTO [guacamole].[system_permission] ( INSERT INTO [dbo].[guacamole_system_permission] (
user_id, user_id,
permission permission
) )
@@ -89,9 +89,9 @@
#{permission.type,jdbcType=VARCHAR} AS permission #{permission.type,jdbcType=VARCHAR} AS permission
</foreach> </foreach>
AS permissions AS permissions
WHERE NOT EXISTS (SELECT 1 FROM [guacamole].[system_permission] WHERE NOT EXISTS (SELECT 1 FROM [dbo].[guacamole_system_permission]
WHERE [guacamole].[system_permission].user_id = permissions.user_id WHERE [dbo].[guacamole_system_permission].user_id = permissions.user_id
AND [guacamole].[system_permission].permission = permissions.permission AND [dbo].[guacamole_system_permission].permission = permissions.permission
); );
</insert> </insert>

View File

@@ -36,14 +36,14 @@
<select id="select" resultMap="UserPermissionResultMap"> <select id="select" resultMap="UserPermissionResultMap">
SELECT SELECT
[guacamole].[user_permission].user_id, [dbo].[guacamole_user_permission].user_id,
[guacamole].[user].username, [dbo].[guacamole_user].username,
permission, permission,
affected.username AS affected_username affected.username AS affected_username
FROM [guacamole].[user_permission] FROM [dbo].[guacamole_user_permission]
JOIN [guacamole].[user] ON [guacamole].[user_permission].user_id = [guacamole].[user].user_id JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_user_permission].user_id = [dbo].[guacamole_user].user_id
JOIN [guacamole].[user] affected ON [guacamole].[user_permission].affected_user_id = affected.user_id JOIN [dbo].[guacamole_user] affected ON [dbo].[guacamole_user_permission].affected_user_id = affected.user_id
WHERE [guacamole].[user_permission].user_id = #{user.objectID,jdbcType=INTEGER} WHERE [dbo].[guacamole_user_permission].user_id = #{user.objectID,jdbcType=INTEGER}
</select> </select>
@@ -51,15 +51,15 @@
<select id="selectOne" resultMap="UserPermissionResultMap"> <select id="selectOne" resultMap="UserPermissionResultMap">
SELECT SELECT
[guacamole].[user_permission].user_id, [dbo].[guacamole_user_permission].user_id,
[guacamole].[user].username, [dbo].[guacamole_user].username,
permission, permission,
affected.username AS affected_username affected.username AS affected_username
FROM [guacamole].[user_permission] FROM [dbo].[guacamole_user_permission]
JOIN [guacamole].[user] ON [guacamole].[user_permission].user_id = [guacamole].[user].user_id JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_user_permission].user_id = [dbo].[guacamole_user].user_id
JOIN [guacamole].[user] affected ON [guacamole].[user_permission].affected_user_id = affected.user_id JOIN [dbo].[guacamole_user] affected ON [dbo].[guacamole_user_permission].affected_user_id = affected.user_id
WHERE WHERE
[guacamole].[user_permission].user_id = #{user.objectID,jdbcType=INTEGER} [dbo].[guacamole_user_permission].user_id = #{user.objectID,jdbcType=INTEGER}
AND permission = #{type,jdbcType=VARCHAR} AND permission = #{type,jdbcType=VARCHAR}
AND affected.username = #{identifier,jdbcType=INTEGER} AND affected.username = #{identifier,jdbcType=INTEGER}
@@ -69,10 +69,10 @@
<select id="selectAccessibleIdentifiers" resultType="string"> <select id="selectAccessibleIdentifiers" resultType="string">
SELECT DISTINCT username SELECT DISTINCT username
FROM [guacamole].[user_permission] FROM [dbo].[guacamole_user_permission]
JOIN [guacamole].[user] ON [guacamole].[user_permission].affected_user_id = [guacamole].[user].user_id JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_user_permission].affected_user_id = [dbo].[guacamole_user].user_id
WHERE WHERE
[guacamole].[user_permission].user_id = #{user.objectID,jdbcType=INTEGER} [dbo].[guacamole_user_permission].user_id = #{user.objectID,jdbcType=INTEGER}
AND username IN AND username IN
<foreach collection="identifiers" item="identifier" <foreach collection="identifiers" item="identifier"
open="(" separator="," close=")"> open="(" separator="," close=")">
@@ -89,11 +89,11 @@
<!-- Delete all given permissions --> <!-- Delete all given permissions -->
<delete id="delete" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel"> <delete id="delete" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
DELETE FROM [guacamole].[user_permission] DELETE FROM [dbo].[guacamole_user_permission]
USING [guacamole].[user] affected USING [dbo].[guacamole_user] affected
WHERE WHERE
[guacamole].[user_permission].affected_user_id = affected.user_id [dbo].[guacamole_user_permission].affected_user_id = affected.user_id
AND ([guacamole].[user_permission].user_id, permission, affected.username) IN AND ([dbo].[guacamole_user_permission].user_id, permission, affected.username) IN
<foreach collection="permissions" item="permission" <foreach collection="permissions" item="permission"
open="(" separator="," close=")"> open="(" separator="," close=")">
(#{permission.userID,jdbcType=INTEGER}, (#{permission.userID,jdbcType=INTEGER},
@@ -106,7 +106,7 @@
<!-- Insert all given permissions --> <!-- Insert all given permissions -->
<insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel"> <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
INSERT INTO [guacamole].[user_permission] ( INSERT INTO [dbo].[guacamole_user_permission] (
user_id, user_id,
permission, permission,
affected_user_id affected_user_id
@@ -114,7 +114,7 @@
SELECT DISTINCT SELECT DISTINCT
permissions.user_id, permissions.user_id,
permissions.permission, permissions.permission,
[guacamole].[user].user_id [dbo].[guacamole_user].user_id
FROM FROM
<foreach collection="permissions" item="permission" <foreach collection="permissions" item="permission"
open="(" separator="UNION ALL" close=")"> open="(" separator="UNION ALL" close=")">
@@ -123,11 +123,11 @@
#{permission.objectIdentifier,jdbcType=INTEGER} AS username #{permission.objectIdentifier,jdbcType=INTEGER} AS username
</foreach> </foreach>
AS permissions AS permissions
JOIN [guacamole].[user] ON [guacamole].[user].username = permissions.username JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_user].username = permissions.username
WHERE NOT EXISTS (SELECT 1 FROM [guacamole].[user_permission] WHERE NOT EXISTS (SELECT 1 FROM [dbo].[guacamole_user_permission]
WHERE [guacamole].[user_permission].user_id = permissions.user_id WHERE [dbo].[guacamole_user_permission].user_id = permissions.user_id
AND [guacamole].[user_permission].permission = permissions.permission AND [dbo].[guacamole_user_permission].permission = permissions.permission
AND [guacamole].[user_permission].affected_user_id = [guacamole].[user].user_id AND [dbo].[guacamole_user_permission].affected_user_id = [dbo].[guacamole_user].user_id
); );
</insert> </insert>

View File

@@ -33,13 +33,13 @@
<!-- Select all sharing profile identifiers --> <!-- Select all sharing profile identifiers -->
<select id="selectIdentifiers" resultType="string"> <select id="selectIdentifiers" resultType="string">
SELECT sharing_profile_id SELECT sharing_profile_id
FROM [guacamole].[sharing_profile] FROM [dbo].[guacamole_sharing_profile]
</select> </select>
<!-- Select identifiers of all readable sharing profiles --> <!-- Select identifiers of all readable sharing profiles -->
<select id="selectReadableIdentifiers" resultType="string"> <select id="selectReadableIdentifiers" resultType="string">
SELECT sharing_profile_id SELECT sharing_profile_id
FROM [guacamole].[sharing_profile_permission] FROM [dbo].[guacamole_sharing_profile_permission]
WHERE WHERE
user_id = #{user.objectID,jdbcType=INTEGER} user_id = #{user.objectID,jdbcType=INTEGER}
AND permission = 'READ' AND permission = 'READ'
@@ -52,7 +52,7 @@
sharing_profile_id, sharing_profile_id,
sharing_profile_name, sharing_profile_name,
primary_connection_id primary_connection_id
FROM [guacamole].[sharing_profile] FROM [dbo].[guacamole_sharing_profile]
WHERE sharing_profile_id IN WHERE sharing_profile_id IN
<foreach collection="identifiers" item="identifier" <foreach collection="identifiers" item="identifier"
open="(" separator="," close=")"> open="(" separator="," close=")">
@@ -65,12 +65,12 @@
<select id="selectReadable" resultMap="SharingProfileResultMap"> <select id="selectReadable" resultMap="SharingProfileResultMap">
SELECT SELECT
[guacamole].[sharing_profile].sharing_profile_id, [dbo].[guacamole_sharing_profile].sharing_profile_id,
[guacamole].[sharing_profile].sharing_profile_name, [dbo].[guacamole_sharing_profile].sharing_profile_name,
primary_connection_id primary_connection_id
FROM [guacamole].[sharing_profile] FROM [dbo].[guacamole_sharing_profile]
JOIN [guacamole].[sharing_profile_permission] ON [guacamole].[sharing_profile_permission].sharing_profile_id = [guacamole].[sharing_profile].sharing_profile_id JOIN [dbo].[guacamole_sharing_profile_permission] ON [dbo].[guacamole_sharing_profile_permission].sharing_profile_id = [dbo].[guacamole_sharing_profile].sharing_profile_id
WHERE [guacamole].[sharing_profile].sharing_profile_id IN WHERE [dbo].[guacamole_sharing_profile].sharing_profile_id IN
<foreach collection="identifiers" item="identifier" <foreach collection="identifiers" item="identifier"
open="(" separator="," close=")"> open="(" separator="," close=")">
#{identifier,jdbcType=INTEGER} #{identifier,jdbcType=INTEGER}
@@ -87,7 +87,7 @@
sharing_profile_id, sharing_profile_id,
sharing_profile_name, sharing_profile_name,
primary_connection_id primary_connection_id
FROM [guacamole].[sharing_profile] FROM [dbo].[guacamole_sharing_profile]
WHERE WHERE
primary_connection_id = #{parentIdentifier,jdbcType=INTEGER} primary_connection_id = #{parentIdentifier,jdbcType=INTEGER}
AND sharing_profile_name = #{name,jdbcType=VARCHAR} AND sharing_profile_name = #{name,jdbcType=VARCHAR}
@@ -96,7 +96,7 @@
<!-- Delete single sharing profile by identifier --> <!-- Delete single sharing profile by identifier -->
<delete id="delete"> <delete id="delete">
DELETE FROM [guacamole].[sharing_profile] DELETE FROM [dbo].[guacamole_sharing_profile]
WHERE sharing_profile_id = #{identifier,jdbcType=INTEGER} WHERE sharing_profile_id = #{identifier,jdbcType=INTEGER}
</delete> </delete>
@@ -104,7 +104,7 @@
<insert id="insert" useGeneratedKeys="true" keyProperty="object.objectID" <insert id="insert" useGeneratedKeys="true" keyProperty="object.objectID"
parameterType="org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileModel"> parameterType="org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileModel">
INSERT INTO [guacamole].[sharing_profile] ( INSERT INTO [dbo].[guacamole_sharing_profile] (
sharing_profile_name, sharing_profile_name,
primary_connection_id primary_connection_id
) )
@@ -117,7 +117,7 @@
<!-- Update single sharing profile --> <!-- Update single sharing profile -->
<update id="update" parameterType="org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileModel"> <update id="update" parameterType="org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileModel">
UPDATE [guacamole].[sharing_profile] UPDATE [dbo].[guacamole_sharing_profile]
SET sharing_profile_name = #{object.name,jdbcType=VARCHAR}, SET sharing_profile_name = #{object.name,jdbcType=VARCHAR},
primary_connection_id = #{object.parentIdentifier,jdbcType=INTEGER} primary_connection_id = #{object.parentIdentifier,jdbcType=INTEGER}
WHERE sharing_profile_id = #{object.objectID,jdbcType=INTEGER} WHERE sharing_profile_id = #{object.objectID,jdbcType=INTEGER}

View File

@@ -36,21 +36,21 @@
sharing_profile_id, sharing_profile_id,
parameter_name, parameter_name,
parameter_value parameter_value
FROM [guacamole].[sharing_profile_parameter] FROM [dbo].[guacamole_sharing_profile_parameter]
WHERE WHERE
sharing_profile_id = #{identifier,jdbcType=INTEGER} sharing_profile_id = #{identifier,jdbcType=INTEGER}
</select> </select>
<!-- Delete all parameters of a given sharing profile --> <!-- Delete all parameters of a given sharing profile -->
<delete id="delete"> <delete id="delete">
DELETE FROM [guacamole].[sharing_profile_parameter] DELETE FROM [dbo].[guacamole_sharing_profile_parameter]
WHERE sharing_profile_id = #{identifier,jdbcType=INTEGER} WHERE sharing_profile_id = #{identifier,jdbcType=INTEGER}
</delete> </delete>
<!-- Insert all given parameters --> <!-- Insert all given parameters -->
<insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileParameterModel"> <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileParameterModel">
INSERT INTO [guacamole].[sharing_profile_parameter] ( INSERT INTO [dbo].[guacamole_sharing_profile_parameter] (
sharing_profile_id, sharing_profile_id,
parameter_name, parameter_name,
parameter_value parameter_value

View File

@@ -35,16 +35,16 @@
<select id="select" resultMap="PasswordRecordResultMap"> <select id="select" resultMap="PasswordRecordResultMap">
SELECT SELECT
[guacamole].[user_password_history].user_id, [dbo].[guacamole_user_password_history].user_id,
[guacamole].[user_password_history].password_hash, [dbo].[guacamole_user_password_history].password_hash,
[guacamole].[user_password_history].password_salt, [dbo].[guacamole_user_password_history].password_salt,
[guacamole].[user_password_history].password_date [dbo].[guacamole_user_password_history].password_date
FROM [guacamole].[user_password_history] FROM [dbo].[guacamole_user_password_history]
JOIN [guacamole].[user] ON [guacamole].[user_password_history].user_id = [guacamole].[user].user_id JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_user_password_history].user_id = [dbo].[guacamole_user].user_id
WHERE WHERE
[guacamole].[user].username = #{username,jdbcType=VARCHAR} [dbo].[guacamole_user].username = #{username,jdbcType=VARCHAR}
ORDER BY ORDER BY
[guacamole].[user_password_history].password_date DESC [dbo].[guacamole_user_password_history].password_date DESC
LIMIT #{maxHistorySize} LIMIT #{maxHistorySize}
</select> </select>
@@ -52,7 +52,7 @@
<!-- Insert the given password record --> <!-- Insert the given password record -->
<insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.user.PasswordRecordModel"> <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.user.PasswordRecordModel">
INSERT INTO [guacamole].[user_password_history] ( INSERT INTO [dbo].[guacamole_user_password_history] (
user_id, user_id,
password_hash, password_hash,
password_salt, password_salt,
@@ -65,10 +65,10 @@
#{record.passwordDate,jdbcType=TIMESTAMP} #{record.passwordDate,jdbcType=TIMESTAMP}
); );
DELETE FROM [guacamole].[user_password_history] DELETE FROM [dbo].[guacamole_user_password_history]
WHERE password_history_id IN ( WHERE password_history_id IN (
SELECT password_history_id SELECT password_history_id
FROM [guacamole].[user_password_history] FROM [dbo].[guacamole_user_password_history]
WHERE user_id = #{record.userID,jdbcType=INTEGER} WHERE user_id = #{record.userID,jdbcType=INTEGER}
ORDER BY password_date DESC ORDER BY password_date DESC
OFFSET #{maxHistorySize} OFFSET #{maxHistorySize}

View File

@@ -46,16 +46,16 @@
<!-- Select all usernames --> <!-- Select all usernames -->
<select id="selectIdentifiers" resultType="string"> <select id="selectIdentifiers" resultType="string">
SELECT username SELECT username
FROM [guacamole].[user] FROM [dbo].[guacamole_user]
</select> </select>
<!-- Select usernames of all readable users --> <!-- Select usernames of all readable users -->
<select id="selectReadableIdentifiers" resultType="string"> <select id="selectReadableIdentifiers" resultType="string">
SELECT username SELECT username
FROM [guacamole].[user] FROM [dbo].[guacamole_user]
JOIN [guacamole].[user_permission] ON affected_user_id = [guacamole].[user].user_id JOIN [dbo].[guacamole_user_permission] ON affected_user_id = [dbo].[guacamole_user].user_id
WHERE WHERE
[guacamole].[user_permission].user_id = #{user.objectID,jdbcType=INTEGER} [dbo].[guacamole_user_permission].user_id = #{user.objectID,jdbcType=INTEGER}
AND permission = 'READ' AND permission = 'READ'
</select> </select>
@@ -79,7 +79,7 @@
email_address, email_address,
organization, organization,
organizational_role organizational_role
FROM [guacamole].[user] FROM [dbo].[guacamole_user]
WHERE username IN WHERE username IN
<foreach collection="identifiers" item="identifier" <foreach collection="identifiers" item="identifier"
open="(" separator="," close=")"> open="(" separator="," close=")">
@@ -92,7 +92,7 @@
<select id="selectReadable" resultMap="UserResultMap"> <select id="selectReadable" resultMap="UserResultMap">
SELECT SELECT
[guacamole].[user].user_id, [dbo].[guacamole_user].user_id,
username, username,
password_hash, password_hash,
password_salt, password_salt,
@@ -108,14 +108,14 @@
email_address, email_address,
organization, organization,
organizational_role organizational_role
FROM [guacamole].[user] FROM [dbo].[guacamole_user]
JOIN [guacamole].[user_permission] ON affected_user_id = [guacamole].[user].user_id JOIN [dbo].[guacamole_user_permission] ON affected_user_id = [dbo].[guacamole_user].user_id
WHERE username IN WHERE username IN
<foreach collection="identifiers" item="identifier" <foreach collection="identifiers" item="identifier"
open="(" separator="," close=")"> open="(" separator="," close=")">
#{identifier,jdbcType=VARCHAR} #{identifier,jdbcType=VARCHAR}
</foreach> </foreach>
AND [guacamole].[user_permission].user_id = #{user.objectID,jdbcType=INTEGER} AND [dbo].[guacamole_user_permission].user_id = #{user.objectID,jdbcType=INTEGER}
AND permission = 'READ' AND permission = 'READ'
</select> </select>
@@ -140,7 +140,7 @@
email_address, email_address,
organization, organization,
organizational_role organizational_role
FROM [guacamole].[user] FROM [dbo].[guacamole_user]
WHERE WHERE
username = #{username,jdbcType=VARCHAR} username = #{username,jdbcType=VARCHAR}
@@ -148,7 +148,7 @@
<!-- Delete single user by username --> <!-- Delete single user by username -->
<delete id="delete"> <delete id="delete">
DELETE FROM [guacamole].[user] DELETE FROM [dbo].[guacamole_user]
WHERE username = #{identifier,jdbcType=VARCHAR} WHERE username = #{identifier,jdbcType=VARCHAR}
</delete> </delete>
@@ -156,7 +156,7 @@
<insert id="insert" useGeneratedKeys="true" keyProperty="object.objectID" <insert id="insert" useGeneratedKeys="true" keyProperty="object.objectID"
parameterType="org.apache.guacamole.auth.jdbc.user.UserModel"> parameterType="org.apache.guacamole.auth.jdbc.user.UserModel">
INSERT INTO [guacamole].[user] ( INSERT INTO [dbo].[guacamole_user] (
username, username,
password_hash, password_hash,
password_salt, password_salt,
@@ -195,7 +195,7 @@
<!-- Update single user --> <!-- Update single user -->
<update id="update" parameterType="org.apache.guacamole.auth.jdbc.user.UserModel"> <update id="update" parameterType="org.apache.guacamole.auth.jdbc.user.UserModel">
UPDATE [guacamole].[user] UPDATE [dbo].[guacamole_user]
SET password_hash = #{object.passwordHash,jdbcType=BINARY}, SET password_hash = #{object.passwordHash,jdbcType=BINARY},
password_salt = #{object.passwordSalt,jdbcType=BINARY}, password_salt = #{object.passwordSalt,jdbcType=BINARY},
password_date = #{object.passwordDate,jdbcType=TIMESTAMP}, password_date = #{object.passwordDate,jdbcType=TIMESTAMP},