You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by mj...@apache.org on 2017/10/01 02:10:13 UTC

[01/28] incubator-guacamole-client git commit: GUACAMOLE-363: Initial commit of SQLServer authentication module for JDBC.

Repository: incubator-guacamole-client
Updated Branches:
  refs/heads/master 81ffa5c8e -> d808f7fbb


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b6e88d33/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connectiongroup/ConnectionGroupMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connectiongroup/ConnectionGroupMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connectiongroup/ConnectionGroupMapper.xml
new file mode 100644
index 0000000..47a3e63
--- /dev/null
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connectiongroup/ConnectionGroupMapper.xml
@@ -0,0 +1,232 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+    "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+
+<mapper namespace="org.apache.guacamole.auth.jdbc.connectiongroup.ConnectionGroupMapper" >
+
+    <!-- Result mapper for connection objects -->
+    <resultMap id="ConnectionGroupResultMap" type="org.apache.guacamole.auth.jdbc.connectiongroup.ConnectionGroupModel" >
+
+        <!-- Connection group properties -->
+        <id     column="connection_group_id"      property="objectID"               jdbcType="INTEGER"/>
+        <result column="connection_group_name"    property="name"                   jdbcType="VARCHAR"/>
+        <result column="parent_id"                property="parentIdentifier"       jdbcType="INTEGER"/>
+        <result column="type"                     property="type"                   jdbcType="VARCHAR"
+                javaType="org.apache.guacamole.net.auth.ConnectionGroup$Type"/>
+        <result column="max_connections"          property="maxConnections"         jdbcType="INTEGER"/>
+        <result column="max_connections_per_user" property="maxConnectionsPerUser"  jdbcType="INTEGER"/>
+        <result column="enable_session_affinity"  property="sessionAffinityEnabled" jdbcType="INTEGER"/>
+
+        <!-- Child connection groups -->
+        <collection property="connectionGroupIdentifiers" resultSet="childConnectionGroups" ofType="java.lang.String"
+                    column="connection_group_id" foreignColumn="parent_id">
+            <result column="connection_group_id"/>
+        </collection>
+
+        <!-- Child connections -->
+        <collection property="connectionIdentifiers" resultSet="childConnections" ofType="java.lang.String"
+                    column="connection_group_id" foreignColumn="parent_id">
+            <result column="connection_id"/>
+        </collection>
+
+    </resultMap>
+
+    <!-- Select all connection group identifiers -->
+    <select id="selectIdentifiers" resultType="string">
+        SELECT connection_group_id 
+        FROM [guacamole].[connection_group]
+    </select>
+
+    <!-- Select identifiers of all readable connection groups -->
+    <select id="selectReadableIdentifiers" resultType="string">
+        SELECT connection_group_id
+        FROM [guacamole].[connection_group_permission]
+        WHERE
+            user_id = #{user.objectID,jdbcType=INTEGER}
+            AND permission = 'READ'
+    </select>
+
+    <!-- Select all connection identifiers within a particular connection group -->
+    <select id="selectIdentifiersWithin" resultType="string">
+        SELECT connection_group_id 
+        FROM [guacamole].[connection_group]
+        WHERE
+            <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if>
+            <if test="parentIdentifier == null">parent_id IS NULL</if>
+    </select>
+
+    <!-- Select identifiers of all readable connection groups within a particular connection group -->
+    <select id="selectReadableIdentifiersWithin" resultType="string">
+        SELECT [guacamole].[connection_group].connection_group_id
+        FROM [guacamole].[connection_group]
+        JOIN [guacamole].[connection_group_permission] ON [guacamole].[connection_group_permission].connection_group_id = [guacamole].[connection_group].connection_group_id
+        WHERE
+            <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if>
+            <if test="parentIdentifier == null">parent_id IS NULL</if>
+            AND user_id = #{user.objectID,jdbcType=INTEGER}
+            AND permission = 'READ'
+    </select>
+
+    <!-- Select multiple connection groups by identifier -->
+    <select id="select" resultMap="ConnectionGroupResultMap"
+            resultSets="connectionGroups,childConnectionGroups,childConnections">
+
+        SELECT
+            connection_group_id,
+            connection_group_name,
+            parent_id,
+            type,
+            max_connections,
+            max_connections_per_user,
+            enable_session_affinity
+        FROM [guacamole].[connection_group]
+        WHERE connection_group_id IN
+            <foreach collection="identifiers" item="identifier"
+                     open="(" separator="," close=")">
+                #{identifier,jdbcType=INTEGER}
+            </foreach>;
+
+        SELECT parent_id, connection_group_id
+        FROM [guacamole].[connection_group]
+        WHERE parent_id IN
+            <foreach collection="identifiers" item="identifier"
+                     open="(" separator="," close=")">
+                #{identifier,jdbcType=INTEGER}
+            </foreach>;
+
+        SELECT parent_id, connection_id
+        FROM [guacamole].[connection]
+        WHERE parent_id IN
+            <foreach collection="identifiers" item="identifier"
+                     open="(" separator="," close=")">
+                #{identifier,jdbcType=INTEGER}
+            </foreach>;
+
+    </select>
+
+    <!-- Select multiple connection groups by identifier only if readable -->
+    <select id="selectReadable" resultMap="ConnectionGroupResultMap"
+            resultSets="connectionGroups,childConnectionGroups,childConnections">
+
+        SELECT
+            [guacamole].[connection_group].connection_group_id,
+            connection_group_name,
+            parent_id,
+            type,
+            max_connections,
+            max_connections_per_user,
+            enable_session_affinity
+        FROM [guacamole].[connection_group]
+        JOIN [guacamole].[connection_group_permission] ON [guacamole].[connection_group_permission].connection_group_id = [guacamole].[connection_group].connection_group_id
+        WHERE [guacamole].[connection_group].connection_group_id IN
+            <foreach collection="identifiers" item="identifier"
+                     open="(" separator="," close=")">
+                #{identifier,jdbcType=INTEGER}
+            </foreach>
+            AND user_id = #{user.objectID,jdbcType=INTEGER}
+            AND permission = 'READ';
+
+        SELECT parent_id, [guacamole].[connection_group].connection_group_id
+        FROM [guacamole].[connection_group]
+        JOIN [guacamole].[connection_group_permission] ON [guacamole].[connection_group_permission].connection_group_id = [guacamole].[connection_group].connection_group_id
+        WHERE parent_id IN
+            <foreach collection="identifiers" item="identifier"
+                     open="(" separator="," close=")">
+                #{identifier,jdbcType=INTEGER}
+            </foreach>
+            AND user_id = #{user.objectID,jdbcType=INTEGER}
+            AND permission = 'READ';
+
+        SELECT parent_id, [guacamole].[connection].connection_id
+        FROM [guacamole].[connection]
+        JOIN [guacamole].[connection_permission] ON [guacamole].[connection_permission].connection_id = [guacamole].[connection].connection_id
+        WHERE parent_id IN
+            <foreach collection="identifiers" item="identifier"
+                     open="(" separator="," close=")">
+                #{identifier,jdbcType=INTEGER}
+            </foreach>
+            AND user_id = #{user.objectID,jdbcType=INTEGER}
+            AND permission = 'READ';
+
+    </select>
+
+    <!-- Select single connection group by name -->
+    <select id="selectOneByName" resultMap="ConnectionGroupResultMap">
+
+        SELECT
+            connection_group_id,
+            connection_group_name,
+            parent_id,
+            type,
+            max_connections,
+            max_connections_per_user,
+            enable_session_affinity
+        FROM [guacamole].[connection_group]
+        WHERE 
+            <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if>
+            <if test="parentIdentifier == null">parent_id IS NULL</if>
+            AND connection_group_name = #{name,jdbcType=VARCHAR}
+
+    </select>
+
+    <!-- Delete single connection group by identifier -->
+    <delete id="delete">
+        DELETE FROM [guacamole].[connection_group]
+        WHERE connection_group_id = #{identifier,jdbcType=INTEGER}
+    </delete>
+
+    <!-- Insert single connection -->
+    <insert id="insert" useGeneratedKeys="true" keyProperty="object.objectID"
+            parameterType="org.apache.guacamole.auth.jdbc.connectiongroup.ConnectionGroupModel">
+
+        INSERT INTO [guacamole].[connection_group] (
+            connection_group_name,
+            parent_id,
+            type,
+            max_connections,
+            max_connections_per_user,
+            enable_session_affinity
+        )
+        VALUES (
+            #{object.name,jdbcType=VARCHAR},
+            #{object.parentIdentifier,jdbcType=INTEGER},
+            #{object.type,jdbcType=VARCHAR},
+            #{object.maxConnections,jdbcType=INTEGER},
+            #{object.maxConnectionsPerUser,jdbcType=INTEGER},
+            #{object.sessionAffinityEnabled,jdbcType=INTEGER}
+        )
+
+    </insert>
+
+    <!-- Update single connection group -->
+    <update id="update" parameterType="org.apache.guacamole.auth.jdbc.connectiongroup.ConnectionGroupModel">
+        UPDATE [guacamole].[connection_group]
+        SET connection_group_name    = #{object.name,jdbcType=VARCHAR},
+            parent_id                = #{object.parentIdentifier,jdbcType=INTEGER},
+            type                     = #{object.type,jdbcType=VARCHAR},
+            max_connections          = #{object.maxConnections,jdbcType=INTEGER},
+            max_connections_per_user = #{object.maxConnectionsPerUser,jdbcType=INTEGER},
+            enable_session_affinity  = #{object.sessionAffinityEnabled,jdbcType=INTEGER}
+        WHERE connection_group_id = #{object.objectID,jdbcType=INTEGER}
+    </update>
+
+</mapper>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b6e88d33/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionGroupPermissionMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionGroupPermissionMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionGroupPermissionMapper.xml
new file mode 100644
index 0000000..2890ab3
--- /dev/null
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionGroupPermissionMapper.xml
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+    "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+
+<mapper namespace="org.apache.guacamole.auth.jdbc.permission.ConnectionGroupPermissionMapper" >
+
+    <!-- Result mapper for connection permissions -->
+    <resultMap id="ConnectionGroupPermissionResultMap" type="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
+        <result column="user_id"             property="userID"           jdbcType="INTEGER"/>
+        <result column="username"            property="username"         jdbcType="VARCHAR"/>
+        <result column="permission"          property="type"             jdbcType="VARCHAR"
+                javaType="org.apache.guacamole.net.auth.permission.ObjectPermission$Type"/>
+        <result column="connection_group_id" property="objectIdentifier" jdbcType="INTEGER"/>
+    </resultMap>
+
+    <!-- Select all permissions for a given user -->
+    <select id="select" resultMap="ConnectionGroupPermissionResultMap">
+
+        SELECT
+            [guacamole].[connection_group_permission].user_id,
+            username,
+            permission,
+            connection_group_id
+        FROM [guacamole].[connection_group_permission]
+        JOIN [guacamole].[user] ON [guacamole].[connection_group_permission].user_id = [guacamole].[user].user_id
+        WHERE [guacamole].[connection_group_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+
+    </select>
+
+    <!-- Select the single permission matching the given criteria -->
+    <select id="selectOne" resultMap="ConnectionGroupPermissionResultMap">
+
+        SELECT
+            [guacamole].[connection_group_permission].user_id,
+            username,
+            permission,
+            connection_group_id
+        FROM [guacamole].[connection_group_permission]
+        JOIN [guacamole].[user] ON [guacamole].[connection_group_permission].user_id = [guacamole].[user].user_id
+        WHERE
+            [guacamole].[connection_group_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+            AND permission = #{type,jdbcType=VARCHAR}
+            AND connection_group_id = #{identifier,jdbcType=INTEGER}
+
+    </select>
+
+    <!-- Select identifiers accessible by the given user for the given permissions -->
+    <select id="selectAccessibleIdentifiers" resultType="string">
+
+        SELECT DISTINCT connection_group_id 
+        FROM [guacamole].[connection_group_permission]
+        WHERE
+            user_id = #{user.objectID,jdbcType=INTEGER}
+            AND connection_group_id IN
+                <foreach collection="identifiers" item="identifier"
+                         open="(" separator="," close=")">
+                    #{identifier,jdbcType=INTEGER}
+                </foreach>
+            AND permission IN
+                <foreach collection="permissions" item="permission"
+                         open="(" separator="," close=")">
+                    #{permission,jdbcType=VARCHAR}
+                </foreach>
+
+    </select>
+
+    <!-- Delete all given permissions -->
+    <delete id="delete" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
+
+        DELETE FROM [guacamole].[connection_group_permission]
+        WHERE (user_id, permission, connection_group_id) IN
+            <foreach collection="permissions" item="permission"
+                     open="(" separator="," close=")">
+                (#{permission.userID,jdbcType=INTEGER},
+                 #{permission.type,jdbcType=VARCHAR},
+                 #{permission.objectIdentifier,jdbcType=INTEGER})
+            </foreach>
+
+    </delete>
+
+    <!-- Insert all given permissions -->
+    <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
+
+        INSERT INTO [guacamole].[connection_group_permission] (
+            user_id,
+            permission,
+            connection_group_id
+        )
+        SELECT DISTINCT
+            permissions.user_id,
+            permissions.permission,
+            permissions.connection_group_id
+        FROM
+            <foreach collection="permissions" item="permission"
+                     open="(" separator="UNION ALL" close=")">
+                SELECT #{permission.userID,jdbcType=INTEGER}                                 AS user_id,
+                       #{permission.type,jdbcType=VARCHAR} AS permission,
+                       #{permission.objectIdentifier,jdbcType=INTEGER} AS connection_group_id
+            </foreach>
+        AS permissions
+        WHERE (user_id, permission, connection_group_id) NOT IN (
+            SELECT
+                [guacamole].[connection_group_permission].user_id,
+                [guacamole].[connection_group_permission].permission,
+                [guacamole].[connection_group_permission].connection_group_id
+            FROM [guacamole].[connection_group_permission]
+        );
+
+    </insert>
+
+</mapper>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b6e88d33/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionPermissionMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionPermissionMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionPermissionMapper.xml
new file mode 100644
index 0000000..8ea85bc
--- /dev/null
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionPermissionMapper.xml
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+    "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+
+<mapper namespace="org.apache.guacamole.auth.jdbc.permission.ConnectionPermissionMapper" >
+
+    <!-- Result mapper for connection permissions -->
+    <resultMap id="ConnectionPermissionResultMap" type="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
+        <result column="user_id"       property="userID"           jdbcType="INTEGER"/>
+        <result column="username"      property="username"         jdbcType="VARCHAR"/>
+        <result column="permission"    property="type"             jdbcType="VARCHAR"
+                javaType="org.apache.guacamole.net.auth.permission.ObjectPermission$Type"/>
+        <result column="connection_id" property="objectIdentifier" jdbcType="INTEGER"/>
+    </resultMap>
+
+    <!-- Select all permissions for a given user -->
+    <select id="select" resultMap="ConnectionPermissionResultMap">
+
+        SELECT
+            [guacamole].[connection_permission].user_id,
+            username,
+            permission,
+            connection_id
+        FROM [guacamole].[connection_permission]
+        JOIN [guacamole].[user] ON [guacamole].[connection_permission].user_id = [guacamole].[user].user_id
+        WHERE [guacamole].[connection_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+
+    </select>
+
+    <!-- Select the single permission matching the given criteria -->
+    <select id="selectOne" resultMap="ConnectionPermissionResultMap">
+
+        SELECT
+            [guacamole].[connection_permission].user_id,
+            username,
+            permission,
+            connection_id
+        FROM [guacamole].[connection_permission]
+        JOIN [guacamole].[user] ON [guacamole].[connection_permission].user_id = [guacamole].[user].user_id
+        WHERE
+            [guacamole].[connection_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+            AND permission = #{type,jdbcType=VARCHAR}
+            AND connection_id = #{identifier,jdbcType=INTEGER}
+
+    </select>
+
+    <!-- Select identifiers accessible by the given user for the given permissions -->
+    <select id="selectAccessibleIdentifiers" resultType="string">
+
+        SELECT DISTINCT connection_id 
+        FROM [guacamole].[connection_permission]
+        WHERE
+            user_id = #{user.objectID,jdbcType=INTEGER}
+            AND connection_id IN
+                <foreach collection="identifiers" item="identifier"
+                         open="(" separator="," close=")">
+                    #{identifier,jdbcType=INTEGER}
+                </foreach>
+            AND permission IN
+                <foreach collection="permissions" item="permission"
+                         open="(" separator="," close=")">
+                    #{permission,jdbcType=VARCHAR}
+                </foreach>
+
+    </select>
+
+    <!-- Delete all given permissions -->
+    <delete id="delete" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
+
+        DELETE FROM [guacamole].[connection_permission]
+        WHERE (user_id, permission, connection_id) IN
+            <foreach collection="permissions" item="permission"
+                     open="(" separator="," close=")">
+                (#{permission.userID,jdbcType=INTEGER},
+                 #{permission.type,jdbcType=VARCHAR},
+                 #{permission.objectIdentifier,jdbcType=INTEGER})
+            </foreach>
+
+    </delete>
+
+    <!-- Insert all given permissions -->
+    <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
+
+        INSERT INTO [guacamole].[connection_permission] (
+            user_id,
+            permission,
+            connection_id
+        )
+        SELECT DISTINCT
+            permissions.user_id,
+            permissions.permission,
+            permissions.connection_id
+        FROM
+            <foreach collection="permissions" item="permission"
+                     open="(" separator="UNION ALL" close=")">
+                SELECT #{permission.userID,jdbcType=INTEGER} AS user_id,
+                       #{permission.type,jdbcType=VARCHAR} AS permission,
+                       #{permission.objectIdentifier,jdbcType=INTEGER} AS connection_id
+            </foreach>
+        AS permissions
+        WHERE (user_id, permission, connection_id) NOT IN (
+            SELECT
+                [guacamole].[connection_permission].user_id,
+                [guacamole].[connection_permission].permission,
+                [guacamole].[connection_permission].connection_id
+            FROM [guacamole].[connection_permission]
+        );
+
+    </insert>
+
+</mapper>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b6e88d33/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SharingProfilePermissionMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SharingProfilePermissionMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SharingProfilePermissionMapper.xml
new file mode 100644
index 0000000..cb706b8
--- /dev/null
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SharingProfilePermissionMapper.xml
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+    "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+
+<mapper namespace="org.apache.guacamole.auth.jdbc.permission.SharingProfilePermissionMapper">
+
+    <!-- Result mapper for sharing profile permissions -->
+    <resultMap id="SharingProfilePermissionResultMap" type="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
+        <result column="user_id"            property="userID"           jdbcType="INTEGER"/>
+        <result column="username"           property="username"         jdbcType="VARCHAR"/>
+        <result column="permission"         property="type"             jdbcType="VARCHAR"
+                javaType="org.apache.guacamole.net.auth.permission.ObjectPermission$Type"/>
+        <result column="sharing_profile_id" property="objectIdentifier" jdbcType="INTEGER"/>
+    </resultMap>
+
+    <!-- Select all permissions for a given user -->
+    <select id="select" resultMap="SharingProfilePermissionResultMap">
+
+        SELECT
+            [guacamole].[sharing_profile_permission].user_id,
+            username,
+            permission,
+            sharing_profile_id
+        FROM [guacamole].[sharing_profile_permission]
+        JOIN [guacamole].[user] ON [guacamole].[sharing_profile_permission].user_id = [guacamole].[user].user_id
+        WHERE [guacamole].[sharing_profile_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+
+    </select>
+
+    <!-- Select the single permission matching the given criteria -->
+    <select id="selectOne" resultMap="SharingProfilePermissionResultMap">
+
+        SELECT
+            [guacamole].[sharing_profile_permission].user_id,
+            username,
+            permission,
+            sharing_profile_id
+        FROM [guacamole].[sharing_profile_permission]
+        JOIN [guacamole].[user] ON [guacamole].[sharing_profile_permission].user_id = [guacamole].[user].user_id
+        WHERE
+            [guacamole].[sharing_profile_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+            AND permission = #{type,jdbcType=VARCHAR}
+            AND sharing_profile_id = #{identifier,jdbcType=INTEGER}
+
+    </select>
+
+    <!-- Select identifiers accessible by the given user for the given permissions -->
+    <select id="selectAccessibleIdentifiers" resultType="string">
+
+        SELECT DISTINCT sharing_profile_id
+        FROM [guacamole].[sharing_profile_permission]
+        WHERE
+            user_id = #{user.objectID,jdbcType=INTEGER}
+            AND sharing_profile_id IN
+                <foreach collection="identifiers" item="identifier"
+                         open="(" separator="," close=")">
+                    #{identifier,jdbcType=INTEGER}
+                </foreach>
+            AND permission IN
+                <foreach collection="permissions" item="permission"
+                         open="(" separator="," close=")">
+                    #{permission,jdbcType=VARCHAR}
+                </foreach>
+
+    </select>
+
+    <!-- Delete all given permissions -->
+    <delete id="delete" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
+
+        DELETE FROM [guacamole].[sharing_profile_permission]
+        WHERE (user_id, permission, sharing_profile_id) IN
+            <foreach collection="permissions" item="permission"
+                     open="(" separator="," close=")">
+                (#{permission.userID,jdbcType=INTEGER},
+                 #{permission.type,jdbcType=VARCHAR},
+                 #{permission.objectIdentifier,jdbcType=INTEGER})
+            </foreach>
+
+    </delete>
+
+    <!-- Insert all given permissions -->
+    <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
+
+        INSERT INTO [guacamole].[sharing_profile_permission] (
+            user_id,
+            permission,
+            sharing_profile_id
+        )
+        SELECT DISTINCT
+            permissions.user_id,
+            permissions.permission,
+            permissions.sharing_profile_id
+        FROM
+            <foreach collection="permissions" item="permission"
+                     open="(" separator="UNION ALL" close=")">
+                SELECT #{permission.userID,jdbcType=INTEGER} AS user_id,
+                       #{permission.type,jdbcType=VARCHAR} AS permission,
+                       #{permission.objectIdentifier,jdbcType=INTEGER} AS sharing_profile_id
+            </foreach>
+        AS permissions
+        WHERE (user_id, permission, sharing_profile_id) NOT IN (
+            SELECT
+                [guacamole].[sharing_profile_permission].user_id,
+                [guacamole].[sharing_profile_permission].permission,
+                [guacamole].[sharing_profile_permission].sharing_profile_id
+            FROM [guacamole].[sharing_profile_permission]
+        );
+
+    </insert>
+
+</mapper>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b6e88d33/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SystemPermissionMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SystemPermissionMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SystemPermissionMapper.xml
new file mode 100644
index 0000000..d9e622b
--- /dev/null
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SystemPermissionMapper.xml
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+    "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+
+<mapper namespace="org.apache.guacamole.auth.jdbc.permission.SystemPermissionMapper" >
+
+    <!-- Result mapper for system permissions -->
+    <resultMap id="SystemPermissionResultMap" type="org.apache.guacamole.auth.jdbc.permission.SystemPermissionModel">
+        <result column="user_id"    property="userID"   jdbcType="INTEGER"/>
+        <result column="username"   property="username" jdbcType="VARCHAR"/>
+        <result column="permission" property="type"     jdbcType="VARCHAR"
+                javaType="org.apache.guacamole.net.auth.permission.SystemPermission$Type"/>
+    </resultMap>
+
+    <!-- Select all permissions for a given user -->
+    <select id="select" resultMap="SystemPermissionResultMap">
+
+        SELECT
+            [guacamole].[system_permission].user_id,
+            username,
+            permission
+        FROM [guacamole].[system_permission]
+        JOIN [guacamole].[user] ON [guacamole].[system_permission].user_id = [guacamole].[user].user_id
+        WHERE [guacamole].[system_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+
+    </select>
+
+    <!-- Select the single permission matching the given criteria -->
+    <select id="selectOne" resultMap="SystemPermissionResultMap">
+
+        SELECT
+            [guacamole].[system_permission].user_id,
+            username,
+            permission
+        FROM [guacamole].[system_permission]
+        JOIN [guacamole].[user] ON [guacamole].[system_permission].user_id = [guacamole].[user].user_id
+        WHERE
+            [guacamole].[system_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+            AND permission = #{type,jdbcType=VARCHAR}
+
+    </select>
+
+    <!-- Delete all given permissions -->
+    <delete id="delete" parameterType="org.apache.guacamole.auth.jdbc.permission.SystemPermissionModel">
+
+        DELETE FROM [guacamole].[system_permission]
+        WHERE (user_id, permission) IN
+            <foreach collection="permissions" item="permission"
+                     open="(" separator="," close=")">
+                (#{permission.userID,jdbcType=INTEGER},
+                 #{permission.type,jdbcType=VARCHAR})
+            </foreach>
+
+    </delete>
+
+    <!-- Insert all given permissions -->
+    <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.permission.SystemPermissionModel">
+
+        INSERT INTO [guacamole].[system_permission] (
+            user_id,
+            permission
+        )
+        SELECT DISTINCT
+            permissions.user_id,
+            permissions.permission
+        FROM
+            <foreach collection="permissions" item="permission"
+                     open="(" separator="UNION ALL" close=")">
+                SELECT #{permission.userID,jdbcType=INTEGER}                                 AS user_id,
+                       #{permission.type,jdbcType=VARCHAR} AS permission
+            </foreach>
+        AS permissions
+        WHERE (user_id, permission) NOT IN (
+            SELECT
+                [guacamole].[system_permission].user_id,
+                [guacamole].[system_permission].permission
+            FROM [guacamole].[system_permission]
+        );
+
+    </insert>
+
+</mapper>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b6e88d33/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/UserPermissionMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/UserPermissionMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/UserPermissionMapper.xml
new file mode 100644
index 0000000..595c326
--- /dev/null
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/UserPermissionMapper.xml
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+    "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+
+<mapper namespace="org.apache.guacamole.auth.jdbc.permission.UserPermissionMapper" >
+
+    <!-- Result mapper for user permissions -->
+    <resultMap id="UserPermissionResultMap" type="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
+        <result column="user_id"           property="userID"           jdbcType="INTEGER"/>
+        <result column="username"          property="username"         jdbcType="VARCHAR"/>
+        <result column="permission"        property="type"             jdbcType="VARCHAR"
+                javaType="org.apache.guacamole.net.auth.permission.ObjectPermission$Type"/>
+        <result column="affected_username" property="objectIdentifier" jdbcType="INTEGER"/>
+    </resultMap>
+
+    <!-- Select all permissions for a given user -->
+    <select id="select" resultMap="UserPermissionResultMap">
+
+        SELECT
+            [guacamole].[user_permission].user_id,
+            [guacamole].[user].username,
+            permission,
+            affected.username AS affected_username
+        FROM [guacamole].[user_permission]
+        JOIN [guacamole].[user] ON [guacamole].[user_permission].user_id = [guacamole].[user].user_id
+        JOIN [guacamole].[user] affected ON [guacamole].[user_permission].affected_user_id = affected.user_id
+        WHERE [guacamole].[user_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+
+    </select>
+
+    <!-- Select the single permission matching the given criteria -->
+    <select id="selectOne" resultMap="UserPermissionResultMap">
+
+        SELECT
+            [guacamole].[user_permission].user_id,
+            [guacamole].[user].username,
+            permission,
+            affected.username AS affected_username
+        FROM [guacamole].[user_permission]
+        JOIN [guacamole].[user] ON [guacamole].[user_permission].user_id = [guacamole].[user].user_id
+        JOIN [guacamole].[user] affected ON [guacamole].[user_permission].affected_user_id = affected.user_id
+        WHERE
+            [guacamole].[user_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+            AND permission = #{type,jdbcType=VARCHAR}
+            AND affected.username = #{identifier,jdbcType=INTEGER}
+
+    </select>
+
+    <!-- Select identifiers accessible by the given user for the given permissions -->
+    <select id="selectAccessibleIdentifiers" resultType="string">
+
+        SELECT DISTINCT username
+        FROM [guacamole].[user_permission]
+        JOIN [guacamole].[user] ON [guacamole].[user_permission].affected_user_id = [guacamole].[user].user_id
+        WHERE
+            [guacamole].[user_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+            AND username IN
+                <foreach collection="identifiers" item="identifier"
+                         open="(" separator="," close=")">
+                    #{identifier,jdbcType=INTEGER}
+                </foreach>
+            AND permission IN
+                <foreach collection="permissions" item="permission"
+                         open="(" separator="," close=")">
+                    #{permission,jdbcType=VARCHAR}
+                </foreach>
+
+    </select>
+
+    <!-- Delete all given permissions -->
+    <delete id="delete" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
+
+        DELETE FROM [guacamole].[user_permission]
+        USING [guacamole].[user] affected
+        WHERE
+            [guacamole].[user_permission].affected_user_id = affected.user_id
+            AND ([guacamole].[user_permission].user_id, permission, affected.username) IN
+                <foreach collection="permissions" item="permission"
+                         open="(" separator="," close=")">
+                    (#{permission.userID,jdbcType=INTEGER},
+                     #{permission.type,jdbcType=VARCHAR},
+                     #{permission.objectIdentifier,jdbcType=INTEGER})
+                </foreach>
+
+    </delete>
+
+    <!-- Insert all given permissions -->
+    <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
+
+        INSERT INTO [guacamole].[user_permission] (
+            user_id,
+            permission,
+            affected_user_id
+        )
+        SELECT DISTINCT
+            permissions.user_id,
+            permissions.permission,
+            [guacamole].[user].user_id
+        FROM
+            <foreach collection="permissions" item="permission"
+                     open="(" separator="UNION ALL" close=")">
+                SELECT #{permission.userID,jdbcType=INTEGER}                                 AS user_id,
+                       #{permission.type,jdbcType=VARCHAR} AS permission,
+                       #{permission.objectIdentifier,jdbcType=INTEGER}                       AS username
+            </foreach>
+        AS permissions
+        JOIN [guacamole].[user] ON [guacamole].[user].username = permissions.username
+        WHERE (permissions.user_id, permissions.permission, [guacamole].[user].user_id) NOT IN (
+            SELECT
+                [guacamole].[user_permission].user_id,
+                [guacamole].[user_permission].permission,
+                [guacamole].[user_permission].affected_user_id
+            FROM [guacamole].[user_permission]
+        );
+
+    </insert>
+
+</mapper>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b6e88d33/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileMapper.xml
new file mode 100644
index 0000000..9d7d45a
--- /dev/null
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileMapper.xml
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+    "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+
+<mapper namespace="org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileMapper">
+
+    <!-- Result mapper for sharing profile objects -->
+    <resultMap id="SharingProfileResultMap" type="org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileModel">
+        <id     column="sharing_profile_id"    property="objectID"         jdbcType="INTEGER"/>
+        <result column="sharing_profile_name"  property="name"             jdbcType="VARCHAR"/>
+        <result column="primary_connection_id" property="parentIdentifier" jdbcType="INTEGER"/>
+    </resultMap>
+
+    <!-- Select all sharing profile identifiers -->
+    <select id="selectIdentifiers" resultType="string">
+        SELECT sharing_profile_id
+        FROM [guacamole].[sharing_profile]
+    </select>
+
+    <!-- Select identifiers of all readable sharing profiles -->
+    <select id="selectReadableIdentifiers" resultType="string">
+        SELECT sharing_profile_id
+        FROM [guacamole].[sharing_profile_permission]
+        WHERE
+            user_id = #{user.objectID,jdbcType=INTEGER}
+            AND permission = 'READ'
+    </select>
+
+    <!-- Select multiple sharing profiles by identifier -->
+    <select id="select" resultMap="SharingProfileResultMap">
+
+        SELECT
+            sharing_profile_id,
+            sharing_profile_name,
+            primary_connection_id
+        FROM [guacamole].[sharing_profile]
+        WHERE sharing_profile_id IN
+            <foreach collection="identifiers" item="identifier"
+                     open="(" separator="," close=")">
+                #{identifier,jdbcType=INTEGER}
+            </foreach>
+
+    </select>
+
+    <!-- Select multiple sharing profiles by identifier only if readable -->
+    <select id="selectReadable" resultMap="SharingProfileResultMap">
+
+        SELECT
+            [guacamole].[sharing_profile].sharing_profile_id,
+            [guacamole].[sharing_profile].sharing_profile_name,
+            primary_connection_id
+        FROM [guacamole].[sharing_profile]
+        JOIN [guacamole].[sharing_profile_permission] ON [guacamole].[sharing_profile_permission].sharing_profile_id = [guacamole].[sharing_profile].sharing_profile_id
+        WHERE [guacamole].[sharing_profile].sharing_profile_id IN
+            <foreach collection="identifiers" item="identifier"
+                     open="(" separator="," close=")">
+                #{identifier,jdbcType=INTEGER}
+            </foreach>
+            AND user_id = #{user.objectID,jdbcType=INTEGER}
+            AND permission = 'READ'
+
+    </select>
+
+    <!-- Select single sharing profile by name -->
+    <select id="selectOneByName" resultMap="SharingProfileResultMap">
+
+        SELECT
+            sharing_profile_id,
+            sharing_profile_name,
+            primary_connection_id
+        FROM [guacamole].[sharing_profile]
+        WHERE 
+            primary_connection_id = #{parentIdentifier,jdbcType=INTEGER}
+            AND sharing_profile_name = #{name,jdbcType=VARCHAR}
+
+    </select>
+
+    <!-- Delete single sharing profile by identifier -->
+    <delete id="delete">
+        DELETE FROM [guacamole].[sharing_profile]
+        WHERE sharing_profile_id = #{identifier,jdbcType=INTEGER}
+    </delete>
+
+    <!-- Insert single sharing profile -->
+    <insert id="insert" useGeneratedKeys="true" keyProperty="object.objectID"
+            parameterType="org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileModel">
+
+        INSERT INTO [guacamole].[sharing_profile] (
+            sharing_profile_name,
+            primary_connection_id
+        )
+        VALUES (
+            #{object.name,jdbcType=VARCHAR},
+            #{object.parentIdentifier,jdbcType=INTEGER}
+        )
+
+    </insert>
+
+    <!-- Update single sharing profile -->
+    <update id="update" parameterType="org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileModel">
+        UPDATE [guacamole].[sharing_profile]
+        SET sharing_profile_name  = #{object.name,jdbcType=VARCHAR},
+            primary_connection_id = #{object.parentIdentifier,jdbcType=INTEGER}
+        WHERE sharing_profile_id = #{object.objectID,jdbcType=INTEGER}
+    </update>
+
+</mapper>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b6e88d33/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileParameterMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileParameterMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileParameterMapper.xml
new file mode 100644
index 0000000..8835350
--- /dev/null
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileParameterMapper.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+    "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+
+<mapper namespace="org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileParameterMapper">
+
+    <!-- Result mapper for sharing profile parameters -->
+    <resultMap id="ParameterResultMap" type="org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileParameterModel">
+        <result column="sharing_profile_id" property="sharingProfileIdentifier" jdbcType="INTEGER"/>
+        <result column="parameter_name"     property="name"                     jdbcType="VARCHAR"/>
+        <result column="parameter_value"    property="value"                    jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <!-- Select all parameters of a given sharing profile -->
+    <select id="select" resultMap="ParameterResultMap">
+        SELECT
+            sharing_profile_id,
+            parameter_name,
+            parameter_value
+        FROM [guacamole].[sharing_profile_parameter]
+        WHERE
+            sharing_profile_id = #{identifier,jdbcType=INTEGER}
+    </select>
+
+    <!-- Delete all parameters of a given sharing profile -->
+    <delete id="delete">
+        DELETE FROM [guacamole].[sharing_profile_parameter]
+        WHERE sharing_profile_id = #{identifier,jdbcType=INTEGER}
+    </delete>
+
+    <!-- Insert all given parameters -->
+    <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileParameterModel">
+
+        INSERT INTO [guacamole].[sharing_profile_parameter] (
+            sharing_profile_id,
+            parameter_name,
+            parameter_value
+        )
+        VALUES 
+            <foreach collection="parameters" item="parameter" separator=",">
+                (#{parameter.sharingProfileIdentifier,jdbcType=INTEGER}
+                 #{parameter.name,jdbcType=VARCHAR},
+                 #{parameter.value,jdbcType=VARCHAR})
+            </foreach>
+
+    </insert>
+
+
+</mapper>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b6e88d33/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/user/PasswordRecordMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/user/PasswordRecordMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/user/PasswordRecordMapper.xml
new file mode 100644
index 0000000..9ad67a6
--- /dev/null
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/user/PasswordRecordMapper.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+    "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+
+<mapper namespace="org.apache.guacamole.auth.jdbc.user.PasswordRecordMapper" >
+
+    <!-- Result mapper for historical passwords -->
+    <resultMap id="PasswordRecordResultMap" type="org.apache.guacamole.auth.jdbc.user.PasswordRecordModel">
+        <result column="user_id"       property="userID"       jdbcType="INTEGER"/>
+        <result column="password_hash" property="passwordHash" jdbcType="BINARY"/>
+        <result column="password_salt" property="passwordSalt" jdbcType="BINARY"/>
+        <result column="password_date" property="passwordDate" jdbcType="TIMESTAMP"/>
+    </resultMap>
+
+    <!-- Select all password records for a given user -->
+    <select id="select" resultMap="PasswordRecordResultMap">
+
+        SELECT
+            [guacamole].[user_password_history].user_id,
+            [guacamole].[user_password_history].password_hash,
+            [guacamole].[user_password_history].password_salt,
+            [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
+        WHERE
+            [guacamole].[user].username = #{username,jdbcType=VARCHAR}
+        ORDER BY
+            [guacamole].[user_password_history].password_date DESC
+        LIMIT #{maxHistorySize}
+
+    </select>
+
+    <!-- Insert the given password record -->
+    <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.user.PasswordRecordModel">
+
+        INSERT INTO [guacamole].[user_password_history] (
+            user_id,
+            password_hash,
+            password_salt,
+            password_date
+        )
+        VALUES (
+            #{record.userID,jdbcType=INTEGER},
+            #{record.passwordHash,jdbcType=BINARY},
+            #{record.passwordSalt,jdbcType=BINARY},
+            #{record.passwordDate,jdbcType=TIMESTAMP}
+        );
+
+        DELETE FROM [guacamole].[user_password_history]
+        WHERE password_history_id IN (
+            SELECT password_history_id
+            FROM [guacamole].[user_password_history]
+            WHERE user_id = #{record.userID,jdbcType=INTEGER}
+            ORDER BY password_date DESC
+            OFFSET #{maxHistorySize}
+        );
+
+    </insert>
+
+</mapper>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b6e88d33/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserMapper.xml
new file mode 100644
index 0000000..a4ceea7
--- /dev/null
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserMapper.xml
@@ -0,0 +1,216 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+    "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+
+<mapper namespace="org.apache.guacamole.auth.jdbc.user.UserMapper" >
+
+    <!-- Result mapper for user objects -->
+    <resultMap id="UserResultMap" type="org.apache.guacamole.auth.jdbc.user.UserModel" >
+        <id     column="user_id"             property="objectID"           jdbcType="INTEGER"/>
+        <result column="username"            property="identifier"         jdbcType="VARCHAR"/>
+        <result column="password_hash"       property="passwordHash"       jdbcType="BINARY"/>
+        <result column="password_salt"       property="passwordSalt"       jdbcType="BINARY"/>
+        <result column="password_date"       property="passwordDate"       jdbcType="TIMESTAMP"/>
+        <result column="disabled"            property="disabled"           jdbcType="INTEGER"/>
+        <result column="expired"             property="expired"            jdbcType="INTEGER"/>
+        <result column="access_window_start" property="accessWindowStart"  jdbcType="TIME"/>
+        <result column="access_window_end"   property="accessWindowEnd"    jdbcType="TIME"/>
+        <result column="valid_from"          property="validFrom"          jdbcType="DATE"/>
+        <result column="valid_until"         property="validUntil"         jdbcType="DATE"/>
+        <result column="timezone"            property="timeZone"           jdbcType="VARCHAR"/>
+        <result column="full_name"           property="fullName"           jdbcType="VARCHAR"/>
+        <result column="email_address"       property="emailAddress"       jdbcType="VARCHAR"/>
+        <result column="organization"        property="organization"       jdbcType="VARCHAR"/>
+        <result column="organizational_role" property="organizationalRole" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <!-- Select all usernames -->
+    <select id="selectIdentifiers" resultType="string">
+        SELECT username
+        FROM [guacamole].[user]
+    </select>
+
+    <!-- Select usernames of all readable users -->
+    <select id="selectReadableIdentifiers" resultType="string">
+        SELECT username
+        FROM [guacamole].[user]
+        JOIN [guacamole].[user_permission] ON affected_user_id = [guacamole].[user].user_id
+        WHERE
+            [guacamole].[user_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+            AND permission = 'READ'
+    </select>
+
+    <!-- Select multiple users by username -->
+    <select id="select" resultMap="UserResultMap">
+
+        SELECT
+            user_id,
+            username,
+            password_hash,
+            password_salt,
+            password_date,
+            disabled,
+            expired,
+            access_window_start,
+            access_window_end,
+            valid_from,
+            valid_until,
+            timezone,
+            full_name,
+            email_address,
+            organization,
+            organizational_role
+        FROM [guacamole].[user]
+        WHERE username IN
+            <foreach collection="identifiers" item="identifier"
+                     open="(" separator="," close=")">
+                #{identifier,jdbcType=VARCHAR}
+            </foreach>
+
+    </select>
+
+    <!-- Select multiple users by username only if readable -->
+    <select id="selectReadable" resultMap="UserResultMap">
+
+        SELECT
+            [guacamole].[user].user_id,
+            username,
+            password_hash,
+            password_salt,
+            password_date,
+            disabled,
+            expired,
+            access_window_start,
+            access_window_end,
+            valid_from,
+            valid_until,
+            timezone,
+            full_name,
+            email_address,
+            organization,
+            organizational_role
+        FROM [guacamole].[user]
+        JOIN [guacamole].[user_permission] ON affected_user_id = [guacamole].[user].user_id
+        WHERE username IN
+            <foreach collection="identifiers" item="identifier"
+                     open="(" separator="," close=")">
+                #{identifier,jdbcType=VARCHAR}
+            </foreach>
+            AND [guacamole].[user_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+            AND permission = 'READ'
+
+    </select>
+
+    <!-- Select single user by username -->
+    <select id="selectOne" resultMap="UserResultMap">
+
+        SELECT
+            user_id,
+            username,
+            password_hash,
+            password_salt,
+            password_date,
+            disabled,
+            expired,
+            access_window_start,
+            access_window_end,
+            valid_from,
+            valid_until,
+            timezone,
+            full_name,
+            email_address,
+            organization,
+            organizational_role
+        FROM [guacamole].[user]
+        WHERE
+            username = #{username,jdbcType=VARCHAR}
+
+    </select>
+
+    <!-- Delete single user by username -->
+    <delete id="delete">
+        DELETE FROM [guacamole].[user]
+        WHERE username = #{identifier,jdbcType=VARCHAR}
+    </delete>
+
+    <!-- Insert single user -->
+    <insert id="insert" useGeneratedKeys="true" keyProperty="object.objectID"
+            parameterType="org.apache.guacamole.auth.jdbc.user.UserModel">
+
+        INSERT INTO [guacamole].[user] (
+            username,
+            password_hash,
+            password_salt,
+            password_date,
+            disabled,
+            expired,
+            access_window_start,
+            access_window_end,
+            valid_from,
+            valid_until,
+            timezone,
+            full_name,
+            email_address,
+            organization,
+            organizational_role
+        )
+        VALUES (
+            #{object.identifier,jdbcType=VARCHAR},
+            #{object.passwordHash,jdbcType=BINARY},
+            #{object.passwordSalt,jdbcType=BINARY},
+            #{object.passwordDate,jdbcType=TIMESTAMP},
+            #{object.disabled,jdbcType=INTEGER},
+            #{object.expired,jdbcType=INTEGER},
+            #{object.accessWindowStart,jdbcType=TIME},
+            #{object.accessWindowEnd,jdbcType=TIME},
+            #{object.validFrom,jdbcType=DATE},
+            #{object.validUntil,jdbcType=DATE},
+            #{object.timeZone,jdbcType=VARCHAR},
+            #{object.fullName,jdbcType=VARCHAR},
+            #{object.emailAddress,jdbcType=VARCHAR},
+            #{object.organization,jdbcType=VARCHAR},
+            #{object.organizationalRole,jdbcType=VARCHAR}
+        )
+
+    </insert>
+
+    <!-- Update single user -->
+    <update id="update" parameterType="org.apache.guacamole.auth.jdbc.user.UserModel">
+        UPDATE [guacamole].[user]
+        SET password_hash = #{object.passwordHash,jdbcType=BINARY},
+            password_salt = #{object.passwordSalt,jdbcType=BINARY},
+            password_date = #{object.passwordDate,jdbcType=TIMESTAMP},
+            disabled = #{object.disabled,jdbcType=INTEGER},
+            expired = #{object.expired,jdbcType=INTEGER},
+            access_window_start = #{object.accessWindowStart,jdbcType=TIME},
+            access_window_end = #{object.accessWindowEnd,jdbcType=TIME},
+            valid_from = #{object.validFrom,jdbcType=DATE},
+            valid_until = #{object.validUntil,jdbcType=DATE},
+            timezone = #{object.timeZone,jdbcType=VARCHAR},
+            full_name = #{object.fullName,jdbcType=VARCHAR},
+            email_address = #{object.emailAddress,jdbcType=VARCHAR},
+            organization = #{object.organization,jdbcType=VARCHAR},
+            organizational_role = #{object.organizationalRole,jdbcType=VARCHAR}
+        WHERE user_id = #{object.objectID,jdbcType=VARCHAR}
+    </update>
+
+</mapper>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b6e88d33/extensions/guacamole-auth-jdbc/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/pom.xml b/extensions/guacamole-auth-jdbc/pom.xml
index 2a5ef5b..7869c86 100644
--- a/extensions/guacamole-auth-jdbc/pom.xml
+++ b/extensions/guacamole-auth-jdbc/pom.xml
@@ -70,6 +70,7 @@
         <!-- Database-specific implementations -->
         <module>modules/guacamole-auth-jdbc-mysql</module>
         <module>modules/guacamole-auth-jdbc-postgresql</module>
+        <module>modules/guacamole-auth-jdbc-sqlserver</module>
 
     </modules>
 


[11/28] incubator-guacamole-client git commit: GUACAMOLE-363: Add license to SQL schema files.

Posted by mj...@apache.org.
GUACAMOLE-363: Add license to SQL schema files.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/70c33efc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/70c33efc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/70c33efc

Branch: refs/heads/master
Commit: 70c33efc4abbf9e9581b760eb90785b7f0271650
Parents: 60d6152
Author: Nick Couchman <vn...@apache.org>
Authored: Sat Aug 26 18:00:32 2017 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Thu Sep 28 07:00:52 2017 -0400

----------------------------------------------------------------------
 .../schema/001-create-schema.sql                | 21 +++++++++++++++++++-
 .../schema/002-create-admin-user.sql            | 21 +++++++++++++++++++-
 2 files changed, 40 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/70c33efc/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
index 83299a1..759e78d 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 /**
  * Create the guacamole schema.
  */
@@ -541,4 +560,4 @@ ALTER TABLE [guacamole].[user_password_history]
         ON DELETE CASCADE
 ALTER TABLE [guacamole].[user_password_history]
     CHECK CONSTRAINT [FK_user_password_history_user]
-GO
\ No newline at end of file
+GO

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/70c33efc/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
index 947c5ac..f71d283 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 /**
  * Create the default admin user account and set up full privileges.
  */
@@ -24,4 +43,4 @@ FROM (
         UNION SELECT 'guacadmin' AS username, 'ADMINISTER' AS permission)
     permissions
     JOIN [guacamole].[user] ON permissions.username = [guacamole].[user].[username];
-GO
\ No newline at end of file
+GO


[07/28] incubator-guacamole-client git commit: GUACAMOLE-363: Remove explicit schema, relying on account default schema.

Posted by mj...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/73301901/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserMapper.xml
index 465ef20..6df6cf2 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserMapper.xml
@@ -46,16 +46,16 @@
     <!-- Select all usernames -->
     <select id="selectIdentifiers" resultType="string">
         SELECT username
-        FROM [dbo].[guacamole_user]
+        FROM [guacamole_user]
     </select>
 
     <!-- Select usernames of all readable users -->
     <select id="selectReadableIdentifiers" resultType="string">
         SELECT username
-        FROM [dbo].[guacamole_user]
-        JOIN [dbo].[guacamole_user_permission] ON affected_user_id = [dbo].[guacamole_user].user_id
+        FROM [guacamole_user]
+        JOIN [guacamole_user_permission] ON affected_user_id = [guacamole_user].user_id
         WHERE
-            [dbo].[guacamole_user_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+            [guacamole_user_permission].user_id = #{user.objectID,jdbcType=INTEGER}
             AND permission = 'READ'
     </select>
 
@@ -79,7 +79,7 @@
             email_address,
             organization,
             organizational_role
-        FROM [dbo].[guacamole_user]
+        FROM [guacamole_user]
         WHERE username IN
             <foreach collection="identifiers" item="identifier"
                      open="(" separator="," close=")">
@@ -92,7 +92,7 @@
     <select id="selectReadable" resultMap="UserResultMap">
 
         SELECT
-            [dbo].[guacamole_user].user_id,
+            [guacamole_user].user_id,
             username,
             password_hash,
             password_salt,
@@ -108,14 +108,14 @@
             email_address,
             organization,
             organizational_role
-        FROM [dbo].[guacamole_user]
-        JOIN [dbo].[guacamole_user_permission] ON affected_user_id = [dbo].[guacamole_user].user_id
+        FROM [guacamole_user]
+        JOIN [guacamole_user_permission] ON affected_user_id = [guacamole_user].user_id
         WHERE username IN
             <foreach collection="identifiers" item="identifier"
                      open="(" separator="," close=")">
                 #{identifier,jdbcType=VARCHAR}
             </foreach>
-            AND [dbo].[guacamole_user_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+            AND [guacamole_user_permission].user_id = #{user.objectID,jdbcType=INTEGER}
             AND permission = 'READ'
 
     </select>
@@ -140,7 +140,7 @@
             email_address,
             organization,
             organizational_role
-        FROM [dbo].[guacamole_user]
+        FROM [guacamole_user]
         WHERE
             username = #{username,jdbcType=VARCHAR}
 
@@ -148,7 +148,7 @@
 
     <!-- Delete single user by username -->
     <delete id="delete">
-        DELETE FROM [dbo].[guacamole_user]
+        DELETE FROM [guacamole_user]
         WHERE username = #{identifier,jdbcType=VARCHAR}
     </delete>
 
@@ -156,7 +156,7 @@
     <insert id="insert" useGeneratedKeys="true" keyProperty="object.objectID"
             parameterType="org.apache.guacamole.auth.jdbc.user.UserModel">
 
-        INSERT INTO [dbo].[guacamole_user] (
+        INSERT INTO [guacamole_user] (
             username,
             password_hash,
             password_salt,
@@ -195,7 +195,7 @@
 
     <!-- Update single user -->
     <update id="update" parameterType="org.apache.guacamole.auth.jdbc.user.UserModel">
-        UPDATE [dbo].[guacamole_user]
+        UPDATE [guacamole_user]
         SET password_hash = #{object.passwordHash,jdbcType=BINARY},
             password_salt = #{object.passwordSalt,jdbcType=BINARY},
             password_date = #{object.passwordDate,jdbcType=TIMESTAMP},


[02/28] incubator-guacamole-client git commit: GUACAMOLE-363: Initial commit of SQLServer authentication module for JDBC.

Posted by mj...@apache.org.
GUACAMOLE-363: Initial commit of SQLServer authentication module for JDBC.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/b6e88d33
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/b6e88d33
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/b6e88d33

Branch: refs/heads/master
Commit: b6e88d33b3967b42020aa8dbc8429f41f2a0afb8
Parents: 81ffa5c
Author: Nick Couchman <vn...@apache.org>
Authored: Mon Aug 14 22:14:15 2017 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Thu Sep 28 07:00:51 2017 -0400

----------------------------------------------------------------------
 .../guacamole-auth-jdbc-sqlserver/.gitignore    |   2 +
 .../guacamole-auth-jdbc-sqlserver/pom.xml       | 128 ++++++++
 .../schema/001-create-schema.sql                | Bin 0 -> 35118 bytes
 .../schema/002-create-admin-user.sql            |  43 +++
 .../SQLServerAuthenticationProvider.java        |  50 +++
 .../SQLServerAuthenticationProviderModule.java  |  91 ++++++
 .../auth/sqlserver/SQLServerEnvironment.java    | 306 +++++++++++++++++++
 .../sqlserver/SQLServerGuacamoleProperties.java | 200 ++++++++++++
 .../sqlserver/SQLServerInjectorProvider.java    |  49 +++
 .../auth/sqlserver/SQLServerPasswordPolicy.java | 194 ++++++++++++
 .../SQLServerSharedAuthenticationProvider.java  |  50 +++
 .../guacamole/auth/sqlserver/package-info.java  |  23 ++
 .../src/main/resources/guac-manifest.json       |  28 ++
 .../auth/jdbc/connection/ConnectionMapper.xml   | 235 ++++++++++++++
 .../connection/ConnectionParameterMapper.xml    |  68 +++++
 .../jdbc/connection/ConnectionRecordMapper.xml  | 216 +++++++++++++
 .../connectiongroup/ConnectionGroupMapper.xml   | 232 ++++++++++++++
 .../ConnectionGroupPermissionMapper.xml         | 130 ++++++++
 .../permission/ConnectionPermissionMapper.xml   | 130 ++++++++
 .../SharingProfilePermissionMapper.xml          | 130 ++++++++
 .../jdbc/permission/SystemPermissionMapper.xml  | 101 ++++++
 .../jdbc/permission/UserPermissionMapper.xml    | 137 +++++++++
 .../sharingprofile/SharingProfileMapper.xml     | 126 ++++++++
 .../SharingProfileParameterMapper.xml           |  68 +++++
 .../auth/jdbc/user/PasswordRecordMapper.xml     |  79 +++++
 .../guacamole/auth/jdbc/user/UserMapper.xml     | 216 +++++++++++++
 extensions/guacamole-auth-jdbc/pom.xml          |   1 +
 27 files changed, 3033 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b6e88d33/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/.gitignore
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/.gitignore b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/.gitignore
new file mode 100644
index 0000000..42f4a1a
--- /dev/null
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/.gitignore
@@ -0,0 +1,2 @@
+target/
+*~

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b6e88d33/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/pom.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/pom.xml
new file mode 100644
index 0000000..82776f7
--- /dev/null
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/pom.xml
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                        http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.guacamole</groupId>
+    <artifactId>guacamole-auth-jdbc-sqlserver</artifactId>
+    <packaging>jar</packaging>
+    <name>guacamole-auth-jdbc-sqlserver</name>
+    <url>http://guacamole.incubator.apache.org/</url>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <parent>
+        <groupId>org.apache.guacamole</groupId>
+        <artifactId>guacamole-auth-jdbc</artifactId>
+        <version>0.9.13-incubating</version>
+        <relativePath>../../</relativePath>
+    </parent>
+
+    <build>
+        <plugins>
+
+            <!-- Written for 1.6 -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.3</version>
+                <configuration>
+                    <source>1.6</source>
+                    <target>1.6</target>
+                    <compilerArgs>
+                        <arg>-Xlint:all</arg>
+                        <arg>-Werror</arg>
+                    </compilerArgs>
+                    <fork>true</fork>
+                </configuration>
+            </plugin>
+
+            <!-- Copy dependencies prior to packaging -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <version>2.10</version>
+                <executions>
+                    <execution>
+                        <id>unpack-dependencies</id>
+                        <phase>prepare-package</phase>
+                        <goals>
+                            <goal>unpack-dependencies</goal>
+                        </goals>
+                        <configuration>
+                            <includeScope>runtime</includeScope>
+                            <outputDirectory>${project.build.directory}/classes</outputDirectory>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <!-- Verify format using Apache RAT -->
+            <plugin>
+                <groupId>org.apache.rat</groupId>
+                <artifactId>apache-rat-plugin</artifactId>
+                <version>0.12</version>
+
+                <configuration>
+                    <excludes>
+                        <exclude>**/*.json</exclude>
+                    </excludes>
+                </configuration>
+
+                <!-- Bind RAT to validate phase -->
+                <executions>
+                    <execution>
+                        <id>validate</id>
+                        <phase>validate</phase>
+                        <goals>
+                            <goal>check</goal>
+                        </goals>
+                    </execution>
+                </executions>
+
+            </plugin>
+
+        </plugins>
+    </build>
+
+    <dependencies>
+
+        <!-- Guacamole Extension API -->
+        <dependency>
+            <groupId>org.apache.guacamole</groupId>
+            <artifactId>guacamole-ext</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <!-- Guacamole JDBC Authentication -->
+        <dependency>
+            <groupId>org.apache.guacamole</groupId>
+            <artifactId>guacamole-auth-jdbc-base</artifactId>
+            <version>0.9.13-incubating</version>
+        </dependency>
+
+    </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b6e88d33/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
new file mode 100644
index 0000000..df95800
Binary files /dev/null and b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql differ

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b6e88d33/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
new file mode 100644
index 0000000..08cce3f
--- /dev/null
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+INSERT INTO [guacamole].[user] (username, password_hash, password_salt, password_date)
+VALUES ('guacadmin', 0xCA458A7D494E3BE824F5E1E175A1556C0F8EEF2C2D7DF3633BEC4A29C4411960,
+0xCA458A7D494E3BE824F5E1E175A1556C0F8EEF2C2D7DF3633BEC4A29C4411960, getdate());
+
+INSERT INTO [guacamole].[system_permission]
+SELECT user_id, permission
+FROM (
+		SELECT 'guacadmin' AS username, 'CREATE_CONNECTION' AS permission
+		UNION SELECT 'guacadmin' AS username, 'CREATE_CONNECTION_GROUP' AS permission
+		UNION SELECT 'guacadmin' AS username, 'CREATE_SHARING_PROFILE' AS permission
+		UNION SELECT 'guacadmin' AS username, 'CREATE_USER' AS permission
+		UNION SELECT 'guacadmin' AS username, 'ADMINISTER' AS permission)
+		permissions
+		JOIN [guacamole].[user] ON permissions.username = [guacamole].[user].[username];
+
+INSERT INTO [guacamole].[user_permission]
+SELECT [guacamole].[user].[user_id], [affected].[user_id], permission
+FROM (
+		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, 'ADMINISTER' AS permission)
+		permissions
+		JOIN [guacamole].[user] ON permissions.username = [guacamole].[user].[username]
+		JOIN [guacamole].[user] affected ON permissions.affected_username = affected.username;

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b6e88d33/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProvider.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProvider.java
new file mode 100644
index 0000000..ef5d61d
--- /dev/null
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProvider.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.guacamole.auth.sqlserver;
+
+import org.apache.guacamole.GuacamoleException;
+import org.apache.guacamole.auth.jdbc.InjectedAuthenticationProvider;
+import org.apache.guacamole.auth.jdbc.JDBCAuthenticationProviderService;
+
+/**
+ * Provides a SQLServer-based implementation of the AuthenticationProvider
+ * functionality.
+ */
+public class SQLServerAuthenticationProvider extends InjectedAuthenticationProvider {
+
+    /**
+     * Creates a new SQLServerAuthenticationProvider that reads and writes
+     * authentication data to a SQLServer database defined by properties in
+     * guacamole.properties.
+     *
+     * @throws GuacamoleException
+     *     If a required property is missing, or an error occurs while parsing
+     *     a property.
+     */
+    public SQLServerAuthenticationProvider() throws GuacamoleException {
+        super(new SQLServerInjectorProvider(), JDBCAuthenticationProviderService.class);
+    }
+
+    @Override
+    public String getIdentifier() {
+        return "sqlserver";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b6e88d33/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java
new file mode 100644
index 0000000..ebb1a06
--- /dev/null
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.guacamole.auth.sqlserver;
+
+import com.google.inject.Binder;
+import com.google.inject.Module;
+import com.google.inject.name.Names;
+import java.util.Properties;
+import org.apache.guacamole.GuacamoleException;
+import org.mybatis.guice.datasource.helper.JdbcHelper;
+
+/**
+ * Guice module which configures SQLServer-specific injections.
+ */
+public class SQLServerAuthenticationProviderModule implements Module {
+
+    /**
+     * MyBatis-specific configuration properties.
+     */
+    private final Properties myBatisProperties = new Properties();
+
+    /**
+     * SQLServer-specific driver configuration properties.
+     */
+    private final Properties driverProperties = new Properties();
+    
+    /**
+     * Creates a new SQLServer authentication provider module that configures
+     * driver and MyBatis properties using the given environment.
+     *
+     * @param environment
+     *     The environment to use when configuring MyBatis and the underlying
+     *     JDBC driver.
+     *
+     * @throws GuacamoleException
+     *     If a required property is missing, or an error occurs while parsing
+     *     a property.
+     */
+    public SQLServerAuthenticationProviderModule(SQLServerEnvironment environment)
+            throws GuacamoleException {
+
+        // Set the SQLServer-specific properties for MyBatis.
+        myBatisProperties.setProperty("mybatis.environment.id", "guacamole");
+        myBatisProperties.setProperty("JDBC.host", environment.getSQLServerHostname());
+        myBatisProperties.setProperty("JDBC.port", String.valueOf(environment.getSQLServerPort()));
+        myBatisProperties.setProperty("JDBC.schema", environment.getSQLServerDatabase());
+        myBatisProperties.setProperty("JDBC.username", environment.getSQLServerUsername());
+        myBatisProperties.setProperty("JDBC.password", environment.getSQLServerPassword());
+        myBatisProperties.setProperty("JDBC.autoCommit", "false");
+        myBatisProperties.setProperty("mybatis.pooled.pingEnabled", "true");
+        myBatisProperties.setProperty("mybatis.pooled.pingQuery", "SELECT 1");
+
+        // Use UTF-8 in database
+        driverProperties.setProperty("characterEncoding", "UTF-8");
+
+    }
+
+    @Override
+    public void configure(Binder binder) {
+
+        // Bind SQLServer-specific properties
+        JdbcHelper.SQL_Server_2005_MS_Driver.configure(binder);
+        
+        // Bind MyBatis properties
+        Names.bindProperties(binder, myBatisProperties);
+
+        // Bind JDBC driver properties
+        binder.bind(Properties.class)
+            .annotatedWith(Names.named("JDBC.driverProperties"))
+            .toInstance(driverProperties);
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b6e88d33/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java
new file mode 100644
index 0000000..67d8827
--- /dev/null
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java
@@ -0,0 +1,306 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.guacamole.auth.sqlserver;
+
+import org.apache.guacamole.GuacamoleException;
+import org.apache.guacamole.auth.jdbc.JDBCEnvironment;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.guacamole.auth.jdbc.security.PasswordPolicy;
+
+/**
+ * A SQLServer-specific implementation of JDBCEnvironment provides database
+ * properties specifically for SQLServer.
+ */
+public class SQLServerEnvironment extends JDBCEnvironment {
+
+    /**
+     * Logger for this class.
+     */
+    private static final Logger logger = LoggerFactory.getLogger(SQLServerEnvironment.class);
+
+    /**
+     * The default host to connect to, if SQLSERVER_HOSTNAME is not specified.
+     */
+    private static final String DEFAULT_HOSTNAME = "localhost";
+
+    /**
+     * The default port to connect to, if SQLSERVER_PORT is not specified.
+     */
+    private static final int DEFAULT_PORT = 1433;
+
+    /**
+     * Whether a database user account is required by default for authentication
+     * to succeed.
+     */
+    private static final boolean DEFAULT_USER_REQUIRED = true;
+
+    /**
+     * The default value for the maximum number of connections to be
+     * allowed to the Guacamole server overall.
+     */
+    private final int DEFAULT_ABSOLUTE_MAX_CONNECTIONS = 0;
+
+    /**
+     * The default value for the default maximum number of connections to be
+     * allowed per user to any one connection. Note that, as long as the
+     * legacy "disallow duplicate" and "disallow simultaneous" properties are
+     * still supported, these cannot be constants, as the legacy properties
+     * dictate the values that should be used in the absence of the correct
+     * properties.
+     */
+    private int DEFAULT_MAX_CONNECTIONS_PER_USER = 1;
+
+    /**
+     * The default value for the default maximum number of connections to be
+     * allowed per user to any one connection group. Note that, as long as the
+     * legacy "disallow duplicate" and "disallow simultaneous" properties are
+     * still supported, these cannot be constants, as the legacy properties
+     * dictate the values that should be used in the absence of the correct
+     * properties.
+     */
+    private int DEFAULT_MAX_GROUP_CONNECTIONS_PER_USER = 1;
+
+    /**
+     * The default value for the default maximum number of connections to be
+     * allowed to any one connection. Note that, as long as the legacy
+     * "disallow duplicate" and "disallow simultaneous" properties are still
+     * supported, these cannot be constants, as the legacy properties dictate
+     * the values that should be used in the absence of the correct properties.
+     */
+    private int DEFAULT_MAX_CONNECTIONS = 0;
+
+    /**
+     * The default value for the default maximum number of connections to be
+     * allowed to any one connection group. Note that, as long as the legacy
+     * "disallow duplicate" and "disallow simultaneous" properties are still
+     * supported, these cannot be constants, as the legacy properties dictate
+     * the values that should be used in the absence of the correct properties.
+     */
+    private int DEFAULT_MAX_GROUP_CONNECTIONS = 0;
+
+    /**
+     * Constructs a new SQLServerEnvironment, providing access to SQLServer-specific
+     * configuration options.
+     * 
+     * @throws GuacamoleException 
+     *     If an error occurs while setting up the underlying JDBCEnvironment
+     *     or while parsing legacy SQLServer configuration options.
+     */
+    public SQLServerEnvironment() throws GuacamoleException {
+
+        // Init underlying JDBC environment
+        super();
+
+        // Read legacy concurrency-related property
+        Boolean disallowSimultaneous = getProperty(SQLServerGuacamoleProperties.SQLSERVER_DISALLOW_SIMULTANEOUS_CONNECTIONS);
+        Boolean disallowDuplicate    = getProperty(SQLServerGuacamoleProperties.SQLSERVER_DISALLOW_DUPLICATE_CONNECTIONS);
+
+        // Legacy "simultaneous" property dictates only the maximum number of
+        // connections per connection
+        if (disallowSimultaneous != null) {
+
+            // Translate legacy property
+            if (disallowSimultaneous) {
+                DEFAULT_MAX_CONNECTIONS       = 1;
+                DEFAULT_MAX_GROUP_CONNECTIONS = 0;
+            }
+            else {
+                DEFAULT_MAX_CONNECTIONS       = 0;
+                DEFAULT_MAX_GROUP_CONNECTIONS = 0;
+            }
+
+            // Warn of deprecation
+            logger.warn("The \"{}\" property is deprecated. Use \"{}\" and \"{}\" instead.",
+                    SQLServerGuacamoleProperties.SQLSERVER_DISALLOW_SIMULTANEOUS_CONNECTIONS.getName(),
+                    SQLServerGuacamoleProperties.SQLSERVER_DEFAULT_MAX_CONNECTIONS.getName(),
+                    SQLServerGuacamoleProperties.SQLSERVER_DEFAULT_MAX_GROUP_CONNECTIONS.getName());
+
+            // Inform of new equivalent
+            logger.info("To achieve the same result of setting \"{}\" to \"{}\", set \"{}\" to \"{}\" and \"{}\" to \"{}\".",
+                    SQLServerGuacamoleProperties.SQLSERVER_DISALLOW_SIMULTANEOUS_CONNECTIONS.getName(), disallowSimultaneous,
+                    SQLServerGuacamoleProperties.SQLSERVER_DEFAULT_MAX_CONNECTIONS.getName(),           DEFAULT_MAX_CONNECTIONS,
+                    SQLServerGuacamoleProperties.SQLSERVER_DEFAULT_MAX_GROUP_CONNECTIONS.getName(),     DEFAULT_MAX_GROUP_CONNECTIONS);
+
+        }
+
+        // Legacy "duplicate" property dictates whether connections and groups
+        // may be used concurrently only by different users
+        if (disallowDuplicate != null) {
+
+            // Translate legacy property
+            if (disallowDuplicate) {
+                DEFAULT_MAX_CONNECTIONS_PER_USER       = 1;
+                DEFAULT_MAX_GROUP_CONNECTIONS_PER_USER = 1;
+            }
+            else {
+                DEFAULT_MAX_CONNECTIONS_PER_USER       = 0;
+                DEFAULT_MAX_GROUP_CONNECTIONS_PER_USER = 0;
+            }
+
+            // Warn of deprecation
+            logger.warn("The \"{}\" property is deprecated. Use \"{}\" and \"{}\" instead.",
+                    SQLServerGuacamoleProperties.SQLSERVER_DISALLOW_DUPLICATE_CONNECTIONS.getName(),
+                    SQLServerGuacamoleProperties.SQLSERVER_DEFAULT_MAX_CONNECTIONS_PER_USER.getName(),
+                    SQLServerGuacamoleProperties.SQLSERVER_DEFAULT_MAX_GROUP_CONNECTIONS.getName());
+
+            // Inform of new equivalent
+            logger.info("To achieve the same result of setting \"{}\" to \"{}\", set \"{}\" to \"{}\" and \"{}\" to \"{}\".",
+                    SQLServerGuacamoleProperties.SQLSERVER_DISALLOW_DUPLICATE_CONNECTIONS.getName(),         disallowDuplicate,
+                    SQLServerGuacamoleProperties.SQLSERVER_DEFAULT_MAX_CONNECTIONS_PER_USER.getName(),       DEFAULT_MAX_CONNECTIONS_PER_USER,
+                    SQLServerGuacamoleProperties.SQLSERVER_DEFAULT_MAX_GROUP_CONNECTIONS_PER_USER.getName(), DEFAULT_MAX_GROUP_CONNECTIONS_PER_USER);
+
+        }
+
+    }
+
+    @Override
+    public boolean isUserRequired() throws GuacamoleException {
+        return getProperty(
+            SQLServerGuacamoleProperties.SQLSERVER_USER_REQUIRED,
+            DEFAULT_USER_REQUIRED
+        );
+    }
+
+    @Override
+    public int getAbsoluteMaxConnections() throws GuacamoleException {
+        return getProperty(SQLServerGuacamoleProperties.SQLSERVER_ABSOLUTE_MAX_CONNECTIONS,
+            DEFAULT_ABSOLUTE_MAX_CONNECTIONS
+        );
+    }
+
+    @Override
+    public int getDefaultMaxConnections() throws GuacamoleException {
+        return getProperty(
+            SQLServerGuacamoleProperties.SQLSERVER_DEFAULT_MAX_CONNECTIONS,
+            DEFAULT_MAX_CONNECTIONS
+        );
+    }
+
+    @Override
+    public int getDefaultMaxGroupConnections() throws GuacamoleException {
+        return getProperty(
+            SQLServerGuacamoleProperties.SQLSERVER_DEFAULT_MAX_GROUP_CONNECTIONS,
+            DEFAULT_MAX_GROUP_CONNECTIONS
+        );
+    }
+
+    @Override
+    public int getDefaultMaxConnectionsPerUser() throws GuacamoleException {
+        return getProperty(
+            SQLServerGuacamoleProperties.SQLSERVER_DEFAULT_MAX_CONNECTIONS_PER_USER,
+            DEFAULT_MAX_CONNECTIONS_PER_USER
+        );
+    }
+
+    @Override
+    public int getDefaultMaxGroupConnectionsPerUser() throws GuacamoleException {
+        return getProperty(
+            SQLServerGuacamoleProperties.SQLSERVER_DEFAULT_MAX_GROUP_CONNECTIONS_PER_USER,
+            DEFAULT_MAX_GROUP_CONNECTIONS_PER_USER
+        );
+    }
+
+    @Override
+    public PasswordPolicy getPasswordPolicy() {
+        return new SQLServerPasswordPolicy(this);
+    }
+
+    /**
+     * Returns the hostname of the SQLServer server hosting the Guacamole
+     * authentication tables. If unspecified, this will be "localhost".
+     * 
+     * @return
+     *     The URL of the SQLServer server.
+     *
+     * @throws GuacamoleException 
+     *     If an error occurs while retrieving the property value.
+     */
+    public String getSQLServerHostname() throws GuacamoleException {
+        return getProperty(
+            SQLServerGuacamoleProperties.SQLSERVER_HOSTNAME,
+            DEFAULT_HOSTNAME
+        );
+    }
+    
+    /**
+     * Returns the port number of the SQLServer server hosting the Guacamole
+     * authentication tables. If unspecified, this will be the default
+     * SQLServer port of 5432.
+     * 
+     * @return
+     *     The port number of the SQLServer server.
+     *
+     * @throws GuacamoleException 
+     *     If an error occurs while retrieving the property value.
+     */
+    public int getSQLServerPort() throws GuacamoleException {
+        return getProperty(
+            SQLServerGuacamoleProperties.SQLSERVER_PORT,
+            DEFAULT_PORT
+        );
+    }
+    
+    /**
+     * Returns the name of the SQLServer database containing the Guacamole
+     * authentication tables.
+     * 
+     * @return
+     *     The name of the SQLServer database.
+     *
+     * @throws GuacamoleException 
+     *     If an error occurs while retrieving the property value, or if the
+     *     value was not set, as this property is required.
+     */
+    public String getSQLServerDatabase() throws GuacamoleException {
+        return getRequiredProperty(SQLServerGuacamoleProperties.SQLSERVER_DATABASE);
+    }
+    
+    /**
+     * Returns the username that should be used when authenticating with the
+     * SQLServer database containing the Guacamole authentication tables.
+     * 
+     * @return
+     *     The username for the SQLServer database.
+     *
+     * @throws GuacamoleException 
+     *     If an error occurs while retrieving the property value, or if the
+     *     value was not set, as this property is required.
+     */
+    public String getSQLServerUsername() throws GuacamoleException {
+        return getRequiredProperty(SQLServerGuacamoleProperties.SQLSERVER_USERNAME);
+    }
+    
+    /**
+     * Returns the password that should be used when authenticating with the
+     * SQLServer database containing the Guacamole authentication tables.
+     * 
+     * @return
+     *     The password for the SQLServer database.
+     *
+     * @throws GuacamoleException 
+     *     If an error occurs while retrieving the property value, or if the
+     *     value was not set, as this property is required.
+     */
+    public String getSQLServerPassword() throws GuacamoleException {
+        return getRequiredProperty(SQLServerGuacamoleProperties.SQLSERVER_PASSWORD);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b6e88d33/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerGuacamoleProperties.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerGuacamoleProperties.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerGuacamoleProperties.java
new file mode 100644
index 0000000..e45f502
--- /dev/null
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerGuacamoleProperties.java
@@ -0,0 +1,200 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.guacamole.auth.sqlserver;
+
+import org.apache.guacamole.properties.BooleanGuacamoleProperty;
+import org.apache.guacamole.properties.IntegerGuacamoleProperty;
+import org.apache.guacamole.properties.StringGuacamoleProperty;
+
+/**
+ * Properties used by the SQLServer Authentication plugin.
+ */
+public class SQLServerGuacamoleProperties {
+
+    /**
+     * This class should not be instantiated.
+     */
+    private SQLServerGuacamoleProperties() {}
+
+    /**
+     * The URL of the SQLServer server hosting the Guacamole authentication tables.
+     */
+    public static final StringGuacamoleProperty SQLSERVER_HOSTNAME =
+            new StringGuacamoleProperty() {
+
+        @Override
+        public String getName() { return "sqlserver-hostname"; }
+
+    };
+
+    /**
+     * The port of the SQLServer server hosting the Guacamole authentication
+     * tables.
+     */
+    public static final IntegerGuacamoleProperty SQLSERVER_PORT =
+            new IntegerGuacamoleProperty() {
+
+        @Override
+        public String getName() { return "sqlserver-port"; }
+
+    };
+
+    /**
+     * The name of the SQLServer database containing the Guacamole
+     * authentication tables.
+     */
+    public static final StringGuacamoleProperty SQLSERVER_DATABASE =
+            new StringGuacamoleProperty() {
+
+        @Override
+        public String getName() { return "sqlserver-database"; }
+
+    };
+
+    /**
+     * The username used to authenticate to the SQLServer database containing
+     * the Guacamole authentication tables.
+     */
+    public static final StringGuacamoleProperty SQLSERVER_USERNAME =
+            new StringGuacamoleProperty() {
+
+        @Override
+        public String getName() { return "sqlserver-username"; }
+
+    };
+
+    /**
+     * The password used to authenticate to the SQLServer database containing
+     * the Guacamole authentication tables.
+     */
+    public static final StringGuacamoleProperty SQLSERVER_PASSWORD =
+            new StringGuacamoleProperty() {
+
+        @Override
+        public String getName() { return "sqlserver-password"; }
+
+    };
+
+    /**
+     * Whether a user account within the database is required for authentication
+     * to succeed, even if the user has been authenticated via another
+     * authentication provider.
+     */
+    public static final BooleanGuacamoleProperty
+            SQLSERVER_USER_REQUIRED = new BooleanGuacamoleProperty() {
+
+        @Override
+        public String getName() { return "sqlserver-user-required"; }
+
+    };
+
+    /**
+     * Whether or not multiple users accessing the same connection at the same
+     * time should be disallowed.
+     */
+    public static final BooleanGuacamoleProperty
+            SQLSERVER_DISALLOW_SIMULTANEOUS_CONNECTIONS =
+            new BooleanGuacamoleProperty() {
+
+        @Override
+        public String getName() { return "sqlserver-disallow-simultaneous-connections"; }
+
+    };
+
+    /**
+     * Whether or not the same user accessing the same connection or connection
+     * group at the same time should be disallowed.
+     */
+    public static final BooleanGuacamoleProperty
+            SQLSERVER_DISALLOW_DUPLICATE_CONNECTIONS =
+            new BooleanGuacamoleProperty() {
+
+        @Override
+        public String getName() { return "sqlserver-disallow-duplicate-connections"; }
+
+    };
+
+    /**
+     * The maximum number of concurrent connections to allow overall. Zero
+     * denotes unlimited.
+     */
+    public static final IntegerGuacamoleProperty
+            SQLSERVER_ABSOLUTE_MAX_CONNECTIONS =
+            new IntegerGuacamoleProperty() {
+
+        @Override
+        public String getName() { return "sqlserver-absolute-max-connections"; }
+
+    };
+
+    /**
+     * The maximum number of concurrent connections to allow to any one
+     * connection. Zero denotes unlimited.
+     */
+    public static final IntegerGuacamoleProperty
+            SQLSERVER_DEFAULT_MAX_CONNECTIONS =
+            new IntegerGuacamoleProperty() {
+
+        @Override
+        public String getName() { return "sqlserver-default-max-connections"; }
+
+    };
+
+    /**
+     * The maximum number of concurrent connections to allow to any one
+     * connection group. Zero denotes unlimited.
+     */
+    public static final IntegerGuacamoleProperty
+            SQLSERVER_DEFAULT_MAX_GROUP_CONNECTIONS =
+            new IntegerGuacamoleProperty() {
+
+        @Override
+        public String getName() { return "sqlserver-default-max-group-connections"; }
+
+    };
+
+    /**
+     * The maximum number of concurrent connections to allow to any one
+     * connection by an individual user. Zero denotes unlimited.
+     */
+    public static final IntegerGuacamoleProperty
+            SQLSERVER_DEFAULT_MAX_CONNECTIONS_PER_USER =
+            new IntegerGuacamoleProperty() {
+
+        @Override
+        public String getName() { return "sqlserver-default-max-connections-per-user"; }
+
+    };
+
+    /**
+     * The maximum number of concurrent connections to allow to any one
+     * connection group by an individual user. Zero denotes
+     * unlimited.
+     */
+    public static final IntegerGuacamoleProperty
+            SQLSERVER_DEFAULT_MAX_GROUP_CONNECTIONS_PER_USER =
+            new IntegerGuacamoleProperty() {
+
+        @Override
+        public String getName() { return "sqlserver-default-max-group-connections-per-user"; }
+
+    };
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b6e88d33/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerInjectorProvider.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerInjectorProvider.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerInjectorProvider.java
new file mode 100644
index 0000000..32d12f6
--- /dev/null
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerInjectorProvider.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.guacamole.auth.sqlserver;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import org.apache.guacamole.GuacamoleException;
+import org.apache.guacamole.auth.jdbc.JDBCAuthenticationProviderModule;
+import org.apache.guacamole.auth.jdbc.JDBCInjectorProvider;
+
+/**
+ * JDBCInjectorProvider implementation which configures Guice injections for
+ * connecting to a SQLServer database based on SQLServer-specific options
+ * provided via guacamole.properties.
+ */
+public class SQLServerInjectorProvider extends JDBCInjectorProvider {
+
+    @Override
+    protected Injector create() throws GuacamoleException {
+
+        // Get local environment
+        SQLServerEnvironment environment = new SQLServerEnvironment();
+
+        // Set up Guice injector
+        return Guice.createInjector(
+            new JDBCAuthenticationProviderModule(environment),
+            new SQLServerAuthenticationProviderModule(environment)
+        );
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b6e88d33/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerPasswordPolicy.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerPasswordPolicy.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerPasswordPolicy.java
new file mode 100644
index 0000000..f30b180
--- /dev/null
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerPasswordPolicy.java
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.guacamole.auth.sqlserver;
+
+import org.apache.guacamole.GuacamoleException;
+import org.apache.guacamole.auth.jdbc.JDBCEnvironment;
+import org.apache.guacamole.auth.jdbc.security.PasswordPolicy;
+import org.apache.guacamole.properties.BooleanGuacamoleProperty;
+import org.apache.guacamole.properties.IntegerGuacamoleProperty;
+
+/**
+ * PasswordPolicy implementation which reads the details of the policy from
+ * SQLServer-specific properties in guacamole.properties.
+ */
+public class SQLServerPasswordPolicy implements PasswordPolicy {
+
+    /**
+     * The property which specifies the minimum length required of all user
+     * passwords. By default, this will be zero.
+     */
+    private static final IntegerGuacamoleProperty MIN_LENGTH =
+            new IntegerGuacamoleProperty() {
+
+        @Override
+        public String getName() { return "sqlserver-user-password-min-length"; }
+
+    };
+
+    /**
+     * The property which specifies the minimum number of days which must
+     * elapse before a user may reset their password. If set to zero, the
+     * default, then this restriction does not apply.
+     */
+    private static final IntegerGuacamoleProperty MIN_AGE =
+            new IntegerGuacamoleProperty() {
+
+        @Override
+        public String getName() { return "sqlserver-user-password-min-age"; }
+
+    };
+
+    /**
+     * The property which specifies the maximum number of days which may
+     * elapse before a user is required to reset their password. If set to zero,
+     * the default, then this restriction does not apply.
+     */
+    private static final IntegerGuacamoleProperty MAX_AGE =
+            new IntegerGuacamoleProperty() {
+
+        @Override
+        public String getName() { return "sqlserver-user-password-max-age"; }
+
+    };
+
+    /**
+     * The property which specifies the number of previous passwords remembered
+     * for each user. If set to zero, the default, then this restriction does
+     * not apply.
+     */
+    private static final IntegerGuacamoleProperty HISTORY_SIZE =
+            new IntegerGuacamoleProperty() {
+
+        @Override
+        public String getName() { return "sqlserver-user-password-history-size"; }
+
+    };
+
+    /**
+     * The property which specifies whether all user passwords must have at
+     * least one lowercase character and one uppercase character. By default,
+     * no such restriction is imposed.
+     */
+    private static final BooleanGuacamoleProperty REQUIRE_MULTIPLE_CASE =
+            new BooleanGuacamoleProperty() {
+
+        @Override
+        public String getName() { return "sqlserver-user-password-require-multiple-case"; }
+
+    };
+
+    /**
+     * The property which specifies whether all user passwords must have at
+     * least one numeric character (digit). By default, no such restriction is
+     * imposed.
+     */
+    private static final BooleanGuacamoleProperty REQUIRE_DIGIT =
+            new BooleanGuacamoleProperty() {
+
+        @Override
+        public String getName() { return "sqlserver-user-password-require-digit"; }
+
+    };
+
+    /**
+     * The property which specifies whether all user passwords must have at
+     * least one non-alphanumeric character (symbol). By default, no such
+     * restriction is imposed.
+     */
+    private static final BooleanGuacamoleProperty REQUIRE_SYMBOL =
+            new BooleanGuacamoleProperty() {
+
+        @Override
+        public String getName() { return "sqlserver-user-password-require-symbol"; }
+
+    };
+
+    /**
+     * The property which specifies whether users are prohibited from including
+     * their own username in their password. By default, no such restriction is
+     * imposed.
+     */
+    private static final BooleanGuacamoleProperty PROHIBIT_USERNAME =
+            new BooleanGuacamoleProperty() {
+
+        @Override
+        public String getName() { return "sqlserver-user-password-prohibit-username"; }
+
+    };
+
+    /**
+     * The Guacamole server environment.
+     */
+    private final JDBCEnvironment environment;
+
+    /**
+     * Creates a new SQLServerPasswordPolicy which reads the details of the
+     * policy from the properties exposed by the given environment.
+     *
+     * @param environment
+     *     The environment from which password policy properties should be
+     *     read.
+     */
+    public SQLServerPasswordPolicy(JDBCEnvironment environment) {
+        this.environment = environment;
+    }
+
+    @Override
+    public int getMinimumLength() throws GuacamoleException {
+        return environment.getProperty(MIN_LENGTH, 0);
+    }
+
+    @Override
+    public int getMinimumAge() throws GuacamoleException {
+        return environment.getProperty(MIN_AGE, 0);
+    }
+
+    @Override
+    public int getMaximumAge() throws GuacamoleException {
+        return environment.getProperty(MAX_AGE, 0);
+    }
+
+    @Override
+    public int getHistorySize() throws GuacamoleException {
+        return environment.getProperty(HISTORY_SIZE, 0);
+    }
+
+    @Override
+    public boolean isMultipleCaseRequired() throws GuacamoleException {
+        return environment.getProperty(REQUIRE_MULTIPLE_CASE, false);
+    }
+
+    @Override
+    public boolean isNumericRequired() throws GuacamoleException {
+        return environment.getProperty(REQUIRE_DIGIT, false);
+    }
+
+    @Override
+    public boolean isNonAlphanumericRequired() throws GuacamoleException {
+        return environment.getProperty(REQUIRE_SYMBOL, false);
+    }
+
+    @Override
+    public boolean isUsernameProhibited() throws GuacamoleException {
+        return environment.getProperty(PROHIBIT_USERNAME, false);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b6e88d33/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerSharedAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerSharedAuthenticationProvider.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerSharedAuthenticationProvider.java
new file mode 100644
index 0000000..0a3c8d3
--- /dev/null
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerSharedAuthenticationProvider.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.guacamole.auth.sqlserver;
+
+import org.apache.guacamole.GuacamoleException;
+import org.apache.guacamole.auth.jdbc.InjectedAuthenticationProvider;
+import org.apache.guacamole.auth.jdbc.sharing.SharedAuthenticationProviderService;
+
+/**
+ * Provides a implementation of AuthenticationProvider which interacts with the
+ * SQLServer AuthenticationProvider, accepting share keys as credentials and
+ * providing access to the shared connections.
+ */
+public class SQLServerSharedAuthenticationProvider extends InjectedAuthenticationProvider {
+
+    /**
+     * Creates a new SQLServerSharedAuthenticationProvider that provides access
+     * to shared connections exposed by the SQLServerAuthenticationProvider.
+     *
+     * @throws GuacamoleException
+     *     If a required property is missing, or an error occurs while parsing
+     *     a property.
+     */
+    public SQLServerSharedAuthenticationProvider() throws GuacamoleException {
+        super(new SQLServerInjectorProvider(), SharedAuthenticationProviderService.class);
+    }
+
+    @Override
+    public String getIdentifier() {
+        return "sqlserver-shared";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b6e88d33/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/package-info.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/package-info.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/package-info.java
new file mode 100644
index 0000000..7bbe1b2
--- /dev/null
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * The SQLServer authentication provider.
+ */
+package org.apache.guacamole.auth.sqlserver;

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b6e88d33/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/guac-manifest.json
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/guac-manifest.json b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/guac-manifest.json
new file mode 100644
index 0000000..ee61ab5
--- /dev/null
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/guac-manifest.json
@@ -0,0 +1,28 @@
+{
+
+    "guacamoleVersion" : "0.9.13-incubating",
+
+    "name"      : "SQLServer Authentication",
+    "namespace" : "guac-sqlserver",
+
+    "authProviders" : [
+        "org.apache.guacamole.auth.sqlserver.SQLServerAuthenticationProvider",
+        "org.apache.guacamole.auth.sqlserver.SQLServerSharedAuthenticationProvider"
+    ],
+
+    "css" : [
+        "styles/jdbc.css"
+    ],
+
+    "html" : [
+        "html/shared-connection.html"
+    ],
+
+    "translations" : [
+        "translations/en.json",
+        "translations/fr.json",
+        "translations/ru.json"
+    ]
+
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b6e88d33/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionMapper.xml
new file mode 100644
index 0000000..24008fc
--- /dev/null
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionMapper.xml
@@ -0,0 +1,235 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+    "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+
+<mapper namespace="org.apache.guacamole.auth.jdbc.connection.ConnectionMapper" >
+
+    <!-- Result mapper for connection objects -->
+    <resultMap id="ConnectionResultMap" type="org.apache.guacamole.auth.jdbc.connection.ConnectionModel" >
+
+        <!-- Connection properties -->
+        <id     column="connection_id"            property="objectID"              jdbcType="INTEGER"/>
+        <result column="connection_name"          property="name"                  jdbcType="VARCHAR"/>
+        <result column="parent_id"                property="parentIdentifier"      jdbcType="INTEGER"/>
+        <result column="protocol"                 property="protocol"              jdbcType="VARCHAR"/>
+        <result column="max_connections"          property="maxConnections"        jdbcType="INTEGER"/>
+        <result column="max_connections_per_user" property="maxConnectionsPerUser" jdbcType="INTEGER"/>
+        <result column="proxy_hostname"           property="proxyHostname"         jdbcType="VARCHAR"/>
+        <result column="proxy_port"               property="proxyPort"             jdbcType="INTEGER"/>
+        <result column="proxy_encryption_method"  property="proxyEncryptionMethod" jdbcType="VARCHAR"
+                javaType="org.apache.guacamole.net.auth.GuacamoleProxyConfiguration$EncryptionMethod"/>
+        <result column="connection_weight"        property="connectionWeight"      jdbcType="INTEGER"/>
+        <result column="failover_only"            property="failoverOnly"          jdbcType="BOOLEAN"/>
+
+        <!-- Associated sharing profiles -->
+        <collection property="sharingProfileIdentifiers" resultSet="sharingProfiles" ofType="java.lang.String"
+                    column="connection_id" foreignColumn="primary_connection_id">
+            <result column="sharing_profile_id"/>
+        </collection>
+
+    </resultMap>
+
+    <!-- Select all connection identifiers -->
+    <select id="selectIdentifiers" resultType="string">
+        SELECT connection_id 
+        FROM [guacamole].[connection]
+    </select>
+
+    <!-- Select identifiers of all readable connections -->
+    <select id="selectReadableIdentifiers" resultType="string">
+        SELECT connection_id
+        FROM [guacamole].[connection_permission]
+        WHERE
+            user_id = #{user.objectID,jdbcType=INTEGER}
+            AND permission = 'READ'
+    </select>
+
+    <!-- Select all connection identifiers within a particular connection group -->
+    <select id="selectIdentifiersWithin" resultType="string">
+        SELECT connection_id 
+        FROM [guacamole].[connection]
+        WHERE
+            <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if>
+            <if test="parentIdentifier == null">parent_id IS NULL</if>
+    </select>
+
+    <!-- Select identifiers of all readable connections within a particular connection group -->
+    <select id="selectReadableIdentifiersWithin" resultType="string">
+        SELECT [guacamole].[connection].connection_id
+        FROM [guacamole].[connection]
+        JOIN [guacamole].[connection_permission] ON [guacamole].[connection_permission].connection_id = [guacamole].[connection].connection_id
+        WHERE
+            <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if>
+            <if test="parentIdentifier == null">parent_id IS NULL</if>
+            AND user_id = #{user.objectID,jdbcType=INTEGER}
+            AND permission = 'READ'
+    </select>
+
+    <!-- Select multiple connections by identifier -->
+    <select id="select" resultMap="ConnectionResultMap"
+            resultSets="connections,sharingProfiles">
+
+        SELECT
+            connection_id,
+            connection_name,
+            parent_id,
+            protocol,
+            max_connections,
+            max_connections_per_user,
+            proxy_hostname,
+            proxy_port,
+            proxy_encryption_method,
+            connection_weight,
+            failover_only
+        FROM [guacamole].[connection]
+        WHERE connection_id IN
+            <foreach collection="identifiers" item="identifier"
+                     open="(" separator="," close=")">
+                #{identifier,jdbcType=INTEGER}
+            </foreach>;
+
+        SELECT primary_connection_id, sharing_profile_id
+        FROM [guacamole].[sharing_profile]
+        WHERE primary_connection_id IN
+            <foreach collection="identifiers" item="identifier"
+                     open="(" separator="," close=")">
+                #{identifier,jdbcType=INTEGER}
+            </foreach>;
+
+    </select>
+
+    <!-- Select multiple connections by identifier only if readable -->
+    <select id="selectReadable" resultMap="ConnectionResultMap"
+            resultSets="connections,sharingProfiles">
+
+        SELECT
+            [guacamole].[connection].connection_id,
+            connection_name,
+            parent_id,
+            protocol,
+            max_connections,
+            max_connections_per_user,
+            proxy_hostname,
+            proxy_port,
+            proxy_encryption_method,
+            connection_weight,
+            failover_only
+        FROM [guacamole].[connection]
+        JOIN [guacamole].[connection_permission] ON [guacamole].[connection_permission].connection_id = [guacamole].[connection].connection_id
+        WHERE [guacamole].[connection].connection_id IN
+            <foreach collection="identifiers" item="identifier"
+                     open="(" separator="," close=")">
+                #{identifier,jdbcType=INTEGER}
+            </foreach>
+            AND user_id = #{user.objectID,jdbcType=INTEGER}
+            AND permission = 'READ';
+
+        SELECT primary_connection_id, [guacamole].[sharing_profile].sharing_profile_id
+        FROM [guacamole].[sharing_profile]
+        JOIN [guacamole].[sharing_profile_permission] ON [guacamole].[sharing_profile_permission].sharing_profile_id = [guacamole].[sharing_profile].sharing_profile_id
+        WHERE primary_connection_id IN
+            <foreach collection="identifiers" item="identifier"
+                     open="(" separator="," close=")">
+                #{identifier,jdbcType=INTEGER}
+            </foreach>
+            AND user_id = #{user.objectID,jdbcType=INTEGER}
+            AND permission = 'READ';
+
+    </select>
+
+    <!-- Select single connection by name -->
+    <select id="selectOneByName" resultMap="ConnectionResultMap">
+
+        SELECT
+            connection_id,
+            connection_name,
+            parent_id,
+            protocol,
+            max_connections,
+            max_connections_per_user,
+            proxy_hostname,
+            proxy_port,
+            proxy_encryption_method,
+            connection_weight,
+            failover_only
+        FROM [guacamole].[connection]
+        WHERE 
+            <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if>
+            <if test="parentIdentifier == null">parent_id IS NULL</if>
+            AND connection_name = #{name,jdbcType=VARCHAR}
+
+    </select>
+
+    <!-- Delete single connection by identifier -->
+    <delete id="delete">
+        DELETE FROM [guacamole].[connection]
+        WHERE connection_id = #{identifier,jdbcType=INTEGER}
+    </delete>
+
+    <!-- Insert single connection -->
+    <insert id="insert" useGeneratedKeys="true" keyProperty="object.objectID"
+            parameterType="org.apache.guacamole.auth.jdbc.connection.ConnectionModel">
+
+        INSERT INTO [guacamole].[connection] (
+            connection_name,
+            parent_id,
+            protocol,
+            max_connections,
+            max_connections_per_user,
+            proxy_hostname,
+            proxy_port,
+            proxy_encryption_method,
+            connection_weight,
+            failover_only
+        )
+        VALUES (
+            #{object.name,jdbcType=VARCHAR},
+            #{object.parentIdentifier,jdbcType=INTEGER},
+            #{object.protocol,jdbcType=VARCHAR},
+            #{object.maxConnections,jdbcType=INTEGER},
+            #{object.maxConnectionsPerUser,jdbcType=INTEGER},
+            #{object.proxyHostname,jdbcType=VARCHAR},
+            #{object.proxyPort,jdbcType=INTEGER},
+            #{object.proxyEncryptionMethod,jdbcType=VARCHAR},
+            #{object.connectionWeight,jdbcType=INTEGER},
+            #{object.failoverOnly,jdbcType=INTEGER}
+        )
+
+    </insert>
+
+    <!-- Update single connection -->
+    <update id="update" parameterType="org.apache.guacamole.auth.jdbc.connection.ConnectionModel">
+        UPDATE [guacamole].[connection]
+        SET connection_name          = #{object.name,jdbcType=VARCHAR},
+            parent_id                = #{object.parentIdentifier,jdbcType=INTEGER},
+            protocol                 = #{object.protocol,jdbcType=VARCHAR},
+            max_connections          = #{object.maxConnections,jdbcType=INTEGER},
+            max_connections_per_user = #{object.maxConnectionsPerUser,jdbcType=INTEGER},
+            proxy_hostname           = #{object.proxyHostname,jdbcType=VARCHAR},
+            proxy_port               = #{object.proxyPort,jdbcType=INTEGER},
+            proxy_encryption_method  = #{object.proxyEncryptionMethod,jdbcType=VARCHAR},
+            connection_weight        = #{object.connectionWeight,jdbcType=INTEGER},
+            failover_only            = #{object.failoverOnly,jdbcType=INTEGER}
+        WHERE connection_id = #{object.objectID,jdbcType=INTEGER}
+    </update>
+
+</mapper>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b6e88d33/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionParameterMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionParameterMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionParameterMapper.xml
new file mode 100644
index 0000000..de1ab97
--- /dev/null
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionParameterMapper.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+    "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+
+<mapper namespace="org.apache.guacamole.auth.jdbc.connection.ConnectionParameterMapper">
+
+    <!-- Result mapper for connection parameters -->
+    <resultMap id="ParameterResultMap" type="org.apache.guacamole.auth.jdbc.connection.ConnectionParameterModel">
+        <result column="connection_id"   property="connectionIdentifier" jdbcType="INTEGER"/>
+        <result column="parameter_name"  property="name"                 jdbcType="VARCHAR"/>
+        <result column="parameter_value" property="value"                jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <!-- Select all parameters of a given connection -->
+    <select id="select" resultMap="ParameterResultMap">
+        SELECT
+            connection_id,
+            parameter_name,
+            parameter_value
+        FROM [guacamole].[connection_parameter]
+        WHERE
+            connection_id = #{identifier,jdbcType=INTEGER}
+    </select>
+
+    <!-- Delete all parameters of a given connection -->
+    <delete id="delete">
+        DELETE FROM [guacamole].[connection_parameter]
+        WHERE connection_id = #{identifier,jdbcType=INTEGER}
+    </delete>
+
+    <!-- Insert all given parameters -->
+    <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.connection.ConnectionParameterModel">
+
+        INSERT INTO [guacamole].[connection_parameter] (
+            connection_id,
+            parameter_name,
+            parameter_value
+        )
+        VALUES 
+            <foreach collection="parameters" item="parameter" separator=",">
+                (#{parameter.connectionIdentifier,jdbcType=INTEGER},
+                 #{parameter.name,jdbcType=VARCHAR},
+                 #{parameter.value,jdbcType=VARCHAR})
+            </foreach>
+
+    </insert>
+
+
+</mapper>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b6e88d33/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
new file mode 100644
index 0000000..ec077db
--- /dev/null
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
@@ -0,0 +1,216 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+    "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+
+<mapper namespace="org.apache.guacamole.auth.jdbc.connection.ConnectionRecordMapper" >
+
+    <!-- Result mapper for system permissions -->
+    <resultMap id="ConnectionRecordResultMap" type="org.apache.guacamole.auth.jdbc.connection.ConnectionRecordModel">
+        <result column="connection_id"        property="connectionIdentifier"     jdbcType="INTEGER"/>
+        <result column="connection_name"      property="connectionName"           jdbcType="VARCHAR"/>
+        <result column="remote_host"          property="remoteHost"               jdbcType="VARCHAR"/>
+        <result column="sharing_profile_id"   property="sharingProfileIdentifier" jdbcType="INTEGER"/>
+        <result column="sharing_profile_name" property="sharingProfileName"       jdbcType="VARCHAR"/>
+        <result column="user_id"              property="userID"                   jdbcType="INTEGER"/>
+        <result column="username"             property="username"                 jdbcType="VARCHAR"/>
+        <result column="start_date"           property="startDate"                jdbcType="TIMESTAMP"/>
+        <result column="end_date"             property="endDate"                  jdbcType="TIMESTAMP"/>
+    </resultMap>
+
+    <!-- Select all connection records from a given connection -->
+    <select id="select" resultMap="ConnectionRecordResultMap">
+
+        SELECT
+            [guacamole].[connection_history].connection_id,
+            [guacamole].[connection_history].connection_name,
+            [guacamole].[connection_history].remote_host,
+            [guacamole].[connection_history].sharing_profile_id,
+            [guacamole].[connection_history].sharing_profile_name,
+            [guacamole].[connection_history].user_id,
+            [guacamole].[connection_history].username,
+            [guacamole].[connection_history].start_date,
+            [guacamole].[connection_history].end_date
+        FROM [guacamole].[connection_history]
+        WHERE
+            [guacamole].[connection_history].connection_id = #{identifier,jdbcType=INTEGER}
+        ORDER BY
+            [guacamole].[connection_history].start_date DESC,
+            [guacamole].[connection_history].end_date DESC
+
+    </select>
+
+    <!-- Insert the given connection record -->
+    <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.connection.ConnectionRecordModel">
+
+        INSERT INTO [guacamole].[connection_history] (
+            connection_id,
+            connection_name,
+            remote_host,
+            sharing_profile_id,
+            sharing_profile_name,
+            user_id,
+            username,
+            start_date,
+            end_date
+        )
+        VALUES (
+            #{record.connectionIdentifier,jdbcType=INTEGER},
+            #{record.connectionName,jdbcType=VARCHAR},
+            #{record.remoteHost,jdbcType=VARCHAR},
+            #{record.sharingProfileIdentifier,jdbcType=INTEGER},
+            #{record.sharingProfileName,jdbcType=VARCHAR},
+            (SELECT user_id FROM [guacamole].[user]
+             WHERE username = #{record.username,jdbcType=VARCHAR}),
+            #{record.username,jdbcType=VARCHAR},
+            #{record.startDate,jdbcType=TIMESTAMP},
+            #{record.endDate,jdbcType=TIMESTAMP}
+        )
+
+    </insert>
+
+    <!-- Search for specific connection records -->
+    <select id="search" resultMap="ConnectionRecordResultMap">
+
+        SELECT
+            [guacamole].[connection_history].connection_id,
+            [guacamole].[connection_history].connection_name,
+            [guacamole].[connection_history].remote_host,
+            [guacamole].[connection_history].sharing_profile_id,
+            [guacamole].[connection_history].sharing_profile_name,
+            [guacamole].[connection_history].user_id,
+            [guacamole].[connection_history].username,
+            [guacamole].[connection_history].start_date,
+            [guacamole].[connection_history].end_date
+        FROM [guacamole].[connection_history]
+
+        <!-- Search terms -->
+        <foreach collection="terms" item="term"
+                 open="WHERE " separator=" AND ">
+            (
+
+                [guacamole].[connection_history].user_id IN (
+                    SELECT user_id
+                    FROM [guacamole].[user]
+                    WHERE POSITION(#{term.term,jdbcType=VARCHAR} IN username) > 0
+                )
+
+                OR [guacamole].[connection_history].connection_id IN (
+                    SELECT connection_id
+                    FROM [guacamole].[connection]
+                    WHERE POSITION(#{term.term,jdbcType=VARCHAR} IN connection_name) > 0
+                )
+
+                <if test="term.startDate != null and term.endDate != null">
+                    OR start_date BETWEEN #{term.startDate,jdbcType=TIMESTAMP} AND #{term.endDate,jdbcType=TIMESTAMP}
+                </if>
+
+            )
+        </foreach>
+
+        <!-- Bind sort property enum values for sake of readability -->
+        <bind name="START_DATE"      value="@org.apache.guacamole.net.auth.ConnectionRecordSet$SortableProperty@START_DATE"/>
+
+        <!-- Sort predicates -->
+        <foreach collection="sortPredicates" item="sortPredicate"
+                 open="ORDER BY " separator=", ">
+            <choose>
+                <when test="sortPredicate.property == START_DATE">[guacamole].[connection_history].start_date</when>
+                <otherwise>1</otherwise>
+            </choose>
+            <if test="sortPredicate.descending">DESC</if>
+        </foreach>
+
+        LIMIT #{limit,jdbcType=INTEGER}
+
+    </select>
+
+    <!-- Search for specific connection records -->
+    <select id="searchReadable" resultMap="ConnectionRecordResultMap">
+
+        SELECT
+            [guacamole].[connection_history].connection_id,
+            [guacamole].[connection_history].connection_name,
+            [guacamole].[connection_history].remote_host,
+            [guacamole].[connection_history].sharing_profile_id,
+            [guacamole].[connection_history].sharing_profile_name,
+            [guacamole].[connection_history].user_id,
+            [guacamole].[connection_history].username,
+            [guacamole].[connection_history].start_date,
+            [guacamole].[connection_history].end_date
+        FROM [guacamole].[connection_history]
+        LEFT JOIN [guacamole].[connection]            ON [guacamole].[connection_history].connection_id = [guacamole].[connection].connection_id
+        LEFT JOIN [guacamole].[user]                  ON [guacamole].[connection_history].user_id       = [guacamole].[user].user_id
+
+        <!-- Restrict to readable connections -->
+        JOIN [guacamole].[connection_permission] ON
+                [guacamole].[connection_history].connection_id = [guacamole].[connection_permission].connection_id
+            AND [guacamole].[connection_permission].user_id    = #{user.objectID,jdbcType=INTEGER}
+            AND [guacamole].[connection_permission].permission = 'READ'
+
+        <!-- Restrict to readable users -->
+        JOIN [guacamole].[user_permission] ON
+                [guacamole].[connection_history].user_id = [guacamole].[user_permission].affected_user_id
+            AND [guacamole].[user_permission].user_id    = #{user.objectID,jdbcType=INTEGER}
+            AND [guacamole].[user_permission].permission = 'READ'
+
+        <!-- Search terms -->
+        <foreach collection="terms" item="term"
+                 open="WHERE " separator=" AND ">
+            (
+
+                [guacamole].[connection_history].user_id IN (
+                    SELECT user_id
+                    FROM [guacamole].[user]
+                    WHERE POSITION(#{term.term,jdbcType=VARCHAR} IN username) > 0
+                )
+
+                OR [guacamole].[connection_history].connection_id IN (
+                    SELECT connection_id
+                    FROM [guacamole].[connection]
+                    WHERE POSITION(#{term.term,jdbcType=VARCHAR} IN connection_name) > 0
+                )
+
+                <if test="term.startDate != null and term.endDate != null">
+                    OR start_date BETWEEN #{term.startDate,jdbcType=TIMESTAMP} AND #{term.endDate,jdbcType=TIMESTAMP}
+                </if>
+
+            )
+        </foreach>
+
+        <!-- Bind sort property enum values for sake of readability -->
+        <bind name="START_DATE"      value="@org.apache.guacamole.net.auth.ConnectionRecordSet$SortableProperty@START_DATE"/>
+
+        <!-- Sort predicates -->
+        <foreach collection="sortPredicates" item="sortPredicate"
+                 open="ORDER BY " separator=", ">
+            <choose>
+                <when test="sortPredicate.property == START_DATE">[guacamole].[connection_history].start_date</when>
+                <otherwise>1</otherwise>
+            </choose>
+            <if test="sortPredicate.descending">DESC</if>
+        </foreach>
+
+        LIMIT #{limit,jdbcType=INTEGER}
+
+    </select>
+
+</mapper>


[12/28] incubator-guacamole-client git commit: GUACAMOLE-363: Standardize table names with other JDBC modules; switch back to dbo schema for now.

Posted by mj...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/66c4b86b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/user/PasswordRecordMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/user/PasswordRecordMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/user/PasswordRecordMapper.xml
index 9ad67a6..a9f44e6 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/user/PasswordRecordMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/user/PasswordRecordMapper.xml
@@ -35,16 +35,16 @@
     <select id="select" resultMap="PasswordRecordResultMap">
 
         SELECT
-            [guacamole].[user_password_history].user_id,
-            [guacamole].[user_password_history].password_hash,
-            [guacamole].[user_password_history].password_salt,
-            [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
+            [dbo].[guacamole_user_password_history].user_id,
+            [dbo].[guacamole_user_password_history].password_hash,
+            [dbo].[guacamole_user_password_history].password_salt,
+            [dbo].[guacamole_user_password_history].password_date
+        FROM [dbo].[guacamole_user_password_history]
+        JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_user_password_history].user_id = [dbo].[guacamole_user].user_id
         WHERE
-            [guacamole].[user].username = #{username,jdbcType=VARCHAR}
+            [dbo].[guacamole_user].username = #{username,jdbcType=VARCHAR}
         ORDER BY
-            [guacamole].[user_password_history].password_date DESC
+            [dbo].[guacamole_user_password_history].password_date DESC
         LIMIT #{maxHistorySize}
 
     </select>
@@ -52,7 +52,7 @@
     <!-- Insert the given password record -->
     <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,
             password_hash,
             password_salt,
@@ -65,10 +65,10 @@
             #{record.passwordDate,jdbcType=TIMESTAMP}
         );
 
-        DELETE FROM [guacamole].[user_password_history]
+        DELETE FROM [dbo].[guacamole_user_password_history]
         WHERE password_history_id IN (
             SELECT password_history_id
-            FROM [guacamole].[user_password_history]
+            FROM [dbo].[guacamole_user_password_history]
             WHERE user_id = #{record.userID,jdbcType=INTEGER}
             ORDER BY password_date DESC
             OFFSET #{maxHistorySize}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/66c4b86b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserMapper.xml
index a4ceea7..465ef20 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/user/UserMapper.xml
@@ -46,16 +46,16 @@
     <!-- Select all usernames -->
     <select id="selectIdentifiers" resultType="string">
         SELECT username
-        FROM [guacamole].[user]
+        FROM [dbo].[guacamole_user]
     </select>
 
     <!-- Select usernames of all readable users -->
     <select id="selectReadableIdentifiers" resultType="string">
         SELECT username
-        FROM [guacamole].[user]
-        JOIN [guacamole].[user_permission] ON affected_user_id = [guacamole].[user].user_id
+        FROM [dbo].[guacamole_user]
+        JOIN [dbo].[guacamole_user_permission] ON affected_user_id = [dbo].[guacamole_user].user_id
         WHERE
-            [guacamole].[user_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+            [dbo].[guacamole_user_permission].user_id = #{user.objectID,jdbcType=INTEGER}
             AND permission = 'READ'
     </select>
 
@@ -79,7 +79,7 @@
             email_address,
             organization,
             organizational_role
-        FROM [guacamole].[user]
+        FROM [dbo].[guacamole_user]
         WHERE username IN
             <foreach collection="identifiers" item="identifier"
                      open="(" separator="," close=")">
@@ -92,7 +92,7 @@
     <select id="selectReadable" resultMap="UserResultMap">
 
         SELECT
-            [guacamole].[user].user_id,
+            [dbo].[guacamole_user].user_id,
             username,
             password_hash,
             password_salt,
@@ -108,14 +108,14 @@
             email_address,
             organization,
             organizational_role
-        FROM [guacamole].[user]
-        JOIN [guacamole].[user_permission] ON affected_user_id = [guacamole].[user].user_id
+        FROM [dbo].[guacamole_user]
+        JOIN [dbo].[guacamole_user_permission] ON affected_user_id = [dbo].[guacamole_user].user_id
         WHERE username IN
             <foreach collection="identifiers" item="identifier"
                      open="(" separator="," close=")">
                 #{identifier,jdbcType=VARCHAR}
             </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'
 
     </select>
@@ -140,7 +140,7 @@
             email_address,
             organization,
             organizational_role
-        FROM [guacamole].[user]
+        FROM [dbo].[guacamole_user]
         WHERE
             username = #{username,jdbcType=VARCHAR}
 
@@ -148,7 +148,7 @@
 
     <!-- Delete single user by username -->
     <delete id="delete">
-        DELETE FROM [guacamole].[user]
+        DELETE FROM [dbo].[guacamole_user]
         WHERE username = #{identifier,jdbcType=VARCHAR}
     </delete>
 
@@ -156,7 +156,7 @@
     <insert id="insert" useGeneratedKeys="true" keyProperty="object.objectID"
             parameterType="org.apache.guacamole.auth.jdbc.user.UserModel">
 
-        INSERT INTO [guacamole].[user] (
+        INSERT INTO [dbo].[guacamole_user] (
             username,
             password_hash,
             password_salt,
@@ -195,7 +195,7 @@
 
     <!-- Update single user -->
     <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},
             password_salt = #{object.passwordSalt,jdbcType=BINARY},
             password_date = #{object.passwordDate,jdbcType=TIMESTAMP},


[09/28] incubator-guacamole-client git commit: GUACAMOLE-363: Fix style, order, and batching in SQL Server schema scripts.

Posted by mj...@apache.org.
GUACAMOLE-363: Fix style, order, and batching in SQL Server schema scripts.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/63c541b1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/63c541b1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/63c541b1

Branch: refs/heads/master
Commit: 63c541b1ff8b0333340005a78703210f05767f70
Parents: 75f51f2
Author: Nick Couchman <vn...@apache.org>
Authored: Tue Aug 15 17:03:25 2017 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Thu Sep 28 07:00:52 2017 -0400

----------------------------------------------------------------------
 .../schema/001-create-schema.sql                | Bin 35118 -> 37808 bytes
 .../schema/002-create-admin-user.sql            |  56 +++++++------------
 2 files changed, 20 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/63c541b1/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
index df95800..166e14f 100644
Binary files a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql and b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql differ

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/63c541b1/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
index 08cce3f..947c5ac 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
@@ -1,43 +1,27 @@
 /**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Create the default admin user account and set up full privileges.
  */
+INSERT INTO [guacamole].[user] (username, password_hash, password_date)
+VALUES ('guacadmin', HASHBYTES('SHA2_256', 'guacadmin'), getdate());
 
-INSERT INTO [guacamole].[user] (username, password_hash, password_salt, password_date)
-VALUES ('guacadmin', 0xCA458A7D494E3BE824F5E1E175A1556C0F8EEF2C2D7DF3633BEC4A29C4411960,
-0xCA458A7D494E3BE824F5E1E175A1556C0F8EEF2C2D7DF3633BEC4A29C4411960, getdate());
+INSERT INTO [guacamole].[user_permission]
+SELECT [guacamole].[user].[user_id], [affected].[user_id], permission
+FROM (
+    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, 'ADMINISTER' AS permission)
+    permissions
+    JOIN [guacamole].[user] ON permissions.username = [guacamole].[user].[username]
+    JOIN [guacamole].[user] affected ON permissions.affected_username = affected.username;
 
 INSERT INTO [guacamole].[system_permission]
 SELECT user_id, permission
 FROM (
-		SELECT 'guacadmin' AS username, 'CREATE_CONNECTION' AS permission
-		UNION SELECT 'guacadmin' AS username, 'CREATE_CONNECTION_GROUP' AS permission
-		UNION SELECT 'guacadmin' AS username, 'CREATE_SHARING_PROFILE' AS permission
-		UNION SELECT 'guacadmin' AS username, 'CREATE_USER' AS permission
-		UNION SELECT 'guacadmin' AS username, 'ADMINISTER' AS permission)
-		permissions
-		JOIN [guacamole].[user] ON permissions.username = [guacamole].[user].[username];
-
-INSERT INTO [guacamole].[user_permission]
-SELECT [guacamole].[user].[user_id], [affected].[user_id], permission
-FROM (
-		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, 'ADMINISTER' AS permission)
-		permissions
-		JOIN [guacamole].[user] ON permissions.username = [guacamole].[user].[username]
-		JOIN [guacamole].[user] affected ON permissions.affected_username = affected.username;
+    SELECT 'guacadmin' AS username, 'CREATE_CONNECTION' AS permission
+        UNION SELECT 'guacadmin' AS username, 'CREATE_CONNECTION_GROUP' AS permission
+        UNION SELECT 'guacadmin' AS username, 'CREATE_SHARING_PROFILE' AS permission
+        UNION SELECT 'guacadmin' AS username, 'CREATE_USER' AS permission
+        UNION SELECT 'guacadmin' AS username, 'ADMINISTER' AS permission)
+    permissions
+    JOIN [guacamole].[user] ON permissions.username = [guacamole].[user].[username];
+GO
\ No newline at end of file


[15/28] incubator-guacamole-client git commit: GUACMOLE-363: Correct null pointer exception in String comparison; fix style issues.

Posted by mj...@apache.org.
GUACMOLE-363: Correct null pointer exception in String comparison; fix style issues.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/77552413
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/77552413
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/77552413

Branch: refs/heads/master
Commit: 7755241322c82f4131785af3e48235be9e890010
Parents: 7330190
Author: Nick Couchman <vn...@apache.org>
Authored: Thu Sep 7 22:31:37 2017 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Thu Sep 28 07:00:52 2017 -0400

----------------------------------------------------------------------
 .../auth/sqlserver/SQLServerAuthenticationProviderModule.java    | 4 ++--
 .../apache/guacamole/auth/sqlserver/SQLServerEnvironment.java    | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/77552413/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java
index 22c5434..f514e41 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java
@@ -87,9 +87,9 @@ public class SQLServerAuthenticationProviderModule implements Module {
         // Look at the property to choose the correct driver.
         if (sqlServerDriver.equals(SQLServerEnvironment.SQLSERVER_DRIVER_JTDS))
             JdbcHelper.SQL_Server_jTDS.configure(binder);
-        else if(sqlServerDriver.equals(SQLServerEnvironment.SQLSERVER_DRIVER_DATADIRECT))
+        else if (sqlServerDriver.equals(SQLServerEnvironment.SQLSERVER_DRIVER_DATADIRECT))
             JdbcHelper.SQL_Server_DataDirect.configure(binder);
-        else if(sqlServerDriver.equals(SQLServerEnvironment.SQLSERVER_DRIVER_MS))
+        else if (sqlServerDriver.equals(SQLServerEnvironment.SQLSERVER_DRIVER_MS))
             JdbcHelper.SQL_Server_MS_Driver.configure(binder);
         else
             JdbcHelper.SQL_Server_2005_MS_Driver.configure(binder);

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/77552413/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java
index 2110b0c..4d3faba 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java
@@ -195,7 +195,7 @@ public class SQLServerEnvironment extends JDBCEnvironment {
 
         // Check driver property is one of the acceptable values.
         String driver = getProperty(SQLServerGuacamoleProperties.SQLSERVER_DRIVER);
-        if (!(driver.equals(SQLSERVER_DRIVER_JTDS) ||
+        if (driver != null && !(driver.equals(SQLSERVER_DRIVER_JTDS) ||
                                 driver.equals(SQLSERVER_DRIVER_DATADIRECT) ||
                                 driver.equals(SQLSERVER_DRIVER_MS) ||
                                 driver.equals(SQLSERVER_DRIVER_MS_2005)))


[04/28] incubator-guacamole-client git commit: GUACAMOLE-363: Remove unused properties.

Posted by mj...@apache.org.
GUACAMOLE-363: Remove unused properties.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/5ef7d116
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/5ef7d116
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/5ef7d116

Branch: refs/heads/master
Commit: 5ef7d116dec53f3842f51669af94f0fba6d9c6ee
Parents: 34711b7
Author: Nick Couchman <vn...@apache.org>
Authored: Wed Sep 27 09:23:56 2017 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Thu Sep 28 07:00:52 2017 -0400

----------------------------------------------------------------------
 .../sqlserver/SQLServerGuacamoleProperties.java | 26 --------------------
 1 file changed, 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/5ef7d116/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerGuacamoleProperties.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerGuacamoleProperties.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerGuacamoleProperties.java
index 8aa02b3..4563599 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerGuacamoleProperties.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerGuacamoleProperties.java
@@ -106,32 +106,6 @@ public class SQLServerGuacamoleProperties {
     };
 
     /**
-     * Whether or not multiple users accessing the same connection at the same
-     * time should be disallowed.
-     */
-    public static final BooleanGuacamoleProperty
-            SQLSERVER_DISALLOW_SIMULTANEOUS_CONNECTIONS =
-            new BooleanGuacamoleProperty() {
-
-        @Override
-        public String getName() { return "sqlserver-disallow-simultaneous-connections"; }
-
-    };
-
-    /**
-     * Whether or not the same user accessing the same connection or connection
-     * group at the same time should be disallowed.
-     */
-    public static final BooleanGuacamoleProperty
-            SQLSERVER_DISALLOW_DUPLICATE_CONNECTIONS =
-            new BooleanGuacamoleProperty() {
-
-        @Override
-        public String getName() { return "sqlserver-disallow-duplicate-connections"; }
-
-    };
-
-    /**
      * The maximum number of concurrent connections to allow overall. Zero
      * denotes unlimited.
      */


[16/28] incubator-guacamole-client git commit: GUACAMOLE-363: Add semicolons to SQL code to make it ANSI SQL standard.

Posted by mj...@apache.org.
GUACAMOLE-363: Add semicolons to SQL code to make it ANSI SQL standard.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/2eb48895
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/2eb48895
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/2eb48895

Branch: refs/heads/master
Commit: 2eb48895bf988a72049e581e7c3f889cc893d4b3
Parents: 9d38306
Author: Nick Couchman <vn...@apache.org>
Authored: Tue Aug 29 21:15:29 2017 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Thu Sep 28 07:00:52 2017 -0400

----------------------------------------------------------------------
 .../schema/001-create-schema.sql                | 208 +++++++++----------
 .../schema/002-create-admin-user.sql            |   2 +-
 2 files changed, 105 insertions(+), 105 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/2eb48895/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
index 95382ef..80e47c1 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
@@ -22,8 +22,8 @@
  */
 CREATE RULE [dbo].[guacamole_permission_list] 
     AS
-    @list IN ('READ','UPDATE','DELETE','ADMINISTER')
-GO
+    @list IN ('READ','UPDATE','DELETE','ADMINISTER');
+GO;
 
 /**
  * List for system permission data type.
@@ -34,25 +34,25 @@ CREATE RULE [dbo].[guacamole_system_permission_list]
         'CREATE_CONNECTION_GROUP',
         'CREATE_SHARING_PROFILE',
         'CREATE_USER',
-        'ADMINISTER')
-GO
+        'ADMINISTER');
+GO;
 
 /**
  * The permission data type.
  */
-CREATE TYPE [dbo].[guacamole_permission] FROM [nvarchar](10) NOT NULL
+CREATE TYPE [dbo].[guacamole_permission] FROM [nvarchar](10) NOT NULL;
 
 /**
  * The system permission data type.
  */
-CREATE TYPE [dbo].[guacamole_system_permission] FROM [nvarchar](32) NOT NULL
-GO
+CREATE TYPE [dbo].[guacamole_system_permission] FROM [nvarchar](32) NOT NULL;
+GO;
 
 /**
  * The connection_group table stores organizational and balancing groups.
  */
-SET ANSI_NULLS ON
-SET QUOTED_IDENTIFIER ON
+SET ANSI_NULLS ON;
+SET QUOTED_IDENTIFIER ON;
 CREATE TABLE [dbo].[guacamole_connection_group](
     [connection_group_id] [int] IDENTITY(1,1) NOT NULL,
     [parent_id] [int] NULL,
@@ -70,36 +70,36 @@ CREATE TABLE [dbo].[guacamole_connection_group](
             ALLOW_ROW_LOCKS = ON,
             ALLOW_PAGE_LOCKS = ON)
        ON [PRIMARY]
-) ON [PRIMARY]
+) ON [PRIMARY];
 
 /**
  * Foreign keys for connection_group table.
  */
 ALTER TABLE [dbo].[guacamole_connection_group]
     WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_group_connection_group_id] FOREIGN KEY([parent_id])
-    REFERENCES [dbo].[guacamole_connection_group] ([connection_group_id])
+    REFERENCES [dbo].[guacamole_connection_group] ([connection_group_id]);
 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 [dbo].[guacamole_connection_group]
     WITH CHECK ADD CONSTRAINT [CK_guacamole_connection_group_type] 
-    CHECK (([type]='BALANCING' OR [type]='ORGANIZATIONAL'))
+    CHECK (([type]='BALANCING' OR [type]='ORGANIZATIONAL'));
 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.
  */
 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 [dbo].[guacamole_connection_group]
-    ADD CONSTRAINT [DF_guacamole_connection_group_enable_session_affinity] DEFAULT ((0)) FOR [enable_session_affinity]
-GO
+    ADD CONSTRAINT [DF_guacamole_connection_group_enable_session_affinity] DEFAULT ((0)) FOR [enable_session_affinity];
+GO;
 
 /**
  * The connection table, for storing connections and attributes.
  */
-SET ANSI_NULLS ON
-SET QUOTED_IDENTIFIER ON
+SET ANSI_NULLS ON;
+SET QUOTED_IDENTIFIER ON;
 CREATE TABLE [dbo].[guacamole_connection](
     [connection_id] [int] IDENTITY(1,1) NOT NULL,
     [connection_name] [nvarchar](128) NOT NULL,
@@ -121,27 +121,27 @@ CREATE TABLE [dbo].[guacamole_connection](
             ALLOW_ROW_LOCKS = ON,
             ALLOW_PAGE_LOCKS = ON)
         ON [PRIMARY]
-) ON [PRIMARY]
+) ON [PRIMARY];
 
 ALTER TABLE [dbo].[guacamole_connection]
     WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_connection_group] FOREIGN KEY([parent_id])
-REFERENCES [dbo].[guacamole_connection_group] ([connection_group_id])
+    REFERENCES [dbo].[guacamole_connection_group] ([connection_group_id]);
 ALTER TABLE [dbo].[guacamole_connection]
-    CHECK CONSTRAINT [FK_guacamole_connection_connection_group]
+    CHECK CONSTRAINT [FK_guacamole_connection_connection_group];
 ALTER TABLE [dbo].[guacamole_connection]
     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 [dbo].[guacamole_connection]
-    CHECK CONSTRAINT [CK_proxy_encryption_method]
+    CHECK CONSTRAINT [CK_proxy_encryption_method];
 ALTER TABLE [dbo].[guacamole_connection]
-    ADD CONSTRAINT [DF_guacamole_connection_failover_only] DEFAULT ((0)) FOR [failover_only]
-GO
+    ADD CONSTRAINT [DF_guacamole_connection_failover_only] DEFAULT ((0)) FOR [failover_only];
+GO;
 
 /**
  * The user table stores user accounts, passwords, and properties.
  */
-SET ANSI_NULLS ON
-SET QUOTED_IDENTIFIER ON
+SET ANSI_NULLS ON;
+SET QUOTED_IDENTIFIER ON;
 CREATE TABLE [dbo].[guacamole_user](
     [user_id] [int] IDENTITY(1,1) NOT NULL,
     [username] [nvarchar](128) NOT NULL,
@@ -168,23 +168,23 @@ CREATE TABLE [dbo].[guacamole_user](
             ALLOW_ROW_LOCKS = ON,
             ALLOW_PAGE_LOCKS = ON)
         ON [PRIMARY]
-) ON [PRIMARY]
+) ON [PRIMARY];
 
 /**
  * Defaults for user table
  */
 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 [dbo].[guacamole_user]
-    ADD CONSTRAINT [DF_guacamole_user_expired] DEFAULT ((0)) FOR [expired]
-GO
+    ADD CONSTRAINT [DF_guacamole_user_expired] DEFAULT ((0)) FOR [expired];
+GO;
 
 /**
  * The sharing_profile table stores profiles that allow
  * connections to be shared amongst multiple users.
  */
-SET ANSI_NULLS ON
-SET QUOTED_IDENTIFIER ON
+SET ANSI_NULLS ON;
+SET QUOTED_IDENTIFIER ON;
 CREATE TABLE [dbo].[guacamole_sharing_profile](
     [sharing_profile_id] [int] IDENTITY(1,1) NOT NULL,
     [sharing_profile_name] [nvarchar](128) NOT NULL,
@@ -198,7 +198,7 @@ CREATE TABLE [dbo].[guacamole_sharing_profile](
             ALLOW_ROW_LOCKS = ON,
             ALLOW_PAGE_LOCKS = ON)
         ON [PRIMARY]
-) ON [PRIMARY]
+) ON [PRIMARY];
 
 /**
  * Foreign keys for sharing_profile table.
@@ -207,17 +207,17 @@ ALTER TABLE [dbo].[guacamole_sharing_profile]
     WITH CHECK ADD CONSTRAINT [FK_guacamole_sharing_profile_connection] FOREIGN KEY([primary_connection_id])
     REFERENCES [dbo].[guacamole_connection] ([connection_id])
         ON UPDATE CASCADE
-        ON DELETE CASCADE
+        ON DELETE CASCADE;
 ALTER TABLE [dbo].[guacamole_sharing_profile]
-    CHECK CONSTRAINT [FK_guacamole_sharing_profile_connection]
-GO
+    CHECK CONSTRAINT [FK_guacamole_sharing_profile_connection];
+GO;
 
 /**
  * The connection_parameter table stores parameters for
  * connection objects.
  */
-SET ANSI_NULLS ON
-SET QUOTED_IDENTIFIER ON
+SET ANSI_NULLS ON;
+SET QUOTED_IDENTIFIER ON;
 CREATE TABLE [dbo].[guacamole_connection_parameter](
     [connection_id] [int] NOT NULL,
     [parameter_name] [nvarchar](128) NOT NULL,
@@ -231,7 +231,7 @@ CREATE TABLE [dbo].[guacamole_connection_parameter](
             ALLOW_ROW_LOCKS = ON,
             ALLOW_PAGE_LOCKS = ON)
         ON [PRIMARY]
-) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
+) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY];
 
 /**
  * Foreign keys for the connection_parameter table.
@@ -240,17 +240,17 @@ ALTER TABLE [dbo].[guacamole_connection_parameter]
     WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_parameter_connection] FOREIGN KEY([connection_id])
     REFERENCES [dbo].[guacamole_connection] ([connection_id])
         ON UPDATE CASCADE
-        ON DELETE CASCADE
+        ON DELETE CASCADE;
 ALTER TABLE [dbo].[guacamole_connection_parameter]
-    CHECK CONSTRAINT [FK_guacamole_connection_parameter_connection]
-GO
+    CHECK CONSTRAINT [FK_guacamole_connection_parameter_connection];
+GO;
 
 /**
  * The sharing_profile_parameter table stores parameters
  * for sharing_profile objects.
  */
-SET ANSI_NULLS ON
-SET QUOTED_IDENTIFIER ON
+SET ANSI_NULLS ON;
+SET QUOTED_IDENTIFIER ON;
 CREATE TABLE [dbo].[guacamole_sharing_profile_parameter](
     [sharing_profile_id] [int] NOT NULL,
     [parameter_name] [nvarchar](128) NOT NULL,
@@ -264,7 +264,7 @@ CREATE TABLE [dbo].[guacamole_sharing_profile_parameter](
             ALLOW_ROW_LOCKS = ON,
             ALLOW_PAGE_LOCKS = ON)
         ON [PRIMARY]
-) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
+) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY];
 
 /**
  * Foreign keys for the sharing_profile_parameter
@@ -274,17 +274,17 @@ ALTER TABLE [dbo].[guacamole_sharing_profile_parameter]
     WITH CHECK ADD CONSTRAINT [FK_guacamole_sharing_profile_parameter_sharing_profile] FOREIGN KEY([sharing_profile_id])
     REFERENCES [dbo].[guacamole_sharing_profile] ([sharing_profile_id])
         ON UPDATE CASCADE
-        ON DELETE CASCADE
+        ON DELETE CASCADE;
 ALTER TABLE [dbo].[guacamole_sharing_profile_parameter]
-    CHECK CONSTRAINT [FK_guacamole_sharing_profile_parameter_sharing_profile]
-GO
+    CHECK CONSTRAINT [FK_guacamole_sharing_profile_parameter_sharing_profile];
+GO;
 
 /**
  * The connection_permission table stores permission
  * mappings for connection objects.
  */
-SET ANSI_NULLS ON
-SET QUOTED_IDENTIFIER ON
+SET ANSI_NULLS ON;
+SET QUOTED_IDENTIFIER ON;
 CREATE TABLE [dbo].[guacamole_connection_permission](
     [user_id] [int] NOT NULL,
     [connection_id] [int] NOT NULL,
@@ -298,7 +298,7 @@ CREATE TABLE [dbo].[guacamole_connection_permission](
             ALLOW_ROW_LOCKS = ON,
             ALLOW_PAGE_LOCKS = ON)
         ON [PRIMARY]
-) ON [PRIMARY]
+) ON [PRIMARY];
 
 /**
  * Foreign keys for the connection_permission table.
@@ -307,24 +307,24 @@ ALTER TABLE [dbo].[guacamole_connection_permission]
     WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_permission_connection1] FOREIGN KEY([connection_id])
     REFERENCES [dbo].[guacamole_connection] ([connection_id])
         ON UPDATE CASCADE
-        ON DELETE CASCADE
+        ON DELETE CASCADE;
 ALTER TABLE [dbo].[guacamole_connection_permission]
-    CHECK CONSTRAINT [FK_guacamole_connection_permission_connection1]
+    CHECK CONSTRAINT [FK_guacamole_connection_permission_connection1];
 ALTER TABLE [dbo].[guacamole_connection_permission]
     WITH CHECK ADD  CONSTRAINT [FK_guacamole_connection_permission_user1] FOREIGN KEY([user_id])
     REFERENCES [dbo].[guacamole_user] ([user_id])
         ON UPDATE CASCADE
-        ON DELETE CASCADE
+        ON DELETE CASCADE;
 ALTER TABLE [dbo].[guacamole_connection_permission]
-    CHECK CONSTRAINT [FK_guacamole_connection_permission_user1]
-GO
+    CHECK CONSTRAINT [FK_guacamole_connection_permission_user1];
+GO;
 
 /**
  * The connection_group_permission table stores permission mappings for
  * connection_group objects.
  */
-SET ANSI_NULLS ON
-SET QUOTED_IDENTIFIER ON
+SET ANSI_NULLS ON;
+SET QUOTED_IDENTIFIER ON;
 CREATE TABLE [dbo].[guacamole_connection_group_permission](
     [user_id] [int] NOT NULL,
     [connection_group_id] [int] NOT NULL,
@@ -338,7 +338,7 @@ CREATE TABLE [dbo].[guacamole_connection_group_permission](
             ALLOW_ROW_LOCKS = ON,
             ALLOW_PAGE_LOCKS = ON) 
         ON [PRIMARY]
-) ON [PRIMARY]
+) ON [PRIMARY];
 
 /**
  * Foreign keys for the connection_group_permission table.
@@ -347,24 +347,24 @@ ALTER TABLE [dbo].[guacamole_connection_group_permission]
     WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_group_permission_connection_group] FOREIGN KEY([connection_group_id])
     REFERENCES [dbo].[guacamole_connection_group] ([connection_group_id])
         ON UPDATE CASCADE
-        ON DELETE CASCADE
+        ON DELETE CASCADE;
 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 [dbo].[guacamole_connection_group_permission]
     WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_group_permission_user] FOREIGN KEY([user_id])
     REFERENCES [dbo].[guacamole_user] ([user_id])
         ON UPDATE CASCADE
-        ON DELETE CASCADE
+        ON DELETE CASCADE;
 ALTER TABLE [dbo].[guacamole_connection_group_permission]
-    CHECK CONSTRAINT [FK_guacamole_connection_group_permission_user]
-GO
+    CHECK CONSTRAINT [FK_guacamole_connection_group_permission_user];
+GO;
 
 /**
  * The sharing_profile_permission table stores permission
  * mappings for sharing_profile objects.
  */
-SET ANSI_NULLS ON
-SET QUOTED_IDENTIFIER ON
+SET ANSI_NULLS ON;
+SET QUOTED_IDENTIFIER ON;
 CREATE TABLE [dbo].[guacamole_sharing_profile_permission](
     [user_id] [int] NOT NULL,
     [sharing_profile_id] [int] NOT NULL,
@@ -378,7 +378,7 @@ CREATE TABLE [dbo].[guacamole_sharing_profile_permission](
             ALLOW_ROW_LOCKS = ON,
             ALLOW_PAGE_LOCKS = ON)
         ON [PRIMARY]
-) ON [PRIMARY]
+) ON [PRIMARY];
 
 /**
  * Foreign keys for the sharing_profile_permission table.
@@ -387,24 +387,24 @@ ALTER TABLE [dbo].[guacamole_sharing_profile_permission]
     WITH CHECK ADD CONSTRAINT [FK_guacamole_sharing_profile_permission_sharing_profile] FOREIGN KEY([sharing_profile_id])
     REFERENCES [dbo].[guacamole_sharing_profile] ([sharing_profile_id])
         ON UPDATE CASCADE
-        ON DELETE CASCADE
+        ON DELETE CASCADE;
 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 [dbo].[guacamole_sharing_profile_permission]
     WITH CHECK ADD  CONSTRAINT [FK_guacamole_sharing_profile_permission_user] FOREIGN KEY([user_id])
     REFERENCES [dbo].[guacamole_user] ([user_id])
         ON UPDATE CASCADE
-        ON DELETE CASCADE
+        ON DELETE CASCADE;
 ALTER TABLE [dbo].[guacamole_sharing_profile_permission]
-    CHECK CONSTRAINT [FK_guacamole_sharing_profile_permission_user]
-GO
+    CHECK CONSTRAINT [FK_guacamole_sharing_profile_permission_user];
+GO;
 
 /**
  * The system_permission table stores permission mappings
  * for system-level operations.
  */
-SET ANSI_NULLS ON
-SET QUOTED_IDENTIFIER ON
+SET ANSI_NULLS ON;
+SET QUOTED_IDENTIFIER ON;
 CREATE TABLE [dbo].[guacamole_system_permission](
     [user_id] [int] NOT NULL,
     [permission] [dbo].[guacamole_system_permission] NOT NULL,
@@ -417,7 +417,7 @@ CREATE TABLE [dbo].[guacamole_system_permission](
             ALLOW_ROW_LOCKS = ON,
             ALLOW_PAGE_LOCKS = ON)
         ON [PRIMARY]
-) ON [PRIMARY]
+) ON [PRIMARY];
 
 /**
  * Foreign keys for system_permission table.
@@ -426,17 +426,17 @@ ALTER TABLE [dbo].[guacamole_system_permission]
     WITH CHECK ADD CONSTRAINT [FK_guacamole_system_permission_user] FOREIGN KEY([user_id])
     REFERENCES [dbo].[guacamole_user] ([user_id])
         ON UPDATE CASCADE
-        ON DELETE CASCADE
+        ON DELETE CASCADE;
 ALTER TABLE [dbo].[guacamole_system_permission]
-    CHECK CONSTRAINT [FK_guacamole_system_permission_user]
-GO
+    CHECK CONSTRAINT [FK_guacamole_system_permission_user];
+GO;
 
 /**
  * The user_permission table stores permission mappings
  * for users to other users.
  */
-SET ANSI_NULLS ON
-SET QUOTED_IDENTIFIER ON
+SET ANSI_NULLS ON;
+SET QUOTED_IDENTIFIER ON;
 CREATE TABLE [dbo].[guacamole_user_permission](
     [user_id] [int] NOT NULL,
     [affected_user_id] [int] NOT NULL,
@@ -450,7 +450,7 @@ CREATE TABLE [dbo].[guacamole_user_permission](
             ALLOW_ROW_LOCKS = ON,
             ALLOW_PAGE_LOCKS = ON)
         ON [PRIMARY]
-) ON [PRIMARY]
+) ON [PRIMARY];
 
 /**
  * Foreign keys for user_permission table.
@@ -459,22 +459,22 @@ ALTER TABLE [dbo].[guacamole_user_permission]
     WITH CHECK ADD CONSTRAINT [FK_guacamole_user_permission_user] FOREIGN KEY([user_id])
     REFERENCES [dbo].[guacamole_user] ([user_id])
         ON UPDATE CASCADE
-        ON DELETE CASCADE
+        ON DELETE CASCADE;
 ALTER TABLE [dbo].[guacamole_user_permission]
-    CHECK CONSTRAINT [FK_guacamole_user_permission_user]
+    CHECK CONSTRAINT [FK_guacamole_user_permission_user];
 ALTER TABLE [dbo].[guacamole_user_permission]
     WITH CHECK ADD CONSTRAINT [FK_guacamole_user_permission_user1] FOREIGN KEY([affected_user_id])
-    REFERENCES [dbo].[guacamole_user] ([user_id])
+    REFERENCES [dbo].[guacamole_user] ([user_id]);
 ALTER TABLE [dbo].[guacamole_user_permission]
-    CHECK CONSTRAINT [FK_guacamole_user_permission_user1]
-GO
+    CHECK CONSTRAINT [FK_guacamole_user_permission_user1];
+GO;
 
 /**
  * The connection_history table stores records for historical
  * connections.
  */
-SET ANSI_NULLS ON
-SET QUOTED_IDENTIFIER ON
+SET ANSI_NULLS ON;
+SET QUOTED_IDENTIFIER ON;
 CREATE TABLE [dbo].[guacamole_connection_history](
     [history_id] [int] IDENTITY(1,1) NOT NULL,
     [user_id] [int] NULL,
@@ -495,7 +495,7 @@ CREATE TABLE [dbo].[guacamole_connection_history](
             ALLOW_ROW_LOCKS = ON,
             ALLOW_PAGE_LOCKS = ON)
         ON [PRIMARY]
-) ON [PRIMARY]
+) ON [PRIMARY];
 
 /**
  * Foreign keys for connection_history table
@@ -504,30 +504,30 @@ ALTER TABLE [dbo].[guacamole_connection_history]
     WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_history_connection] FOREIGN KEY([connection_id])
     REFERENCES [dbo].[guacamole_connection] ([connection_id])
         ON UPDATE CASCADE
-        ON DELETE SET NULL
+        ON DELETE SET NULL;
 ALTER TABLE [dbo].[guacamole_connection_history]
-    CHECK CONSTRAINT [FK_guacamole_connection_history_connection]
+    CHECK CONSTRAINT [FK_guacamole_connection_history_connection];
 ALTER TABLE [dbo].[guacamole_connection_history]
     WITH CHECK ADD  CONSTRAINT [FK_guacamole_connection_history_sharing_profile] FOREIGN KEY([sharing_profile_id])
-    REFERENCES [dbo].[guacamole_sharing_profile] ([sharing_profile_id])
+    REFERENCES [dbo].[guacamole_sharing_profile] ([sharing_profile_id]);
 ALTER TABLE [dbo].[guacamole_connection_history]
-    CHECK CONSTRAINT [FK_guacamole_connection_history_sharing_profile]
+    CHECK CONSTRAINT [FK_guacamole_connection_history_sharing_profile];
 ALTER TABLE [dbo].[guacamole_connection_history]
     WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_history_user] FOREIGN KEY([user_id])
     REFERENCES [dbo].[guacamole_user] ([user_id])
         ON UPDATE CASCADE
-        ON DELETE SET NULL
+        ON DELETE SET NULL;
 ALTER TABLE [dbo].[guacamole_connection_history]
-    CHECK CONSTRAINT [FK_guacamole_connection_history_user]
-GO
+    CHECK CONSTRAINT [FK_guacamole_connection_history_user];
+GO;
 
 /**
  * The user_password_history table stores password history
  * for users, allowing for enforcing rules associated with
  * reuse of passwords.
  */
-SET ANSI_NULLS ON
-SET QUOTED_IDENTIFIER ON
+SET ANSI_NULLS ON;
+SET QUOTED_IDENTIFIER ON;
 CREATE TABLE [dbo].[guacamole_user_password_history](
     [password_history_id] [int] IDENTITY(1,1) NOT NULL,
     [user_id] [int] NOT NULL,
@@ -543,7 +543,7 @@ CREATE TABLE [dbo].[guacamole_user_password_history](
             ALLOW_ROW_LOCKS = ON,
             ALLOW_PAGE_LOCKS = ON)
         ON [PRIMARY]
-) ON [PRIMARY]
+) ON [PRIMARY];
 
 /**
  * Foreign keys for user_password_history table
@@ -552,7 +552,7 @@ ALTER TABLE [dbo].[guacamole_user_password_history]
     WITH CHECK ADD  CONSTRAINT [FK_guacamole_user_password_history_user] FOREIGN KEY([user_id])
     REFERENCES [dbo].[guacamole_user] ([user_id])
         ON UPDATE CASCADE
-        ON DELETE CASCADE
+        ON DELETE CASCADE;
 ALTER TABLE [dbo].[guacamole_user_password_history]
-    CHECK CONSTRAINT [FK_guacamole_user_password_history_user]
-GO
+    CHECK CONSTRAINT [FK_guacamole_user_password_history_user];
+GO;

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/2eb48895/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
index c6e6d9b..f7d5b45 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
@@ -43,4 +43,4 @@ FROM (
         UNION SELECT 'guacadmin' AS username, 'ADMINISTER' AS permission)
     permissions
     JOIN [dbo].[guacamole_user] ON permissions.username = [dbo].[guacamole_user].[username];
-GO
+GO;


[08/28] incubator-guacamole-client git commit: GUACAMOLE-363: Remove explicit schema, relying on account default schema.

Posted by mj...@apache.org.
GUACAMOLE-363: Remove explicit schema, relying on account default schema.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/73301901
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/73301901
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/73301901

Branch: refs/heads/master
Commit: 73301901ec8b2a856f9c8066fd759db41216d66c
Parents: b72dba6
Author: Nick Couchman <vn...@apache.org>
Authored: Thu Sep 7 22:30:01 2017 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Thu Sep 28 07:00:52 2017 -0400

----------------------------------------------------------------------
 .../schema/001-create-schema.sql                | 170 +++++++++----------
 .../schema/002-create-admin-user.sql            |  14 +-
 .../auth/jdbc/connection/ConnectionMapper.xml   |  38 ++---
 .../connection/ConnectionParameterMapper.xml    |   6 +-
 .../jdbc/connection/ConnectionRecordMapper.xml  | 110 ++++++------
 .../connectiongroup/ConnectionGroupMapper.xml   |  46 ++---
 .../ConnectionGroupPermissionMapper.xml         |  30 ++--
 .../permission/ConnectionPermissionMapper.xml   |  30 ++--
 .../SharingProfilePermissionMapper.xml          |  30 ++--
 .../jdbc/permission/SystemPermissionMapper.xml  |  26 +--
 .../jdbc/permission/UserPermissionMapper.xml    |  52 +++---
 .../sharingprofile/SharingProfileMapper.xml     |  24 +--
 .../SharingProfileParameterMapper.xml           |   6 +-
 .../auth/jdbc/user/PasswordRecordMapper.xml     |  22 +--
 .../guacamole/auth/jdbc/user/UserMapper.xml     |  26 +--
 15 files changed, 315 insertions(+), 315 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/73301901/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
index 80e47c1..1a1e324 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
@@ -20,7 +20,7 @@
 /**
  * List for permission data type.
  */
-CREATE RULE [dbo].[guacamole_permission_list] 
+CREATE RULE [guacamole_permission_list] 
     AS
     @list IN ('READ','UPDATE','DELETE','ADMINISTER');
 GO;
@@ -28,7 +28,7 @@ GO;
 /**
  * List for system permission data type.
  */
-CREATE RULE [dbo].[guacamole_system_permission_list] 
+CREATE RULE [guacamole_system_permission_list] 
     AS
     @list IN ('CREATE_CONNECTION',
         'CREATE_CONNECTION_GROUP',
@@ -40,12 +40,12 @@ GO;
 /**
  * The permission data type.
  */
-CREATE TYPE [dbo].[guacamole_permission] FROM [nvarchar](10) NOT NULL;
+CREATE TYPE [guacamole_permission] FROM [nvarchar](10) NOT NULL;
 
 /**
  * The system permission data type.
  */
-CREATE TYPE [dbo].[guacamole_system_permission] FROM [nvarchar](32) NOT NULL;
+CREATE TYPE [guacamole_system_permission] FROM [nvarchar](32) NOT NULL;
 GO;
 
 /**
@@ -53,7 +53,7 @@ GO;
  */
 SET ANSI_NULLS ON;
 SET QUOTED_IDENTIFIER ON;
-CREATE TABLE [dbo].[guacamole_connection_group](
+CREATE TABLE [guacamole_connection_group](
     [connection_group_id] [int] IDENTITY(1,1) NOT NULL,
     [parent_id] [int] NULL,
     [connection_group_name] [nvarchar](128) NOT NULL,
@@ -75,23 +75,23 @@ CREATE TABLE [dbo].[guacamole_connection_group](
 /**
  * Foreign keys for connection_group table.
  */
-ALTER TABLE [dbo].[guacamole_connection_group]
+ALTER TABLE [guacamole_connection_group]
     WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_group_connection_group_id] FOREIGN KEY([parent_id])
-    REFERENCES [dbo].[guacamole_connection_group] ([connection_group_id]);
-ALTER TABLE [dbo].[guacamole_connection_group]
+    REFERENCES [guacamole_connection_group] ([connection_group_id]);
+ALTER TABLE [guacamole_connection_group]
     CHECK CONSTRAINT [FK_guacamole_connection_group_connection_group_id];
-ALTER TABLE [dbo].[guacamole_connection_group]
+ALTER TABLE [guacamole_connection_group]
     WITH CHECK ADD CONSTRAINT [CK_guacamole_connection_group_type] 
     CHECK (([type]='BALANCING' OR [type]='ORGANIZATIONAL'));
-ALTER TABLE [dbo].[guacamole_connection_group]
+ALTER TABLE [guacamole_connection_group]
     CHECK CONSTRAINT [CK_guacamole_connection_group_type];
 
 /**
  * Default values for connection_group table.
  */
-ALTER TABLE [dbo].[guacamole_connection_group]
+ALTER TABLE [guacamole_connection_group]
     ADD CONSTRAINT [DF_guacamole_connection_group_type] DEFAULT (N'ORGANIZATIONAL') FOR [type];
-ALTER TABLE [dbo].[guacamole_connection_group]
+ALTER TABLE [guacamole_connection_group]
     ADD CONSTRAINT [DF_guacamole_connection_group_enable_session_affinity] DEFAULT ((0)) FOR [enable_session_affinity];
 GO;
 
@@ -100,7 +100,7 @@ GO;
  */
 SET ANSI_NULLS ON;
 SET QUOTED_IDENTIFIER ON;
-CREATE TABLE [dbo].[guacamole_connection](
+CREATE TABLE [guacamole_connection](
     [connection_id] [int] IDENTITY(1,1) NOT NULL,
     [connection_name] [nvarchar](128) NOT NULL,
     [parent_id] [int] NULL,
@@ -123,17 +123,17 @@ CREATE TABLE [dbo].[guacamole_connection](
         ON [PRIMARY]
 ) ON [PRIMARY];
 
-ALTER TABLE [dbo].[guacamole_connection]
+ALTER TABLE [guacamole_connection]
     WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_connection_group] FOREIGN KEY([parent_id])
-    REFERENCES [dbo].[guacamole_connection_group] ([connection_group_id]);
-ALTER TABLE [dbo].[guacamole_connection]
+    REFERENCES [guacamole_connection_group] ([connection_group_id]);
+ALTER TABLE [guacamole_connection]
     CHECK CONSTRAINT [FK_guacamole_connection_connection_group];
-ALTER TABLE [dbo].[guacamole_connection]
+ALTER TABLE [guacamole_connection]
     WITH CHECK ADD CONSTRAINT [CK_proxy_encryption_method]
     CHECK  (([proxy_encryption_method]='SSL' OR [proxy_encryption_method]='NONE'));
-ALTER TABLE [dbo].[guacamole_connection]
+ALTER TABLE [guacamole_connection]
     CHECK CONSTRAINT [CK_proxy_encryption_method];
-ALTER TABLE [dbo].[guacamole_connection]
+ALTER TABLE [guacamole_connection]
     ADD CONSTRAINT [DF_guacamole_connection_failover_only] DEFAULT ((0)) FOR [failover_only];
 GO;
 
@@ -142,7 +142,7 @@ GO;
  */
 SET ANSI_NULLS ON;
 SET QUOTED_IDENTIFIER ON;
-CREATE TABLE [dbo].[guacamole_user](
+CREATE TABLE [guacamole_user](
     [user_id] [int] IDENTITY(1,1) NOT NULL,
     [username] [nvarchar](128) NOT NULL,
     [password_hash] [binary](32) NOT NULL,
@@ -173,9 +173,9 @@ CREATE TABLE [dbo].[guacamole_user](
 /**
  * Defaults for user table
  */
-ALTER TABLE [dbo].[guacamole_user]
+ALTER TABLE [guacamole_user]
     ADD CONSTRAINT [DF_guacamole_user_disabled] DEFAULT ((0)) FOR [disabled];
-ALTER TABLE [dbo].[guacamole_user]
+ALTER TABLE [guacamole_user]
     ADD CONSTRAINT [DF_guacamole_user_expired] DEFAULT ((0)) FOR [expired];
 GO;
 
@@ -185,7 +185,7 @@ GO;
  */
 SET ANSI_NULLS ON;
 SET QUOTED_IDENTIFIER ON;
-CREATE TABLE [dbo].[guacamole_sharing_profile](
+CREATE TABLE [guacamole_sharing_profile](
     [sharing_profile_id] [int] IDENTITY(1,1) NOT NULL,
     [sharing_profile_name] [nvarchar](128) NOT NULL,
     [primary_connection_id] [int] NOT NULL,
@@ -203,12 +203,12 @@ CREATE TABLE [dbo].[guacamole_sharing_profile](
 /**
  * Foreign keys for sharing_profile table.
  */
-ALTER TABLE [dbo].[guacamole_sharing_profile]
+ALTER TABLE [guacamole_sharing_profile]
     WITH CHECK ADD CONSTRAINT [FK_guacamole_sharing_profile_connection] FOREIGN KEY([primary_connection_id])
-    REFERENCES [dbo].[guacamole_connection] ([connection_id])
+    REFERENCES [guacamole_connection] ([connection_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE;
-ALTER TABLE [dbo].[guacamole_sharing_profile]
+ALTER TABLE [guacamole_sharing_profile]
     CHECK CONSTRAINT [FK_guacamole_sharing_profile_connection];
 GO;
 
@@ -218,7 +218,7 @@ GO;
  */
 SET ANSI_NULLS ON;
 SET QUOTED_IDENTIFIER ON;
-CREATE TABLE [dbo].[guacamole_connection_parameter](
+CREATE TABLE [guacamole_connection_parameter](
     [connection_id] [int] NOT NULL,
     [parameter_name] [nvarchar](128) NOT NULL,
     [parameter_value] [nvarchar](max) NOT NULL,
@@ -236,12 +236,12 @@ CREATE TABLE [dbo].[guacamole_connection_parameter](
 /**
  * Foreign keys for the connection_parameter table.
  */
-ALTER TABLE [dbo].[guacamole_connection_parameter]
+ALTER TABLE [guacamole_connection_parameter]
     WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_parameter_connection] FOREIGN KEY([connection_id])
-    REFERENCES [dbo].[guacamole_connection] ([connection_id])
+    REFERENCES [guacamole_connection] ([connection_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE;
-ALTER TABLE [dbo].[guacamole_connection_parameter]
+ALTER TABLE [guacamole_connection_parameter]
     CHECK CONSTRAINT [FK_guacamole_connection_parameter_connection];
 GO;
 
@@ -251,7 +251,7 @@ GO;
  */
 SET ANSI_NULLS ON;
 SET QUOTED_IDENTIFIER ON;
-CREATE TABLE [dbo].[guacamole_sharing_profile_parameter](
+CREATE TABLE [guacamole_sharing_profile_parameter](
     [sharing_profile_id] [int] NOT NULL,
     [parameter_name] [nvarchar](128) NOT NULL,
     [parameter_value] [nvarchar](max) NOT NULL,
@@ -270,12 +270,12 @@ CREATE TABLE [dbo].[guacamole_sharing_profile_parameter](
  * Foreign keys for the sharing_profile_parameter
  * table.
  */
-ALTER TABLE [dbo].[guacamole_sharing_profile_parameter]
+ALTER TABLE [guacamole_sharing_profile_parameter]
     WITH CHECK ADD CONSTRAINT [FK_guacamole_sharing_profile_parameter_sharing_profile] FOREIGN KEY([sharing_profile_id])
-    REFERENCES [dbo].[guacamole_sharing_profile] ([sharing_profile_id])
+    REFERENCES [guacamole_sharing_profile] ([sharing_profile_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE;
-ALTER TABLE [dbo].[guacamole_sharing_profile_parameter]
+ALTER TABLE [guacamole_sharing_profile_parameter]
     CHECK CONSTRAINT [FK_guacamole_sharing_profile_parameter_sharing_profile];
 GO;
 
@@ -285,10 +285,10 @@ GO;
  */
 SET ANSI_NULLS ON;
 SET QUOTED_IDENTIFIER ON;
-CREATE TABLE [dbo].[guacamole_connection_permission](
+CREATE TABLE [guacamole_connection_permission](
     [user_id] [int] NOT NULL,
     [connection_id] [int] NOT NULL,
-    [permission] [dbo].[guacamole_permission] NOT NULL,
+    [permission] [guacamole_permission] NOT NULL,
 
     CONSTRAINT [PK_guacamole_connection_permission] PRIMARY KEY CLUSTERED 
         ([user_id] ASC, [connection_id] ASC, [permission] ASC)
@@ -303,19 +303,19 @@ CREATE TABLE [dbo].[guacamole_connection_permission](
 /**
  * Foreign keys for the connection_permission table.
  */
-ALTER TABLE [dbo].[guacamole_connection_permission]
+ALTER TABLE [guacamole_connection_permission]
     WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_permission_connection1] FOREIGN KEY([connection_id])
-    REFERENCES [dbo].[guacamole_connection] ([connection_id])
+    REFERENCES [guacamole_connection] ([connection_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE;
-ALTER TABLE [dbo].[guacamole_connection_permission]
+ALTER TABLE [guacamole_connection_permission]
     CHECK CONSTRAINT [FK_guacamole_connection_permission_connection1];
-ALTER TABLE [dbo].[guacamole_connection_permission]
+ALTER TABLE [guacamole_connection_permission]
     WITH CHECK ADD  CONSTRAINT [FK_guacamole_connection_permission_user1] FOREIGN KEY([user_id])
-    REFERENCES [dbo].[guacamole_user] ([user_id])
+    REFERENCES [guacamole_user] ([user_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE;
-ALTER TABLE [dbo].[guacamole_connection_permission]
+ALTER TABLE [guacamole_connection_permission]
     CHECK CONSTRAINT [FK_guacamole_connection_permission_user1];
 GO;
 
@@ -325,10 +325,10 @@ GO;
  */
 SET ANSI_NULLS ON;
 SET QUOTED_IDENTIFIER ON;
-CREATE TABLE [dbo].[guacamole_connection_group_permission](
+CREATE TABLE [guacamole_connection_group_permission](
     [user_id] [int] NOT NULL,
     [connection_group_id] [int] NOT NULL,
-    [permission] [dbo].[guacamole_permission] NOT NULL,
+    [permission] [guacamole_permission] NOT NULL,
 
     CONSTRAINT [PK_guacamole_connection_group_permission] PRIMARY KEY CLUSTERED 
         ([user_id] ASC,	[connection_group_id] ASC, [permission] ASC)
@@ -343,19 +343,19 @@ CREATE TABLE [dbo].[guacamole_connection_group_permission](
 /**
  * Foreign keys for the connection_group_permission table.
  */
-ALTER TABLE [dbo].[guacamole_connection_group_permission] 
+ALTER TABLE [guacamole_connection_group_permission] 
     WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_group_permission_connection_group] FOREIGN KEY([connection_group_id])
-    REFERENCES [dbo].[guacamole_connection_group] ([connection_group_id])
+    REFERENCES [guacamole_connection_group] ([connection_group_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE;
-ALTER TABLE [dbo].[guacamole_connection_group_permission]
+ALTER TABLE [guacamole_connection_group_permission]
     CHECK CONSTRAINT [FK_guacamole_connection_group_permission_connection_group];
-ALTER TABLE [dbo].[guacamole_connection_group_permission]
+ALTER TABLE [guacamole_connection_group_permission]
     WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_group_permission_user] FOREIGN KEY([user_id])
-    REFERENCES [dbo].[guacamole_user] ([user_id])
+    REFERENCES [guacamole_user] ([user_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE;
-ALTER TABLE [dbo].[guacamole_connection_group_permission]
+ALTER TABLE [guacamole_connection_group_permission]
     CHECK CONSTRAINT [FK_guacamole_connection_group_permission_user];
 GO;
 
@@ -365,10 +365,10 @@ GO;
  */
 SET ANSI_NULLS ON;
 SET QUOTED_IDENTIFIER ON;
-CREATE TABLE [dbo].[guacamole_sharing_profile_permission](
+CREATE TABLE [guacamole_sharing_profile_permission](
     [user_id] [int] NOT NULL,
     [sharing_profile_id] [int] NOT NULL,
-    [permission] [dbo].[guacamole_permission] NOT NULL,
+    [permission] [guacamole_permission] NOT NULL,
 
     CONSTRAINT [PK_guacamole_sharing_profile_permission] PRIMARY KEY CLUSTERED 
         ([user_id] ASC, [sharing_profile_id] ASC, [permission] ASC)
@@ -383,19 +383,19 @@ CREATE TABLE [dbo].[guacamole_sharing_profile_permission](
 /**
  * Foreign keys for the sharing_profile_permission table.
  */
-ALTER TABLE [dbo].[guacamole_sharing_profile_permission]
+ALTER TABLE [guacamole_sharing_profile_permission]
     WITH CHECK ADD CONSTRAINT [FK_guacamole_sharing_profile_permission_sharing_profile] FOREIGN KEY([sharing_profile_id])
-    REFERENCES [dbo].[guacamole_sharing_profile] ([sharing_profile_id])
+    REFERENCES [guacamole_sharing_profile] ([sharing_profile_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE;
-ALTER TABLE [dbo].[guacamole_sharing_profile_permission]
+ALTER TABLE [guacamole_sharing_profile_permission]
     CHECK CONSTRAINT [FK_guacamole_sharing_profile_permission_sharing_profile];
-ALTER TABLE [dbo].[guacamole_sharing_profile_permission]
+ALTER TABLE [guacamole_sharing_profile_permission]
     WITH CHECK ADD  CONSTRAINT [FK_guacamole_sharing_profile_permission_user] FOREIGN KEY([user_id])
-    REFERENCES [dbo].[guacamole_user] ([user_id])
+    REFERENCES [guacamole_user] ([user_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE;
-ALTER TABLE [dbo].[guacamole_sharing_profile_permission]
+ALTER TABLE [guacamole_sharing_profile_permission]
     CHECK CONSTRAINT [FK_guacamole_sharing_profile_permission_user];
 GO;
 
@@ -405,9 +405,9 @@ GO;
  */
 SET ANSI_NULLS ON;
 SET QUOTED_IDENTIFIER ON;
-CREATE TABLE [dbo].[guacamole_system_permission](
+CREATE TABLE [guacamole_system_permission](
     [user_id] [int] NOT NULL,
-    [permission] [dbo].[guacamole_system_permission] NOT NULL,
+    [permission] [guacamole_system_permission] NOT NULL,
 
     CONSTRAINT [PK_guacamole_system_permission] PRIMARY KEY CLUSTERED 
         ([user_id] ASC,	[permission] ASC)
@@ -422,12 +422,12 @@ CREATE TABLE [dbo].[guacamole_system_permission](
 /**
  * Foreign keys for system_permission table.
  */
-ALTER TABLE [dbo].[guacamole_system_permission]
+ALTER TABLE [guacamole_system_permission]
     WITH CHECK ADD CONSTRAINT [FK_guacamole_system_permission_user] FOREIGN KEY([user_id])
-    REFERENCES [dbo].[guacamole_user] ([user_id])
+    REFERENCES [guacamole_user] ([user_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE;
-ALTER TABLE [dbo].[guacamole_system_permission]
+ALTER TABLE [guacamole_system_permission]
     CHECK CONSTRAINT [FK_guacamole_system_permission_user];
 GO;
 
@@ -437,10 +437,10 @@ GO;
  */
 SET ANSI_NULLS ON;
 SET QUOTED_IDENTIFIER ON;
-CREATE TABLE [dbo].[guacamole_user_permission](
+CREATE TABLE [guacamole_user_permission](
     [user_id] [int] NOT NULL,
     [affected_user_id] [int] NOT NULL,
-    [permission] [dbo].[guacamole_permission] NOT NULL,
+    [permission] [guacamole_permission] NOT NULL,
 
     CONSTRAINT [PK_guacamole_user_permission] PRIMARY KEY CLUSTERED 
         ([user_id] ASC,	[affected_user_id] ASC,	[permission] ASC)
@@ -455,17 +455,17 @@ CREATE TABLE [dbo].[guacamole_user_permission](
 /**
  * Foreign keys for user_permission table.
  */
-ALTER TABLE [dbo].[guacamole_user_permission]
+ALTER TABLE [guacamole_user_permission]
     WITH CHECK ADD CONSTRAINT [FK_guacamole_user_permission_user] FOREIGN KEY([user_id])
-    REFERENCES [dbo].[guacamole_user] ([user_id])
+    REFERENCES [guacamole_user] ([user_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE;
-ALTER TABLE [dbo].[guacamole_user_permission]
+ALTER TABLE [guacamole_user_permission]
     CHECK CONSTRAINT [FK_guacamole_user_permission_user];
-ALTER TABLE [dbo].[guacamole_user_permission]
+ALTER TABLE [guacamole_user_permission]
     WITH CHECK ADD CONSTRAINT [FK_guacamole_user_permission_user1] FOREIGN KEY([affected_user_id])
-    REFERENCES [dbo].[guacamole_user] ([user_id]);
-ALTER TABLE [dbo].[guacamole_user_permission]
+    REFERENCES [guacamole_user] ([user_id]);
+ALTER TABLE [guacamole_user_permission]
     CHECK CONSTRAINT [FK_guacamole_user_permission_user1];
 GO;
 
@@ -475,7 +475,7 @@ GO;
  */
 SET ANSI_NULLS ON;
 SET QUOTED_IDENTIFIER ON;
-CREATE TABLE [dbo].[guacamole_connection_history](
+CREATE TABLE [guacamole_connection_history](
     [history_id] [int] IDENTITY(1,1) NOT NULL,
     [user_id] [int] NULL,
     [username] [nvarchar](128) NOT NULL,
@@ -500,24 +500,24 @@ CREATE TABLE [dbo].[guacamole_connection_history](
 /**
  * Foreign keys for connection_history table
  */
-ALTER TABLE [dbo].[guacamole_connection_history]
+ALTER TABLE [guacamole_connection_history]
     WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_history_connection] FOREIGN KEY([connection_id])
-    REFERENCES [dbo].[guacamole_connection] ([connection_id])
+    REFERENCES [guacamole_connection] ([connection_id])
         ON UPDATE CASCADE
         ON DELETE SET NULL;
-ALTER TABLE [dbo].[guacamole_connection_history]
+ALTER TABLE [guacamole_connection_history]
     CHECK CONSTRAINT [FK_guacamole_connection_history_connection];
-ALTER TABLE [dbo].[guacamole_connection_history]
+ALTER TABLE [guacamole_connection_history]
     WITH CHECK ADD  CONSTRAINT [FK_guacamole_connection_history_sharing_profile] FOREIGN KEY([sharing_profile_id])
-    REFERENCES [dbo].[guacamole_sharing_profile] ([sharing_profile_id]);
-ALTER TABLE [dbo].[guacamole_connection_history]
+    REFERENCES [guacamole_sharing_profile] ([sharing_profile_id]);
+ALTER TABLE [guacamole_connection_history]
     CHECK CONSTRAINT [FK_guacamole_connection_history_sharing_profile];
-ALTER TABLE [dbo].[guacamole_connection_history]
+ALTER TABLE [guacamole_connection_history]
     WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_history_user] FOREIGN KEY([user_id])
-    REFERENCES [dbo].[guacamole_user] ([user_id])
+    REFERENCES [guacamole_user] ([user_id])
         ON UPDATE CASCADE
         ON DELETE SET NULL;
-ALTER TABLE [dbo].[guacamole_connection_history]
+ALTER TABLE [guacamole_connection_history]
     CHECK CONSTRAINT [FK_guacamole_connection_history_user];
 GO;
 
@@ -528,7 +528,7 @@ GO;
  */
 SET ANSI_NULLS ON;
 SET QUOTED_IDENTIFIER ON;
-CREATE TABLE [dbo].[guacamole_user_password_history](
+CREATE TABLE [guacamole_user_password_history](
     [password_history_id] [int] IDENTITY(1,1) NOT NULL,
     [user_id] [int] NOT NULL,
     [password_hash] [binary](32) NOT NULL,
@@ -548,11 +548,11 @@ CREATE TABLE [dbo].[guacamole_user_password_history](
 /**
  * Foreign keys for user_password_history table
  */
-ALTER TABLE [dbo].[guacamole_user_password_history]
+ALTER TABLE [guacamole_user_password_history]
     WITH CHECK ADD  CONSTRAINT [FK_guacamole_user_password_history_user] FOREIGN KEY([user_id])
-    REFERENCES [dbo].[guacamole_user] ([user_id])
+    REFERENCES [guacamole_user] ([user_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE;
-ALTER TABLE [dbo].[guacamole_user_password_history]
+ALTER TABLE [guacamole_user_password_history]
     CHECK CONSTRAINT [FK_guacamole_user_password_history_user];
 GO;

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/73301901/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
index f7d5b45..d348b61 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
@@ -20,20 +20,20 @@
 /**
  * Create the default admin user account and set up full privileges.
  */
-INSERT INTO [dbo].[guacamole_user] (username, password_hash, password_date)
+INSERT INTO [guacamole_user] (username, password_hash, password_date)
 VALUES ('guacadmin', HASHBYTES('SHA2_256', 'guacadmin'), getdate());
 
-INSERT INTO [dbo].[guacamole_user_permission]
-SELECT [dbo].[guacamole_user].[user_id], [affected].[user_id], permission
+INSERT INTO [guacamole_user_permission]
+SELECT [guacamole_user].[user_id], [affected].[user_id], permission
 FROM (
     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, 'ADMINISTER' AS permission)
     permissions
-    JOIN [dbo].[guacamole_user] ON permissions.username = [dbo].[guacamole_user].[username]
-    JOIN [dbo].[guacamole_user] affected ON permissions.affected_username = affected.username;
+    JOIN [guacamole_user] ON permissions.username = [guacamole_user].[username]
+    JOIN [guacamole_user] affected ON permissions.affected_username = affected.username;
 
-INSERT INTO [dbo].[guacamole_system_permission]
+INSERT INTO [guacamole_system_permission]
 SELECT user_id, permission
 FROM (
     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, 'ADMINISTER' AS permission)
     permissions
-    JOIN [dbo].[guacamole_user] ON permissions.username = [dbo].[guacamole_user].[username];
+    JOIN [guacamole_user] ON permissions.username = [guacamole_user].[username];
 GO;

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/73301901/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionMapper.xml
index c62ca6f..3e6819f 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionMapper.xml
@@ -51,13 +51,13 @@
     <!-- Select all connection identifiers -->
     <select id="selectIdentifiers" resultType="string">
         SELECT connection_id 
-        FROM [dbo].[guacamole_connection]
+        FROM [guacamole_connection]
     </select>
 
     <!-- Select identifiers of all readable connections -->
     <select id="selectReadableIdentifiers" resultType="string">
         SELECT connection_id
-        FROM [dbo].[guacamole_connection_permission]
+        FROM [guacamole_connection_permission]
         WHERE
             user_id = #{user.objectID,jdbcType=INTEGER}
             AND permission = 'READ'
@@ -66,7 +66,7 @@
     <!-- Select all connection identifiers within a particular connection group -->
     <select id="selectIdentifiersWithin" resultType="string">
         SELECT connection_id 
-        FROM [dbo].[guacamole_connection]
+        FROM [guacamole_connection]
         WHERE
             <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</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 id="selectReadableIdentifiersWithin" resultType="string">
-        SELECT [dbo].[guacamole_connection].connection_id
-        FROM [dbo].[guacamole_connection]
-        JOIN [dbo].[guacamole_connection_permission] ON [dbo].[guacamole_connection_permission].connection_id = [dbo].[guacamole_connection].connection_id
+        SELECT [guacamole_connection].connection_id
+        FROM [guacamole_connection]
+        JOIN [guacamole_connection_permission] ON [guacamole_connection_permission].connection_id = [guacamole_connection].connection_id
         WHERE
             <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if>
             <if test="parentIdentifier == null">parent_id IS NULL</if>
@@ -100,7 +100,7 @@
             proxy_encryption_method,
             connection_weight,
             failover_only
-        FROM [dbo].[guacamole_connection]
+        FROM [guacamole_connection]
         WHERE connection_id IN
             <foreach collection="identifiers" item="identifier"
                      open="(" separator="," close=")">
@@ -108,7 +108,7 @@
             </foreach>;
 
         SELECT primary_connection_id, sharing_profile_id
-        FROM [dbo].[guacamole_sharing_profile]
+        FROM [guacamole_sharing_profile]
         WHERE primary_connection_id IN
             <foreach collection="identifiers" item="identifier"
                      open="(" separator="," close=")">
@@ -122,7 +122,7 @@
             resultSets="connections,sharingProfiles">
 
         SELECT
-            [dbo].[guacamole_connection].connection_id,
+            [guacamole_connection].connection_id,
             connection_name,
             parent_id,
             protocol,
@@ -133,9 +133,9 @@
             proxy_encryption_method,
             connection_weight,
             failover_only
-        FROM [dbo].[guacamole_connection]
-        JOIN [dbo].[guacamole_connection_permission] ON [dbo].[guacamole_connection_permission].connection_id = [dbo].[guacamole_connection].connection_id
-        WHERE [dbo].[guacamole_connection].connection_id IN
+        FROM [guacamole_connection]
+        JOIN [guacamole_connection_permission] ON [guacamole_connection_permission].connection_id = [guacamole_connection].connection_id
+        WHERE [guacamole_connection].connection_id IN
             <foreach collection="identifiers" item="identifier"
                      open="(" separator="," close=")">
                 #{identifier,jdbcType=INTEGER}
@@ -143,9 +143,9 @@
             AND user_id = #{user.objectID,jdbcType=INTEGER}
             AND permission = 'READ';
 
-        SELECT primary_connection_id, [dbo].[guacamole_sharing_profile].sharing_profile_id
-        FROM [dbo].[guacamole_sharing_profile]
-        JOIN [dbo].[guacamole_sharing_profile_permission] ON [dbo].[guacamole_sharing_profile_permission].sharing_profile_id = [dbo].[guacamole_sharing_profile].sharing_profile_id
+        SELECT primary_connection_id, [guacamole_sharing_profile].sharing_profile_id
+        FROM [guacamole_sharing_profile]
+        JOIN [guacamole_sharing_profile_permission] ON [guacamole_sharing_profile_permission].sharing_profile_id = [guacamole_sharing_profile].sharing_profile_id
         WHERE primary_connection_id IN
             <foreach collection="identifiers" item="identifier"
                      open="(" separator="," close=")">
@@ -171,7 +171,7 @@
             proxy_encryption_method,
             connection_weight,
             failover_only
-        FROM [dbo].[guacamole_connection]
+        FROM [guacamole_connection]
         WHERE 
             <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if>
             <if test="parentIdentifier == null">parent_id IS NULL</if>
@@ -181,7 +181,7 @@
 
     <!-- Delete single connection by identifier -->
     <delete id="delete">
-        DELETE FROM [dbo].[guacamole_connection]
+        DELETE FROM [guacamole_connection]
         WHERE connection_id = #{identifier,jdbcType=INTEGER}
     </delete>
 
@@ -189,7 +189,7 @@
     <insert id="insert" useGeneratedKeys="true" keyProperty="object.objectID"
             parameterType="org.apache.guacamole.auth.jdbc.connection.ConnectionModel">
 
-        INSERT INTO [dbo].[guacamole_connection] (
+        INSERT INTO [guacamole_connection] (
             connection_name,
             parent_id,
             protocol,
@@ -218,7 +218,7 @@
 
     <!-- Update single connection -->
     <update id="update" parameterType="org.apache.guacamole.auth.jdbc.connection.ConnectionModel">
-        UPDATE [dbo].[guacamole_connection]
+        UPDATE [guacamole_connection]
         SET connection_name          = #{object.name,jdbcType=VARCHAR},
             parent_id                = #{object.parentIdentifier,jdbcType=INTEGER},
             protocol                 = #{object.protocol,jdbcType=VARCHAR},

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/73301901/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionParameterMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionParameterMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionParameterMapper.xml
index 0d13aeb..08b337e 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionParameterMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionParameterMapper.xml
@@ -36,21 +36,21 @@
             connection_id,
             parameter_name,
             parameter_value
-        FROM [dbo].[guacamole_connection_parameter]
+        FROM [guacamole_connection_parameter]
         WHERE
             connection_id = #{identifier,jdbcType=INTEGER}
     </select>
 
     <!-- Delete all parameters of a given connection -->
     <delete id="delete">
-        DELETE FROM [dbo].[guacamole_connection_parameter]
+        DELETE FROM [guacamole_connection_parameter]
         WHERE connection_id = #{identifier,jdbcType=INTEGER}
     </delete>
 
     <!-- Insert all given parameters -->
     <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.connection.ConnectionParameterModel">
 
-        INSERT INTO [dbo].[guacamole_connection_parameter] (
+        INSERT INTO [guacamole_connection_parameter] (
             connection_id,
             parameter_name,
             parameter_value

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/73301901/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
index 648d16f..bca8139 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
@@ -40,28 +40,28 @@
     <select id="select" resultMap="ConnectionRecordResultMap">
 
         SELECT
-            [dbo].[guacamole_connection_history].connection_id,
-            [dbo].[guacamole_connection_history].connection_name,
-            [dbo].[guacamole_connection_history].remote_host,
-            [dbo].[guacamole_connection_history].sharing_profile_id,
-            [dbo].[guacamole_connection_history].sharing_profile_name,
-            [dbo].[guacamole_connection_history].user_id,
-            [dbo].[guacamole_connection_history].username,
-            [dbo].[guacamole_connection_history].start_date,
-            [dbo].[guacamole_connection_history].end_date
-        FROM [dbo].[guacamole_connection_history]
+            [guacamole_connection_history].connection_id,
+            [guacamole_connection_history].connection_name,
+            [guacamole_connection_history].remote_host,
+            [guacamole_connection_history].sharing_profile_id,
+            [guacamole_connection_history].sharing_profile_name,
+            [guacamole_connection_history].user_id,
+            [guacamole_connection_history].username,
+            [guacamole_connection_history].start_date,
+            [guacamole_connection_history].end_date
+        FROM [guacamole_connection_history]
         WHERE
-            [dbo].[guacamole_connection_history].connection_id = #{identifier,jdbcType=INTEGER}
+            [guacamole_connection_history].connection_id = #{identifier,jdbcType=INTEGER}
         ORDER BY
-            [dbo].[guacamole_connection_history].start_date DESC,
-            [dbo].[guacamole_connection_history].end_date DESC
+            [guacamole_connection_history].start_date DESC,
+            [guacamole_connection_history].end_date DESC
 
     </select>
 
     <!-- Insert the given connection record -->
     <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.connection.ConnectionRecordModel">
 
-        INSERT INTO [dbo].[guacamole_connection_history] (
+        INSERT INTO [guacamole_connection_history] (
             connection_id,
             connection_name,
             remote_host,
@@ -78,7 +78,7 @@
             #{record.remoteHost,jdbcType=VARCHAR},
             #{record.sharingProfileIdentifier,jdbcType=INTEGER},
             #{record.sharingProfileName,jdbcType=VARCHAR},
-            (SELECT user_id FROM [dbo].[guacamole_user]
+            (SELECT user_id FROM [guacamole_user]
              WHERE username = #{record.username,jdbcType=VARCHAR}),
             #{record.username,jdbcType=VARCHAR},
             #{record.startDate,jdbcType=TIMESTAMP},
@@ -91,31 +91,31 @@
     <select id="search" resultMap="ConnectionRecordResultMap">
 
         SELECT TOP (#{limit,jdbcType=INTEGER})
-            [dbo].[guacamole_connection_history].connection_id,
-            [dbo].[guacamole_connection_history].connection_name,
-            [dbo].[guacamole_connection_history].remote_host,
-            [dbo].[guacamole_connection_history].sharing_profile_id,
-            [dbo].[guacamole_connection_history].sharing_profile_name,
-            [dbo].[guacamole_connection_history].user_id,
-            [dbo].[guacamole_connection_history].username,
-            [dbo].[guacamole_connection_history].start_date,
-            [dbo].[guacamole_connection_history].end_date
-        FROM [dbo].[guacamole_connection_history]
+            [guacamole_connection_history].connection_id,
+            [guacamole_connection_history].connection_name,
+            [guacamole_connection_history].remote_host,
+            [guacamole_connection_history].sharing_profile_id,
+            [guacamole_connection_history].sharing_profile_name,
+            [guacamole_connection_history].user_id,
+            [guacamole_connection_history].username,
+            [guacamole_connection_history].start_date,
+            [guacamole_connection_history].end_date
+        FROM [guacamole_connection_history]
 
         <!-- Search terms -->
         <foreach collection="terms" item="term"
                  open="WHERE " separator=" AND ">
             (
 
-                [dbo].[guacamole_connection_history].user_id IN (
+                [guacamole_connection_history].user_id IN (
                     SELECT user_id
-                    FROM [dbo].[guacamole_user]
+                    FROM [guacamole_user]
                     WHERE POSITION(#{term.term,jdbcType=VARCHAR} IN username) > 0
                 )
 
-                OR [dbo].[guacamole_connection_history].connection_id IN (
+                OR [guacamole_connection_history].connection_id IN (
                     SELECT connection_id
-                    FROM [dbo].[guacamole_connection]
+                    FROM [guacamole_connection]
                     WHERE POSITION(#{term.term,jdbcType=VARCHAR} IN connection_name) > 0
                 )
 
@@ -133,7 +133,7 @@
         <foreach collection="sortPredicates" item="sortPredicate"
                  open="ORDER BY " separator=", ">
             <choose>
-                <when test="sortPredicate.property == START_DATE">[dbo].[guacamole_connection_history].start_date</when>
+                <when test="sortPredicate.property == START_DATE">[guacamole_connection_history].start_date</when>
                 <otherwise>1</otherwise>
             </choose>
             <if test="sortPredicate.descending">DESC</if>
@@ -145,45 +145,45 @@
     <select id="searchReadable" resultMap="ConnectionRecordResultMap">
 
         SELECT TOP (#{limit,jdbcType=INTEGER})
-            [dbo].[guacamole_connection_history].connection_id,
-            [dbo].[guacamole_connection_history].connection_name,
-            [dbo].[guacamole_connection_history].remote_host,
-            [dbo].[guacamole_connection_history].sharing_profile_id,
-            [dbo].[guacamole_connection_history].sharing_profile_name,
-            [dbo].[guacamole_connection_history].user_id,
-            [dbo].[guacamole_connection_history].username,
-            [dbo].[guacamole_connection_history].start_date,
-            [dbo].[guacamole_connection_history].end_date
-        FROM [dbo].[guacamole_connection_history]
-        LEFT JOIN [dbo].[guacamole_connection]            ON [dbo].[guacamole_connection_history].connection_id = [dbo].[guacamole_connection].connection_id
-        LEFT JOIN [dbo].[guacamole_user]                  ON [dbo].[guacamole_connection_history].user_id       = [dbo].[guacamole_user].user_id
+            [guacamole_connection_history].connection_id,
+            [guacamole_connection_history].connection_name,
+            [guacamole_connection_history].remote_host,
+            [guacamole_connection_history].sharing_profile_id,
+            [guacamole_connection_history].sharing_profile_name,
+            [guacamole_connection_history].user_id,
+            [guacamole_connection_history].username,
+            [guacamole_connection_history].start_date,
+            [guacamole_connection_history].end_date
+        FROM [guacamole_connection_history]
+        LEFT JOIN [guacamole_connection]            ON [guacamole_connection_history].connection_id = [guacamole_connection].connection_id
+        LEFT JOIN [guacamole_user]                  ON [guacamole_connection_history].user_id       = [guacamole_user].user_id
 
         <!-- Restrict to readable connections -->
-        JOIN [dbo].[guacamole_connection_permission] ON
-                [dbo].[guacamole_connection_history].connection_id = [dbo].[guacamole_connection_permission].connection_id
-            AND [dbo].[guacamole_connection_permission].user_id    = #{user.objectID,jdbcType=INTEGER}
-            AND [dbo].[guacamole_connection_permission].permission = 'READ'
+        JOIN [guacamole_connection_permission] ON
+                [guacamole_connection_history].connection_id = [guacamole_connection_permission].connection_id
+            AND [guacamole_connection_permission].user_id    = #{user.objectID,jdbcType=INTEGER}
+            AND [guacamole_connection_permission].permission = 'READ'
 
         <!-- Restrict to readable users -->
-        JOIN [dbo].[guacamole_user_permission] ON
-                [dbo].[guacamole_connection_history].user_id = [dbo].[guacamole_user_permission].affected_user_id
-            AND [dbo].[guacamole_user_permission].user_id    = #{user.objectID,jdbcType=INTEGER}
-            AND [dbo].[guacamole_user_permission].permission = 'READ'
+        JOIN [guacamole_user_permission] ON
+                [guacamole_connection_history].user_id = [guacamole_user_permission].affected_user_id
+            AND [guacamole_user_permission].user_id    = #{user.objectID,jdbcType=INTEGER}
+            AND [guacamole_user_permission].permission = 'READ'
 
         <!-- Search terms -->
         <foreach collection="terms" item="term"
                  open="WHERE " separator=" AND ">
             (
 
-                [dbo].[guacamole_connection_history].user_id IN (
+                [guacamole_connection_history].user_id IN (
                     SELECT user_id
-                    FROM [dbo].[guacamole_user]
+                    FROM [guacamole_user]
                     WHERE POSITION(#{term.term,jdbcType=VARCHAR} IN username) > 0
                 )
 
-                OR [dbo].[guacamole_connection_history].connection_id IN (
+                OR [guacamole_connection_history].connection_id IN (
                     SELECT connection_id
-                    FROM [dbo].[guacamole_connection]
+                    FROM [guacamole_connection]
                     WHERE POSITION(#{term.term,jdbcType=VARCHAR} IN connection_name) > 0
                 )
 
@@ -201,7 +201,7 @@
         <foreach collection="sortPredicates" item="sortPredicate"
                  open="ORDER BY " separator=", ">
             <choose>
-                <when test="sortPredicate.property == START_DATE">[dbo].[guacamole_connection_history].start_date</when>
+                <when test="sortPredicate.property == START_DATE">[guacamole_connection_history].start_date</when>
                 <otherwise>1</otherwise>
             </choose>
             <if test="sortPredicate.descending">DESC</if>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/73301901/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connectiongroup/ConnectionGroupMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connectiongroup/ConnectionGroupMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connectiongroup/ConnectionGroupMapper.xml
index d1f97a7..452c0a8 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connectiongroup/ConnectionGroupMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connectiongroup/ConnectionGroupMapper.xml
@@ -53,13 +53,13 @@
     <!-- Select all connection group identifiers -->
     <select id="selectIdentifiers" resultType="string">
         SELECT connection_group_id 
-        FROM [dbo].[guacamole_connection_group]
+        FROM [guacamole_connection_group]
     </select>
 
     <!-- Select identifiers of all readable connection groups -->
     <select id="selectReadableIdentifiers" resultType="string">
         SELECT connection_group_id
-        FROM [dbo].[guacamole_connection_group_permission]
+        FROM [guacamole_connection_group_permission]
         WHERE
             user_id = #{user.objectID,jdbcType=INTEGER}
             AND permission = 'READ'
@@ -68,7 +68,7 @@
     <!-- Select all connection identifiers within a particular connection group -->
     <select id="selectIdentifiersWithin" resultType="string">
         SELECT connection_group_id 
-        FROM [dbo].[guacamole_connection_group]
+        FROM [guacamole_connection_group]
         WHERE
             <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</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 id="selectReadableIdentifiersWithin" resultType="string">
-        SELECT [dbo].[guacamole_connection_group].connection_group_id
-        FROM [dbo].[guacamole_connection_group]
-        JOIN [dbo].[guacamole_connection_group_permission] ON [dbo].[guacamole_connection_group_permission].connection_group_id = [dbo].[guacamole_connection_group].connection_group_id
+        SELECT [guacamole_connection_group].connection_group_id
+        FROM [guacamole_connection_group]
+        JOIN [guacamole_connection_group_permission] ON [guacamole_connection_group_permission].connection_group_id = [guacamole_connection_group].connection_group_id
         WHERE
             <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if>
             <if test="parentIdentifier == null">parent_id IS NULL</if>
@@ -98,7 +98,7 @@
             max_connections,
             max_connections_per_user,
             enable_session_affinity
-        FROM [dbo].[guacamole_connection_group]
+        FROM [guacamole_connection_group]
         WHERE connection_group_id IN
             <foreach collection="identifiers" item="identifier"
                      open="(" separator="," close=")">
@@ -106,7 +106,7 @@
             </foreach>;
 
         SELECT parent_id, connection_group_id
-        FROM [dbo].[guacamole_connection_group]
+        FROM [guacamole_connection_group]
         WHERE parent_id IN
             <foreach collection="identifiers" item="identifier"
                      open="(" separator="," close=")">
@@ -114,7 +114,7 @@
             </foreach>;
 
         SELECT parent_id, connection_id
-        FROM [dbo].[guacamole_connection]
+        FROM [guacamole_connection]
         WHERE parent_id IN
             <foreach collection="identifiers" item="identifier"
                      open="(" separator="," close=")">
@@ -128,16 +128,16 @@
             resultSets="connectionGroups,childConnectionGroups,childConnections">
 
         SELECT
-            [dbo].[guacamole_connection_group].connection_group_id,
+            [guacamole_connection_group].connection_group_id,
             connection_group_name,
             parent_id,
             type,
             max_connections,
             max_connections_per_user,
             enable_session_affinity
-        FROM [dbo].[guacamole_connection_group]
-        JOIN [dbo].[guacamole_connection_group_permission] ON [dbo].[guacamole_connection_group_permission].connection_group_id = [dbo].[guacamole_connection_group].connection_group_id
-        WHERE [dbo].[guacamole_connection_group].connection_group_id IN
+        FROM [guacamole_connection_group]
+        JOIN [guacamole_connection_group_permission] ON [guacamole_connection_group_permission].connection_group_id = [guacamole_connection_group].connection_group_id
+        WHERE [guacamole_connection_group].connection_group_id IN
             <foreach collection="identifiers" item="identifier"
                      open="(" separator="," close=")">
                 #{identifier,jdbcType=INTEGER}
@@ -145,9 +145,9 @@
             AND user_id = #{user.objectID,jdbcType=INTEGER}
             AND permission = 'READ';
 
-        SELECT parent_id, [dbo].[guacamole_connection_group].connection_group_id
-        FROM [dbo].[guacamole_connection_group]
-        JOIN [dbo].[guacamole_connection_group_permission] ON [dbo].[guacamole_connection_group_permission].connection_group_id = [dbo].[guacamole_connection_group].connection_group_id
+        SELECT parent_id, [guacamole_connection_group].connection_group_id
+        FROM [guacamole_connection_group]
+        JOIN [guacamole_connection_group_permission] ON [guacamole_connection_group_permission].connection_group_id = [guacamole_connection_group].connection_group_id
         WHERE parent_id IN
             <foreach collection="identifiers" item="identifier"
                      open="(" separator="," close=")">
@@ -156,9 +156,9 @@
             AND user_id = #{user.objectID,jdbcType=INTEGER}
             AND permission = 'READ';
 
-        SELECT parent_id, [dbo].[guacamole_connection].connection_id
-        FROM [dbo].[guacamole_connection]
-        JOIN [dbo].[guacamole_connection_permission] ON [dbo].[guacamole_connection_permission].connection_id = [dbo].[guacamole_connection].connection_id
+        SELECT parent_id, [guacamole_connection].connection_id
+        FROM [guacamole_connection]
+        JOIN [guacamole_connection_permission] ON [guacamole_connection_permission].connection_id = [guacamole_connection].connection_id
         WHERE parent_id IN
             <foreach collection="identifiers" item="identifier"
                      open="(" separator="," close=")">
@@ -180,7 +180,7 @@
             max_connections,
             max_connections_per_user,
             enable_session_affinity
-        FROM [dbo].[guacamole_connection_group]
+        FROM [guacamole_connection_group]
         WHERE 
             <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if>
             <if test="parentIdentifier == null">parent_id IS NULL</if>
@@ -190,7 +190,7 @@
 
     <!-- Delete single connection group by identifier -->
     <delete id="delete">
-        DELETE FROM [dbo].[guacamole_connection_group]
+        DELETE FROM [guacamole_connection_group]
         WHERE connection_group_id = #{identifier,jdbcType=INTEGER}
     </delete>
 
@@ -198,7 +198,7 @@
     <insert id="insert" useGeneratedKeys="true" keyProperty="object.objectID"
             parameterType="org.apache.guacamole.auth.jdbc.connectiongroup.ConnectionGroupModel">
 
-        INSERT INTO [dbo].[guacamole_connection_group] (
+        INSERT INTO [guacamole_connection_group] (
             connection_group_name,
             parent_id,
             type,
@@ -219,7 +219,7 @@
 
     <!-- Update single connection group -->
     <update id="update" parameterType="org.apache.guacamole.auth.jdbc.connectiongroup.ConnectionGroupModel">
-        UPDATE [dbo].[guacamole_connection_group]
+        UPDATE [guacamole_connection_group]
         SET connection_group_name    = #{object.name,jdbcType=VARCHAR},
             parent_id                = #{object.parentIdentifier,jdbcType=INTEGER},
             type                     = #{object.type,jdbcType=VARCHAR},

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/73301901/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionGroupPermissionMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionGroupPermissionMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionGroupPermissionMapper.xml
index ff69a75..3cc0988 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionGroupPermissionMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionGroupPermissionMapper.xml
@@ -36,13 +36,13 @@
     <select id="select" resultMap="ConnectionGroupPermissionResultMap">
 
         SELECT
-            [dbo].[guacamole_connection_group_permission].user_id,
+            [guacamole_connection_group_permission].user_id,
             username,
             permission,
             connection_group_id
-        FROM [dbo].[guacamole_connection_group_permission]
-        JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_connection_group_permission].user_id = [dbo].[guacamole_user].user_id
-        WHERE [dbo].[guacamole_connection_group_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+        FROM [guacamole_connection_group_permission]
+        JOIN [guacamole_user] ON [guacamole_connection_group_permission].user_id = [guacamole_user].user_id
+        WHERE [guacamole_connection_group_permission].user_id = #{user.objectID,jdbcType=INTEGER}
 
     </select>
 
@@ -50,14 +50,14 @@
     <select id="selectOne" resultMap="ConnectionGroupPermissionResultMap">
 
         SELECT
-            [dbo].[guacamole_connection_group_permission].user_id,
+            [guacamole_connection_group_permission].user_id,
             username,
             permission,
             connection_group_id
-        FROM [dbo].[guacamole_connection_group_permission]
-        JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_connection_group_permission].user_id = [dbo].[guacamole_user].user_id
+        FROM [guacamole_connection_group_permission]
+        JOIN [guacamole_user] ON [guacamole_connection_group_permission].user_id = [guacamole_user].user_id
         WHERE
-            [dbo].[guacamole_connection_group_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+            [guacamole_connection_group_permission].user_id = #{user.objectID,jdbcType=INTEGER}
             AND permission = #{type,jdbcType=VARCHAR}
             AND connection_group_id = #{identifier,jdbcType=INTEGER}
 
@@ -67,7 +67,7 @@
     <select id="selectAccessibleIdentifiers" resultType="string">
 
         SELECT DISTINCT connection_group_id 
-        FROM [dbo].[guacamole_connection_group_permission]
+        FROM [guacamole_connection_group_permission]
         WHERE
             user_id = #{user.objectID,jdbcType=INTEGER}
             AND connection_group_id IN
@@ -86,7 +86,7 @@
     <!-- Delete all given permissions -->
     <delete id="delete" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
 
-        DELETE FROM [dbo].[guacamole_connection_group_permission]
+        DELETE FROM [guacamole_connection_group_permission]
         WHERE (user_id, permission, connection_group_id) IN
             <foreach collection="permissions" item="permission"
                      open="(" separator="," close=")">
@@ -100,7 +100,7 @@
     <!-- Insert all given permissions -->
     <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
 
-        INSERT INTO [dbo].[guacamole_connection_group_permission] (
+        INSERT INTO [guacamole_connection_group_permission] (
             user_id,
             permission,
             connection_group_id
@@ -117,10 +117,10 @@
                        #{permission.objectIdentifier,jdbcType=INTEGER} AS connection_group_id
             </foreach>
         AS permissions
-        WHERE NOT EXISTS (SELECT 1 FROM [dbo].[guacamole_connection_group_permission]
-            WHERE [dbo].[guacamole_connection_group_permission].user_id = permissions.user_id AND
-            [dbo].[guacamole_connection_group_permission].permission = permissions.permission AND
-            [dbo].[guacamole_connection_group_permission].connection_group_id = permissions.connection_group_id
+        WHERE NOT EXISTS (SELECT 1 FROM [guacamole_connection_group_permission]
+            WHERE [guacamole_connection_group_permission].user_id = permissions.user_id AND
+            [guacamole_connection_group_permission].permission = permissions.permission AND
+            [guacamole_connection_group_permission].connection_group_id = permissions.connection_group_id
         );
 
     </insert>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/73301901/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionPermissionMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionPermissionMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionPermissionMapper.xml
index fa25f63..aaa555a 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionPermissionMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionPermissionMapper.xml
@@ -36,13 +36,13 @@
     <select id="select" resultMap="ConnectionPermissionResultMap">
 
         SELECT
-            [dbo].[guacamole_connection_permission].user_id,
+            [guacamole_connection_permission].user_id,
             username,
             permission,
             connection_id
-        FROM [dbo].[guacamole_connection_permission]
-        JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_connection_permission].user_id = [dbo].[guacamole_user].user_id
-        WHERE [dbo].[guacamole_connection_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+        FROM [guacamole_connection_permission]
+        JOIN [guacamole_user] ON [guacamole_connection_permission].user_id = [guacamole_user].user_id
+        WHERE [guacamole_connection_permission].user_id = #{user.objectID,jdbcType=INTEGER}
 
     </select>
 
@@ -50,14 +50,14 @@
     <select id="selectOne" resultMap="ConnectionPermissionResultMap">
 
         SELECT
-            [dbo].[guacamole_connection_permission].user_id,
+            [guacamole_connection_permission].user_id,
             username,
             permission,
             connection_id
-        FROM [dbo].[guacamole_connection_permission]
-        JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_connection_permission].user_id = [dbo].[guacamole_user].user_id
+        FROM [guacamole_connection_permission]
+        JOIN [guacamole_user] ON [guacamole_connection_permission].user_id = [guacamole_user].user_id
         WHERE
-            [dbo].[guacamole_connection_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+            [guacamole_connection_permission].user_id = #{user.objectID,jdbcType=INTEGER}
             AND permission = #{type,jdbcType=VARCHAR}
             AND connection_id = #{identifier,jdbcType=INTEGER}
 
@@ -67,7 +67,7 @@
     <select id="selectAccessibleIdentifiers" resultType="string">
 
         SELECT DISTINCT connection_id 
-        FROM [dbo].[guacamole_connection_permission]
+        FROM [guacamole_connection_permission]
         WHERE
             user_id = #{user.objectID,jdbcType=INTEGER}
             AND connection_id IN
@@ -86,7 +86,7 @@
     <!-- Delete all given permissions -->
     <delete id="delete" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
 
-        DELETE FROM [dbo].[guacamole_connection_permission]
+        DELETE FROM [guacamole_connection_permission]
         WHERE
             <foreach collection="permissions" item="permission"
                      open="(" separator=" OR " close=")">
@@ -100,7 +100,7 @@
     <!-- Insert all given permissions -->
     <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
 
-        INSERT INTO [dbo].[guacamole_connection_permission] (
+        INSERT INTO [guacamole_connection_permission] (
             user_id,
             permission,
             connection_id
@@ -117,10 +117,10 @@
                        #{permission.objectIdentifier,jdbcType=INTEGER} AS connection_id
             </foreach>
         AS permissions
-        WHERE NOT EXISTS ( SELECT 1 FROM [dbo].[guacamole_connection_permission]
-            WHERE [dbo].[guacamole_connection_permission].user_id = permissions.user_id AND
-            [dbo].[guacamole_connection_permission].permission = permissions.permission AND
-            [dbo].[guacamole_connection_permission].connection_id = permissions.connection_id
+        WHERE NOT EXISTS ( SELECT 1 FROM [guacamole_connection_permission]
+            WHERE [guacamole_connection_permission].user_id = permissions.user_id AND
+            [guacamole_connection_permission].permission = permissions.permission AND
+            [guacamole_connection_permission].connection_id = permissions.connection_id
         );
 
     </insert>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/73301901/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SharingProfilePermissionMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SharingProfilePermissionMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SharingProfilePermissionMapper.xml
index 40e9907..ab40d2a 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SharingProfilePermissionMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SharingProfilePermissionMapper.xml
@@ -36,13 +36,13 @@
     <select id="select" resultMap="SharingProfilePermissionResultMap">
 
         SELECT
-            [dbo].[guacamole_sharing_profile_permission].user_id,
+            [guacamole_sharing_profile_permission].user_id,
             username,
             permission,
             sharing_profile_id
-        FROM [dbo].[guacamole_sharing_profile_permission]
-        JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_sharing_profile_permission].user_id = [dbo].[guacamole_user].user_id
-        WHERE [dbo].[guacamole_sharing_profile_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+        FROM [guacamole_sharing_profile_permission]
+        JOIN [guacamole_user] ON [guacamole_sharing_profile_permission].user_id = [guacamole_user].user_id
+        WHERE [guacamole_sharing_profile_permission].user_id = #{user.objectID,jdbcType=INTEGER}
 
     </select>
 
@@ -50,14 +50,14 @@
     <select id="selectOne" resultMap="SharingProfilePermissionResultMap">
 
         SELECT
-            [dbo].[guacamole_sharing_profile_permission].user_id,
+            [guacamole_sharing_profile_permission].user_id,
             username,
             permission,
             sharing_profile_id
-        FROM [dbo].[guacamole_sharing_profile_permission]
-        JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_sharing_profile_permission].user_id = [dbo].[guacamole_user].user_id
+        FROM [guacamole_sharing_profile_permission]
+        JOIN [guacamole_user] ON [guacamole_sharing_profile_permission].user_id = [guacamole_user].user_id
         WHERE
-            [dbo].[guacamole_sharing_profile_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+            [guacamole_sharing_profile_permission].user_id = #{user.objectID,jdbcType=INTEGER}
             AND permission = #{type,jdbcType=VARCHAR}
             AND sharing_profile_id = #{identifier,jdbcType=INTEGER}
 
@@ -67,7 +67,7 @@
     <select id="selectAccessibleIdentifiers" resultType="string">
 
         SELECT DISTINCT sharing_profile_id
-        FROM [dbo].[guacamole_sharing_profile_permission]
+        FROM [guacamole_sharing_profile_permission]
         WHERE
             user_id = #{user.objectID,jdbcType=INTEGER}
             AND sharing_profile_id IN
@@ -86,7 +86,7 @@
     <!-- Delete all given permissions -->
     <delete id="delete" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
 
-        DELETE FROM [dbo].[guacamole_sharing_profile_permission]
+        DELETE FROM [guacamole_sharing_profile_permission]
         WHERE
             <foreach collection="permissions" item="permission"
                      open="(" separator=" OR " close=")">
@@ -100,7 +100,7 @@
     <!-- Insert all given permissions -->
     <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
 
-        INSERT INTO [dbo].[guacamole_sharing_profile_permission] (
+        INSERT INTO [guacamole_sharing_profile_permission] (
             user_id,
             permission,
             sharing_profile_id
@@ -117,10 +117,10 @@
                        #{permission.objectIdentifier,jdbcType=INTEGER} AS sharing_profile_id
             </foreach>
         AS permissions
-        WHERE NOT EXISTS (SELECT 1 FROM [dbo].[guacamole_sharing_profile_permission]
-            WHERE [dbo].[guacamole_sharing_profile_permission].user_id = permissions.user_id
-            AND [dbo].[guacamole_sharing_profile_permission].permission = permissions.permission
-            AND [dbo].[guacamole_sharing_profile_permission].sharing_profile_id = permissions.sharing_profile_id
+        WHERE NOT EXISTS (SELECT 1 FROM [guacamole_sharing_profile_permission]
+            WHERE [guacamole_sharing_profile_permission].user_id = permissions.user_id
+            AND [guacamole_sharing_profile_permission].permission = permissions.permission
+            AND [guacamole_sharing_profile_permission].sharing_profile_id = permissions.sharing_profile_id
         );
 
     </insert>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/73301901/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SystemPermissionMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SystemPermissionMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SystemPermissionMapper.xml
index d33dd3b..663b94e 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SystemPermissionMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SystemPermissionMapper.xml
@@ -35,12 +35,12 @@
     <select id="select" resultMap="SystemPermissionResultMap">
 
         SELECT
-            [dbo].[guacamole_system_permission].user_id,
+            [guacamole_system_permission].user_id,
             username,
             permission
-        FROM [dbo].[guacamole_system_permission]
-        JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_system_permission].user_id = [dbo].[guacamole_user].user_id
-        WHERE [dbo].[guacamole_system_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+        FROM [guacamole_system_permission]
+        JOIN [guacamole_user] ON [guacamole_system_permission].user_id = [guacamole_user].user_id
+        WHERE [guacamole_system_permission].user_id = #{user.objectID,jdbcType=INTEGER}
 
     </select>
 
@@ -48,13 +48,13 @@
     <select id="selectOne" resultMap="SystemPermissionResultMap">
 
         SELECT
-            [dbo].[guacamole_system_permission].user_id,
+            [guacamole_system_permission].user_id,
             username,
             permission
-        FROM [dbo].[guacamole_system_permission]
-        JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_system_permission].user_id = [dbo].[guacamole_user].user_id
+        FROM [guacamole_system_permission]
+        JOIN [guacamole_user] ON [guacamole_system_permission].user_id = [guacamole_user].user_id
         WHERE
-            [dbo].[guacamole_system_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+            [guacamole_system_permission].user_id = #{user.objectID,jdbcType=INTEGER}
             AND permission = #{type,jdbcType=VARCHAR}
 
     </select>
@@ -62,7 +62,7 @@
     <!-- Delete all given permissions -->
     <delete id="delete" parameterType="org.apache.guacamole.auth.jdbc.permission.SystemPermissionModel">
 
-        DELETE FROM [dbo].[guacamole_system_permission]
+        DELETE FROM [guacamole_system_permission]
         WHERE
             <foreach collection="permissions" item="permission"
                      open="(" separator=" OR " close=")">
@@ -75,7 +75,7 @@
     <!-- Insert all given permissions -->
     <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.permission.SystemPermissionModel">
 
-        INSERT INTO [dbo].[guacamole_system_permission] (
+        INSERT INTO [guacamole_system_permission] (
             user_id,
             permission
         )
@@ -89,9 +89,9 @@
                        #{permission.type,jdbcType=VARCHAR} AS permission
             </foreach>
         AS permissions
-        WHERE NOT EXISTS (SELECT 1 FROM [dbo].[guacamole_system_permission]
-            WHERE [dbo].[guacamole_system_permission].user_id = permissions.user_id
-            AND [dbo].[guacamole_system_permission].permission = permissions.permission
+        WHERE NOT EXISTS (SELECT 1 FROM [guacamole_system_permission]
+            WHERE [guacamole_system_permission].user_id = permissions.user_id
+            AND [guacamole_system_permission].permission = permissions.permission
         );
 
     </insert>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/73301901/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/UserPermissionMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/UserPermissionMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/UserPermissionMapper.xml
index a2d416f..453777d 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/UserPermissionMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/UserPermissionMapper.xml
@@ -36,14 +36,14 @@
     <select id="select" resultMap="UserPermissionResultMap">
 
         SELECT
-            [dbo].[guacamole_user_permission].user_id,
-            [dbo].[guacamole_user].username,
+            [guacamole_user_permission].user_id,
+            [guacamole_user].username,
             permission,
             affected.username AS affected_username
-        FROM [dbo].[guacamole_user_permission]
-        JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_user_permission].user_id = [dbo].[guacamole_user].user_id
-        JOIN [dbo].[guacamole_user] affected ON [dbo].[guacamole_user_permission].affected_user_id = affected.user_id
-        WHERE [dbo].[guacamole_user_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+        FROM [guacamole_user_permission]
+        JOIN [guacamole_user] ON [guacamole_user_permission].user_id = [guacamole_user].user_id
+        JOIN [guacamole_user] affected ON [guacamole_user_permission].affected_user_id = affected.user_id
+        WHERE [guacamole_user_permission].user_id = #{user.objectID,jdbcType=INTEGER}
 
     </select>
 
@@ -51,15 +51,15 @@
     <select id="selectOne" resultMap="UserPermissionResultMap">
 
         SELECT
-            [dbo].[guacamole_user_permission].user_id,
-            [dbo].[guacamole_user].username,
+            [guacamole_user_permission].user_id,
+            [guacamole_user].username,
             permission,
             affected.username AS affected_username
-        FROM [dbo].[guacamole_user_permission]
-        JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_user_permission].user_id = [dbo].[guacamole_user].user_id
-        JOIN [dbo].[guacamole_user] affected ON [dbo].[guacamole_user_permission].affected_user_id = affected.user_id
+        FROM [guacamole_user_permission]
+        JOIN [guacamole_user] ON [guacamole_user_permission].user_id = [guacamole_user].user_id
+        JOIN [guacamole_user] affected ON [guacamole_user_permission].affected_user_id = affected.user_id
         WHERE
-            [dbo].[guacamole_user_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+            [guacamole_user_permission].user_id = #{user.objectID,jdbcType=INTEGER}
             AND permission = #{type,jdbcType=VARCHAR}
             AND affected.username = #{identifier,jdbcType=INTEGER}
 
@@ -69,10 +69,10 @@
     <select id="selectAccessibleIdentifiers" resultType="string">
 
         SELECT DISTINCT username
-        FROM [dbo].[guacamole_user_permission]
-        JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_user_permission].affected_user_id = [dbo].[guacamole_user].user_id
+        FROM [guacamole_user_permission]
+        JOIN [guacamole_user] ON [guacamole_user_permission].affected_user_id = [guacamole_user].user_id
         WHERE
-            [dbo].[guacamole_user_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+            [guacamole_user_permission].user_id = #{user.objectID,jdbcType=INTEGER}
             AND username IN
                 <foreach collection="identifiers" item="identifier"
                          open="(" separator="," close=")">
@@ -89,11 +89,11 @@
     <!-- Delete all given permissions -->
     <delete id="delete" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
 
-        DELETE FROM [dbo].[guacamole_user_permission]
-        USING [dbo].[guacamole_user] affected
+        DELETE FROM [guacamole_user_permission]
+        USING [guacamole_user] affected
         WHERE
-            [dbo].[guacamole_user_permission].affected_user_id = affected.user_id
-            AND ([dbo].[guacamole_user_permission].user_id, permission, affected.username) IN
+            [guacamole_user_permission].affected_user_id = affected.user_id
+            AND ([guacamole_user_permission].user_id, permission, affected.username) IN
                 <foreach collection="permissions" item="permission"
                          open="(" separator="," close=")">
                     (#{permission.userID,jdbcType=INTEGER},
@@ -106,7 +106,7 @@
     <!-- Insert all given permissions -->
     <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
 
-        INSERT INTO [dbo].[guacamole_user_permission] (
+        INSERT INTO [guacamole_user_permission] (
             user_id,
             permission,
             affected_user_id
@@ -114,7 +114,7 @@
         SELECT DISTINCT
             permissions.user_id,
             permissions.permission,
-            [dbo].[guacamole_user].user_id
+            [guacamole_user].user_id
         FROM
             <foreach collection="permissions" item="permission"
                      open="(" separator="UNION ALL" close=")">
@@ -123,11 +123,11 @@
                        #{permission.objectIdentifier,jdbcType=INTEGER}                       AS username
             </foreach>
         AS permissions
-        JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_user].username = permissions.username
-        WHERE NOT EXISTS (SELECT 1 FROM [dbo].[guacamole_user_permission]
-            WHERE [dbo].[guacamole_user_permission].user_id = permissions.user_id
-            AND [dbo].[guacamole_user_permission].permission = permissions.permission
-            AND [dbo].[guacamole_user_permission].affected_user_id = [dbo].[guacamole_user].user_id
+        JOIN [guacamole_user] ON [guacamole_user].username = permissions.username
+        WHERE NOT EXISTS (SELECT 1 FROM [guacamole_user_permission]
+            WHERE [guacamole_user_permission].user_id = permissions.user_id
+            AND [guacamole_user_permission].permission = permissions.permission
+            AND [guacamole_user_permission].affected_user_id = [guacamole_user].user_id
         );
 
     </insert>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/73301901/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileMapper.xml
index d3b5c10..3b4ba09 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileMapper.xml
@@ -33,13 +33,13 @@
     <!-- Select all sharing profile identifiers -->
     <select id="selectIdentifiers" resultType="string">
         SELECT sharing_profile_id
-        FROM [dbo].[guacamole_sharing_profile]
+        FROM [guacamole_sharing_profile]
     </select>
 
     <!-- Select identifiers of all readable sharing profiles -->
     <select id="selectReadableIdentifiers" resultType="string">
         SELECT sharing_profile_id
-        FROM [dbo].[guacamole_sharing_profile_permission]
+        FROM [guacamole_sharing_profile_permission]
         WHERE
             user_id = #{user.objectID,jdbcType=INTEGER}
             AND permission = 'READ'
@@ -52,7 +52,7 @@
             sharing_profile_id,
             sharing_profile_name,
             primary_connection_id
-        FROM [dbo].[guacamole_sharing_profile]
+        FROM [guacamole_sharing_profile]
         WHERE sharing_profile_id IN
             <foreach collection="identifiers" item="identifier"
                      open="(" separator="," close=")">
@@ -65,12 +65,12 @@
     <select id="selectReadable" resultMap="SharingProfileResultMap">
 
         SELECT
-            [dbo].[guacamole_sharing_profile].sharing_profile_id,
-            [dbo].[guacamole_sharing_profile].sharing_profile_name,
+            [guacamole_sharing_profile].sharing_profile_id,
+            [guacamole_sharing_profile].sharing_profile_name,
             primary_connection_id
-        FROM [dbo].[guacamole_sharing_profile]
-        JOIN [dbo].[guacamole_sharing_profile_permission] ON [dbo].[guacamole_sharing_profile_permission].sharing_profile_id = [dbo].[guacamole_sharing_profile].sharing_profile_id
-        WHERE [dbo].[guacamole_sharing_profile].sharing_profile_id IN
+        FROM [guacamole_sharing_profile]
+        JOIN [guacamole_sharing_profile_permission] ON [guacamole_sharing_profile_permission].sharing_profile_id = [guacamole_sharing_profile].sharing_profile_id
+        WHERE [guacamole_sharing_profile].sharing_profile_id IN
             <foreach collection="identifiers" item="identifier"
                      open="(" separator="," close=")">
                 #{identifier,jdbcType=INTEGER}
@@ -87,7 +87,7 @@
             sharing_profile_id,
             sharing_profile_name,
             primary_connection_id
-        FROM [dbo].[guacamole_sharing_profile]
+        FROM [guacamole_sharing_profile]
         WHERE 
             primary_connection_id = #{parentIdentifier,jdbcType=INTEGER}
             AND sharing_profile_name = #{name,jdbcType=VARCHAR}
@@ -96,7 +96,7 @@
 
     <!-- Delete single sharing profile by identifier -->
     <delete id="delete">
-        DELETE FROM [dbo].[guacamole_sharing_profile]
+        DELETE FROM [guacamole_sharing_profile]
         WHERE sharing_profile_id = #{identifier,jdbcType=INTEGER}
     </delete>
 
@@ -104,7 +104,7 @@
     <insert id="insert" useGeneratedKeys="true" keyProperty="object.objectID"
             parameterType="org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileModel">
 
-        INSERT INTO [dbo].[guacamole_sharing_profile] (
+        INSERT INTO [guacamole_sharing_profile] (
             sharing_profile_name,
             primary_connection_id
         )
@@ -117,7 +117,7 @@
 
     <!-- Update single sharing profile -->
     <update id="update" parameterType="org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileModel">
-        UPDATE [dbo].[guacamole_sharing_profile]
+        UPDATE [guacamole_sharing_profile]
         SET sharing_profile_name  = #{object.name,jdbcType=VARCHAR},
             primary_connection_id = #{object.parentIdentifier,jdbcType=INTEGER}
         WHERE sharing_profile_id = #{object.objectID,jdbcType=INTEGER}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/73301901/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileParameterMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileParameterMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileParameterMapper.xml
index c902276..a4327b4 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileParameterMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileParameterMapper.xml
@@ -36,21 +36,21 @@
             sharing_profile_id,
             parameter_name,
             parameter_value
-        FROM [dbo].[guacamole_sharing_profile_parameter]
+        FROM [guacamole_sharing_profile_parameter]
         WHERE
             sharing_profile_id = #{identifier,jdbcType=INTEGER}
     </select>
 
     <!-- Delete all parameters of a given sharing profile -->
     <delete id="delete">
-        DELETE FROM [dbo].[guacamole_sharing_profile_parameter]
+        DELETE FROM [guacamole_sharing_profile_parameter]
         WHERE sharing_profile_id = #{identifier,jdbcType=INTEGER}
     </delete>
 
     <!-- Insert all given parameters -->
     <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileParameterModel">
 
-        INSERT INTO [dbo].[guacamole_sharing_profile_parameter] (
+        INSERT INTO [guacamole_sharing_profile_parameter] (
             sharing_profile_id,
             parameter_name,
             parameter_value

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/73301901/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/user/PasswordRecordMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/user/PasswordRecordMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/user/PasswordRecordMapper.xml
index a9f44e6..562a747 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/user/PasswordRecordMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/user/PasswordRecordMapper.xml
@@ -35,16 +35,16 @@
     <select id="select" resultMap="PasswordRecordResultMap">
 
         SELECT
-            [dbo].[guacamole_user_password_history].user_id,
-            [dbo].[guacamole_user_password_history].password_hash,
-            [dbo].[guacamole_user_password_history].password_salt,
-            [dbo].[guacamole_user_password_history].password_date
-        FROM [dbo].[guacamole_user_password_history]
-        JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_user_password_history].user_id = [dbo].[guacamole_user].user_id
+            [guacamole_user_password_history].user_id,
+            [guacamole_user_password_history].password_hash,
+            [guacamole_user_password_history].password_salt,
+            [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
         WHERE
-            [dbo].[guacamole_user].username = #{username,jdbcType=VARCHAR}
+            [guacamole_user].username = #{username,jdbcType=VARCHAR}
         ORDER BY
-            [dbo].[guacamole_user_password_history].password_date DESC
+            [guacamole_user_password_history].password_date DESC
         LIMIT #{maxHistorySize}
 
     </select>
@@ -52,7 +52,7 @@
     <!-- Insert the given password record -->
     <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.user.PasswordRecordModel">
 
-        INSERT INTO [dbo].[guacamole_user_password_history] (
+        INSERT INTO [guacamole_user_password_history] (
             user_id,
             password_hash,
             password_salt,
@@ -65,10 +65,10 @@
             #{record.passwordDate,jdbcType=TIMESTAMP}
         );
 
-        DELETE FROM [dbo].[guacamole_user_password_history]
+        DELETE FROM [guacamole_user_password_history]
         WHERE password_history_id IN (
             SELECT password_history_id
-            FROM [dbo].[guacamole_user_password_history]
+            FROM [guacamole_user_password_history]
             WHERE user_id = #{record.userID,jdbcType=INTEGER}
             ORDER BY password_date DESC
             OFFSET #{maxHistorySize}


[19/28] incubator-guacamole-client git commit: GUACAMOLE-363: Switch to 4000 for nvarchar size instead of max.

Posted by mj...@apache.org.
GUACAMOLE-363: Switch to 4000 for nvarchar size instead of max.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/7ecd3915
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/7ecd3915
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/7ecd3915

Branch: refs/heads/master
Commit: 7ecd3915c6a65a94c57b3d2c181501626e0595d7
Parents: 82d1b14
Author: Nick Couchman <vn...@apache.org>
Authored: Wed Sep 27 08:56:28 2017 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Thu Sep 28 07:00:52 2017 -0400

----------------------------------------------------------------------
 .../guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/7ecd3915/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
index 6c3cd7b..5bb2f8a 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
@@ -223,7 +223,7 @@ SET QUOTED_IDENTIFIER ON;
 CREATE TABLE [guacamole_connection_parameter](
     [connection_id] [int] NOT NULL,
     [parameter_name] [nvarchar](128) NOT NULL,
-    [parameter_value] [nvarchar](max) NOT NULL,
+    [parameter_value] [nvarchar](4000) NOT NULL,
 
     CONSTRAINT [PK_guacamole_connection_parameter] PRIMARY KEY CLUSTERED 
         ([connection_id] ASC, [parameter_name] ASC)
@@ -256,7 +256,7 @@ SET QUOTED_IDENTIFIER ON;
 CREATE TABLE [guacamole_sharing_profile_parameter](
     [sharing_profile_id] [int] NOT NULL,
     [parameter_name] [nvarchar](128) NOT NULL,
-    [parameter_value] [nvarchar](max) NOT NULL,
+    [parameter_value] [nvarchar](4000) NOT NULL,
 
     CONSTRAINT [PK_guacamole_sharing_profile_parameter] PRIMARY KEY CLUSTERED 
         ([sharing_profile_id] ASC, [parameter_name] ASC)


[10/28] incubator-guacamole-client git commit: GUACAMOLE-363: Fix encoding of SQL file

Posted by mj...@apache.org.
GUACAMOLE-363: Fix encoding of SQL file


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/60d61527
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/60d61527
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/60d61527

Branch: refs/heads/master
Commit: 60d615274181f28de54bd7e00a3eb2d14f9a43eb
Parents: 63c541b
Author: Nick Couchman <vn...@apache.org>
Authored: Tue Aug 15 19:56:00 2017 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Thu Sep 28 07:00:52 2017 -0400

----------------------------------------------------------------------
 .../schema/001-create-schema.sql                | Bin 37808 -> 18903 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/60d61527/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
index 166e14f..83299a1 100644
Binary files a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql and b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql differ


[03/28] incubator-guacamole-client git commit: GUACAMOLE-363: Remove unnecessary parameters that are already using default values.

Posted by mj...@apache.org.
GUACAMOLE-363: Remove unnecessary parameters that are already using default values.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/57dab6e8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/57dab6e8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/57dab6e8

Branch: refs/heads/master
Commit: 57dab6e815f61306478dbf7e404491149292224f
Parents: b4d2f87
Author: Nick Couchman <vn...@apache.org>
Authored: Wed Sep 27 10:17:13 2017 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Thu Sep 28 07:00:52 2017 -0400

----------------------------------------------------------------------
 .../schema/001-create-schema.sql                | 143 ++++---------------
 1 file changed, 25 insertions(+), 118 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/57dab6e8/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
index 5bb2f8a..a52ad7f 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
@@ -18,6 +18,17 @@
  */
 
 /**
+ * Turn on ANSI_NULLS for the entire DB to make it ISO-compliant.
+ */
+ALTER DATABASE CURRENT SET ANSI_NULLS ON;
+GO;
+
+/**
+ * Turn on QUOTED_IDENTIFIER for the entire DB.
+ */
+ALTER DATABASE CURRENT SET QUOTED_IDENTIFIER ON;
+
+/**
  * List for permission data type.
  */
 CREATE RULE [guacamole_permission_list] 
@@ -53,8 +64,6 @@ GO;
 /**
  * The connection_group table stores organizational and balancing groups.
  */
-SET ANSI_NULLS ON;
-SET QUOTED_IDENTIFIER ON;
 CREATE TABLE [guacamole_connection_group](
     [connection_group_id] [int] IDENTITY(1,1) NOT NULL,
     [parent_id] [int] NULL,
@@ -65,13 +74,7 @@ CREATE TABLE [guacamole_connection_group](
     [enable_session_affinity] [bit] NOT NULL,
 
     CONSTRAINT [PK_guacmaole_connection_group] PRIMARY KEY CLUSTERED
-        ([connection_group_id] ASC)
-        WITH (PAD_INDEX = OFF,
-            STATISTICS_NORECOMPUTE = OFF,
-            IGNORE_DUP_KEY = OFF,
-            ALLOW_ROW_LOCKS = ON,
-            ALLOW_PAGE_LOCKS = ON)
-       ON [PRIMARY]
+        ([connection_group_id] ASC) ON [PRIMARY]
 ) ON [PRIMARY];
 
 /**
@@ -100,8 +103,6 @@ GO;
 /**
  * The connection table, for storing connections and attributes.
  */
-SET ANSI_NULLS ON;
-SET QUOTED_IDENTIFIER ON;
 CREATE TABLE [guacamole_connection](
     [connection_id] [int] IDENTITY(1,1) NOT NULL,
     [connection_name] [nvarchar](128) NOT NULL,
@@ -116,13 +117,7 @@ CREATE TABLE [guacamole_connection](
     [failover_only] [bit] NOT NULL,
 
     CONSTRAINT [PK_guacamole_connection] PRIMARY KEY CLUSTERED
-	([connection_id] ASC)
-        WITH (PAD_INDEX = OFF, 
-            STATISTICS_NORECOMPUTE = OFF,
-            IGNORE_DUP_KEY = OFF,
-            ALLOW_ROW_LOCKS = ON,
-            ALLOW_PAGE_LOCKS = ON)
-        ON [PRIMARY]
+	([connection_id] ASC) ON [PRIMARY]
 ) ON [PRIMARY];
 
 ALTER TABLE [guacamole_connection]
@@ -142,8 +137,6 @@ GO;
 /**
  * The user table stores user accounts, passwords, and properties.
  */
-SET ANSI_NULLS ON;
-SET QUOTED_IDENTIFIER ON;
 CREATE TABLE [guacamole_user](
     [user_id] [int] IDENTITY(1,1) NOT NULL,
     [username] [nvarchar](128) NOT NULL,
@@ -163,13 +156,7 @@ CREATE TABLE [guacamole_user](
     [organizational_role] [nvarchar](256) NULL,
 
     CONSTRAINT [PK_guacamole_user] PRIMARY KEY CLUSTERED 
-        ([user_id] ASC)
-        WITH (PAD_INDEX = OFF,
-            STATISTICS_NORECOMPUTE = OFF,
-            IGNORE_DUP_KEY = OFF,
-            ALLOW_ROW_LOCKS = ON,
-            ALLOW_PAGE_LOCKS = ON)
-        ON [PRIMARY]
+        ([user_id] ASC) ON [PRIMARY]
 ) ON [PRIMARY];
 
 /**
@@ -185,21 +172,13 @@ GO;
  * The sharing_profile table stores profiles that allow
  * connections to be shared amongst multiple users.
  */
-SET ANSI_NULLS ON;
-SET QUOTED_IDENTIFIER ON;
 CREATE TABLE [guacamole_sharing_profile](
     [sharing_profile_id] [int] IDENTITY(1,1) NOT NULL,
     [sharing_profile_name] [nvarchar](128) NOT NULL,
     [primary_connection_id] [int] NOT NULL,
 
     CONSTRAINT [PK_guacamole_sharing_profile] PRIMARY KEY CLUSTERED 
-        ([sharing_profile_id] ASC)
-        WITH (PAD_INDEX = OFF,
-            STATISTICS_NORECOMPUTE = OFF,
-            IGNORE_DUP_KEY = OFF,
-            ALLOW_ROW_LOCKS = ON,
-            ALLOW_PAGE_LOCKS = ON)
-        ON [PRIMARY]
+        ([sharing_profile_id] ASC) ON [PRIMARY]
 ) ON [PRIMARY];
 
 /**
@@ -218,21 +197,13 @@ GO;
  * The connection_parameter table stores parameters for
  * connection objects.
  */
-SET ANSI_NULLS ON;
-SET QUOTED_IDENTIFIER ON;
 CREATE TABLE [guacamole_connection_parameter](
     [connection_id] [int] NOT NULL,
     [parameter_name] [nvarchar](128) NOT NULL,
     [parameter_value] [nvarchar](4000) NOT NULL,
 
     CONSTRAINT [PK_guacamole_connection_parameter] PRIMARY KEY CLUSTERED 
-        ([connection_id] ASC, [parameter_name] ASC)
-        WITH (PAD_INDEX = OFF,
-            STATISTICS_NORECOMPUTE = OFF,
-            IGNORE_DUP_KEY = OFF,
-            ALLOW_ROW_LOCKS = ON,
-            ALLOW_PAGE_LOCKS = ON)
-        ON [PRIMARY]
+        ([connection_id] ASC, [parameter_name] ASC) ON [PRIMARY]
 ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY];
 
 /**
@@ -251,21 +222,13 @@ GO;
  * The sharing_profile_parameter table stores parameters
  * for sharing_profile objects.
  */
-SET ANSI_NULLS ON;
-SET QUOTED_IDENTIFIER ON;
 CREATE TABLE [guacamole_sharing_profile_parameter](
     [sharing_profile_id] [int] NOT NULL,
     [parameter_name] [nvarchar](128) NOT NULL,
     [parameter_value] [nvarchar](4000) NOT NULL,
 
     CONSTRAINT [PK_guacamole_sharing_profile_parameter] PRIMARY KEY CLUSTERED 
-        ([sharing_profile_id] ASC, [parameter_name] ASC)
-        WITH (PAD_INDEX = OFF,
-            STATISTICS_NORECOMPUTE = OFF,
-            IGNORE_DUP_KEY = OFF,
-            ALLOW_ROW_LOCKS = ON,
-            ALLOW_PAGE_LOCKS = ON)
-        ON [PRIMARY]
+        ([sharing_profile_id] ASC, [parameter_name] ASC) ON [PRIMARY]
 ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY];
 
 /**
@@ -285,21 +248,13 @@ GO;
  * The connection_permission table stores permission
  * mappings for connection objects.
  */
-SET ANSI_NULLS ON;
-SET QUOTED_IDENTIFIER ON;
 CREATE TABLE [guacamole_connection_permission](
     [user_id] [int] NOT NULL,
     [connection_id] [int] NOT NULL,
     [permission] [guacamole_permission] NOT NULL,
 
     CONSTRAINT [PK_guacamole_connection_permission] PRIMARY KEY CLUSTERED 
-        ([user_id] ASC, [connection_id] ASC, [permission] ASC)
-        WITH (PAD_INDEX = OFF,
-            STATISTICS_NORECOMPUTE = OFF,
-            IGNORE_DUP_KEY = OFF,
-            ALLOW_ROW_LOCKS = ON,
-            ALLOW_PAGE_LOCKS = ON)
-        ON [PRIMARY]
+        ([user_id] ASC, [connection_id] ASC, [permission] ASC) ON [PRIMARY]
 ) ON [PRIMARY];
 
 /**
@@ -325,21 +280,13 @@ GO;
  * The connection_group_permission table stores permission mappings for
  * connection_group objects.
  */
-SET ANSI_NULLS ON;
-SET QUOTED_IDENTIFIER ON;
 CREATE TABLE [guacamole_connection_group_permission](
     [user_id] [int] NOT NULL,
     [connection_group_id] [int] NOT NULL,
     [permission] [guacamole_permission] NOT NULL,
 
     CONSTRAINT [PK_guacamole_connection_group_permission] PRIMARY KEY CLUSTERED 
-        ([user_id] ASC,	[connection_group_id] ASC, [permission] ASC)
-        WITH (PAD_INDEX = OFF,
-            STATISTICS_NORECOMPUTE = OFF,
-            IGNORE_DUP_KEY = OFF,
-            ALLOW_ROW_LOCKS = ON,
-            ALLOW_PAGE_LOCKS = ON) 
-        ON [PRIMARY]
+        ([user_id] ASC,	[connection_group_id] ASC, [permission] ASC) ON [PRIMARY]
 ) ON [PRIMARY];
 
 /**
@@ -365,21 +312,13 @@ GO;
  * The sharing_profile_permission table stores permission
  * mappings for sharing_profile objects.
  */
-SET ANSI_NULLS ON;
-SET QUOTED_IDENTIFIER ON;
 CREATE TABLE [guacamole_sharing_profile_permission](
     [user_id] [int] NOT NULL,
     [sharing_profile_id] [int] NOT NULL,
     [permission] [guacamole_permission] NOT NULL,
 
     CONSTRAINT [PK_guacamole_sharing_profile_permission] PRIMARY KEY CLUSTERED 
-        ([user_id] ASC, [sharing_profile_id] ASC, [permission] ASC)
-        WITH (PAD_INDEX = OFF,
-            STATISTICS_NORECOMPUTE = OFF,
-            IGNORE_DUP_KEY = OFF,
-            ALLOW_ROW_LOCKS = ON,
-            ALLOW_PAGE_LOCKS = ON)
-        ON [PRIMARY]
+        ([user_id] ASC, [sharing_profile_id] ASC, [permission] ASC) ON [PRIMARY]
 ) ON [PRIMARY];
 
 /**
@@ -405,20 +344,12 @@ GO;
  * The system_permission table stores permission mappings
  * for system-level operations.
  */
-SET ANSI_NULLS ON;
-SET QUOTED_IDENTIFIER ON;
 CREATE TABLE [guacamole_system_permission](
     [user_id] [int] NOT NULL,
     [permission] [guacamole_system_permission] NOT NULL,
 
     CONSTRAINT [PK_guacamole_system_permission] PRIMARY KEY CLUSTERED 
-        ([user_id] ASC,	[permission] ASC)
-        WITH (PAD_INDEX = OFF,
-            STATISTICS_NORECOMPUTE = OFF,
-            IGNORE_DUP_KEY = OFF,
-            ALLOW_ROW_LOCKS = ON,
-            ALLOW_PAGE_LOCKS = ON)
-        ON [PRIMARY]
+        ([user_id] ASC,	[permission] ASC) ON [PRIMARY]
 ) ON [PRIMARY];
 
 /**
@@ -437,21 +368,13 @@ GO;
  * The user_permission table stores permission mappings
  * for users to other users.
  */
-SET ANSI_NULLS ON;
-SET QUOTED_IDENTIFIER ON;
 CREATE TABLE [guacamole_user_permission](
     [user_id] [int] NOT NULL,
     [affected_user_id] [int] NOT NULL,
     [permission] [guacamole_permission] NOT NULL,
 
     CONSTRAINT [PK_guacamole_user_permission] PRIMARY KEY CLUSTERED 
-        ([user_id] ASC,	[affected_user_id] ASC,	[permission] ASC)
-        WITH (PAD_INDEX = OFF,
-            STATISTICS_NORECOMPUTE = OFF,
-            IGNORE_DUP_KEY = OFF,
-            ALLOW_ROW_LOCKS = ON,
-            ALLOW_PAGE_LOCKS = ON)
-        ON [PRIMARY]
+        ([user_id] ASC,	[affected_user_id] ASC,	[permission] ASC) ON [PRIMARY]
 ) ON [PRIMARY];
 
 /**
@@ -475,8 +398,6 @@ GO;
  * The connection_history table stores records for historical
  * connections.
  */
-SET ANSI_NULLS ON;
-SET QUOTED_IDENTIFIER ON;
 CREATE TABLE [guacamole_connection_history](
     [history_id] [int] IDENTITY(1,1) NOT NULL,
     [user_id] [int] NULL,
@@ -490,13 +411,7 @@ CREATE TABLE [guacamole_connection_history](
     [end_date] [datetime] NULL,
 
     CONSTRAINT [PK_guacamole_connection_history] PRIMARY KEY CLUSTERED 
-        ([history_id] ASC)
-        WITH (PAD_INDEX = OFF,
-            STATISTICS_NORECOMPUTE = OFF,
-            IGNORE_DUP_KEY = OFF,
-            ALLOW_ROW_LOCKS = ON,
-            ALLOW_PAGE_LOCKS = ON)
-        ON [PRIMARY]
+        ([history_id] ASC) ON [PRIMARY]
 ) ON [PRIMARY];
 
 /**
@@ -510,7 +425,7 @@ ALTER TABLE [guacamole_connection_history]
 ALTER TABLE [guacamole_connection_history]
     CHECK CONSTRAINT [FK_guacamole_connection_history_connection];
 ALTER TABLE [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_sharing_profile] ([sharing_profile_id]);
 ALTER TABLE [guacamole_connection_history]
     CHECK CONSTRAINT [FK_guacamole_connection_history_sharing_profile];
@@ -528,8 +443,6 @@ GO;
  * for users, allowing for enforcing rules associated with
  * reuse of passwords.
  */
-SET ANSI_NULLS ON;
-SET QUOTED_IDENTIFIER ON;
 CREATE TABLE [guacamole_user_password_history](
     [password_history_id] [int] IDENTITY(1,1) NOT NULL,
     [user_id] [int] NOT NULL,
@@ -538,13 +451,7 @@ CREATE TABLE [guacamole_user_password_history](
     [password_date] [datetime] NOT NULL,
 
     CONSTRAINT [PK_guacamole_user_password_history] PRIMARY KEY CLUSTERED 
-        ([password_history_id] ASC)
-        WITH (PAD_INDEX = OFF,
-            STATISTICS_NORECOMPUTE = OFF,
-            IGNORE_DUP_KEY = OFF,
-            ALLOW_ROW_LOCKS = ON,
-            ALLOW_PAGE_LOCKS = ON)
-        ON [PRIMARY]
+        ([password_history_id] ASC) ON [PRIMARY]
 ) ON [PRIMARY];
 
 /**


[21/28] incubator-guacamole-client git commit: GUACAMOLE-363: Make table names standard in schema creation scripts.

Posted by mj...@apache.org.
GUACAMOLE-363: Make table names standard in schema creation scripts.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/c803be5c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/c803be5c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/c803be5c

Branch: refs/heads/master
Commit: c803be5c7a847bebc55790cc9d37ac0da8a24445
Parents: 70c33ef
Author: Nick Couchman <vn...@apache.org>
Authored: Sat Aug 26 21:07:58 2017 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Thu Sep 28 07:00:52 2017 -0400

----------------------------------------------------------------------
 .../schema/001-create-schema.sql                | 283 ++++++++++---------
 .../schema/002-create-admin-user.sql            |  12 +-
 2 files changed, 148 insertions(+), 147 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/c803be5c/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
index 759e78d..44e498e 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
@@ -22,10 +22,11 @@
  */
 CREATE SCHEMA [guacamole]
 GO
+
 /**
  * List for permission data type.
  */
-CREATE RULE [guacamole].[permission_list] 
+CREATE RULE [guacamole].[guacamole_permission_list] 
     AS
     @list IN ('READ','UPDATE','DELETE','ADMINISTER')
 GO
@@ -33,7 +34,7 @@ GO
 /**
  * List for system permission data type.
  */
-CREATE RULE [guacamole].[system_permission_list] 
+CREATE RULE [guacamole].[guacamole_system_permission_list] 
     AS
     @list IN ('CREATE_CONNECTION',
         'CREATE_CONNECTION_GROUP',
@@ -45,12 +46,12 @@ GO
 /**
  * The permission data type.
  */
-CREATE TYPE [guacamole].[permission] FROM [nvarchar](10) NOT NULL
+CREATE TYPE [guacamole].[guacamole_permission] FROM [nvarchar](10) NOT NULL
 
 /**
  * The system permission data type.
  */
-CREATE TYPE [guacamole].[system_permission] FROM [nvarchar](32) NOT NULL
+CREATE TYPE [guacamole].[guacamole_system_permission] FROM [nvarchar](32) NOT NULL
 GO
 
 /**
@@ -58,7 +59,7 @@ GO
  */
 SET ANSI_NULLS ON
 SET QUOTED_IDENTIFIER ON
-CREATE TABLE [guacamole].[connection_group](
+CREATE TABLE [guacamole].[guacamole_connection_group](
     [connection_group_id] [int] IDENTITY(1,1) NOT NULL,
     [parent_id] [int] NULL,
     [connection_group_name] [nvarchar](128) NOT NULL,
@@ -67,7 +68,7 @@ CREATE TABLE [guacamole].[connection_group](
     [max_connections_per_user] [int] NULL,
     [enable_session_affinity] [bit] NOT NULL,
 
-    CONSTRAINT [PK_connection_group] PRIMARY KEY CLUSTERED
+    CONSTRAINT [PK_guacmaole_connection_group] PRIMARY KEY CLUSTERED
         ([connection_group_id] ASC)
         WITH (PAD_INDEX = OFF,
             STATISTICS_NORECOMPUTE = OFF,
@@ -80,24 +81,24 @@ CREATE TABLE [guacamole].[connection_group](
 /**
  * Foreign keys for connection_group table.
  */
-ALTER TABLE [guacamole].[connection_group]
-    WITH CHECK ADD  CONSTRAINT [FK_connection_group_connection_group] FOREIGN KEY([parent_id])
-    REFERENCES [guacamole].[connection_group] ([connection_group_id])
-ALTER TABLE [guacamole].[connection_group]
-    CHECK CONSTRAINT [FK_connection_group_connection_group]
-ALTER TABLE [guacamole].[connection_group]
-    WITH CHECK ADD CONSTRAINT [CK_connection_group_type] 
+ALTER TABLE [guacamole].[guacamole_connection_group]
+    WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_group_connection_group_id] FOREIGN KEY([parent_id])
+    REFERENCES [guacamole].[guacamole_connection_group] ([connection_group_id])
+ALTER TABLE [guacamole].[guacamole_connection_group]
+    CHECK CONSTRAINT [FK_guacamole_connection_group_connection_group_id]
+ALTER TABLE [guacamole].[guacamole_connection_group]
+    WITH CHECK ADD CONSTRAINT [CK_guacamole_connection_group_type] 
     CHECK (([type]='BALANCING' OR [type]='ORGANIZATIONAL'))
-ALTER TABLE [guacamole].[connection_group]
-    CHECK CONSTRAINT [CK_connection_group_type]
+ALTER TABLE [guacamole].[guacamole_connection_group]
+    CHECK CONSTRAINT [CK_guacamole_connection_group_type]
 
 /**
  * Default values for connection_group table.
  */
-ALTER TABLE [guacamole].[connection_group]
-    ADD CONSTRAINT [DF_connection_group_type] DEFAULT (N'ORGANIZATIONAL') FOR [type]
-ALTER TABLE [guacamole].[connection_group]
-    ADD CONSTRAINT [DF_connection_group_enable_session_affinity] DEFAULT ((0)) FOR [enable_session_affinity]
+ALTER TABLE [guacamole].[guacamole_connection_group]
+    ADD CONSTRAINT [DF_guacamole_connection_group_type] DEFAULT (N'ORGANIZATIONAL') FOR [type]
+ALTER TABLE [guacamole].[guacamole_connection_group]
+    ADD CONSTRAINT [DF_guacamole_connection_group_enable_session_affinity] DEFAULT ((0)) FOR [enable_session_affinity]
 GO
 
 /**
@@ -105,7 +106,7 @@ GO
  */
 SET ANSI_NULLS ON
 SET QUOTED_IDENTIFIER ON
-CREATE TABLE [guacamole].[connection](
+CREATE TABLE [guacamole].[guacamole_connection](
     [connection_id] [int] IDENTITY(1,1) NOT NULL,
     [connection_name] [nvarchar](128) NOT NULL,
     [parent_id] [int] NULL,
@@ -118,7 +119,7 @@ CREATE TABLE [guacamole].[connection](
     [connection_weight] [int] NULL,
     [failover_only] [bit] NOT NULL,
 
-    CONSTRAINT [PK_connection] PRIMARY KEY CLUSTERED
+    CONSTRAINT [PK_guacamole_connection] PRIMARY KEY CLUSTERED
 	([connection_id] ASC)
         WITH (PAD_INDEX = OFF, 
             STATISTICS_NORECOMPUTE = OFF,
@@ -128,18 +129,18 @@ CREATE TABLE [guacamole].[connection](
         ON [PRIMARY]
 ) ON [PRIMARY]
 
-ALTER TABLE [guacamole].[connection]
-    WITH CHECK ADD CONSTRAINT [FK_connection_connection_group] FOREIGN KEY([parent_id])
-REFERENCES [guacamole].[connection_group] ([connection_group_id])
-ALTER TABLE [guacamole].[connection]
-    CHECK CONSTRAINT [FK_connection_connection_group]
-ALTER TABLE [guacamole].[connection]
+ALTER TABLE [guacamole].[guacamole_connection]
+    WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_connection_group] FOREIGN KEY([parent_id])
+REFERENCES [guacamole].[guacamole_connection_group] ([connection_group_id])
+ALTER TABLE [guacamole].[guacamole_connection]
+    CHECK CONSTRAINT [FK_guacamole_connection_connection_group]
+ALTER TABLE [guacamole].[guacamole_connection]
     WITH CHECK ADD CONSTRAINT [CK_proxy_encryption_method]
     CHECK  (([proxy_encryption_method]='SSL' OR [proxy_encryption_method]='NONE'))
-ALTER TABLE [guacamole].[connection]
+ALTER TABLE [guacamole].[guacamole_connection]
     CHECK CONSTRAINT [CK_proxy_encryption_method]
-ALTER TABLE [guacamole].[connection]
-    ADD CONSTRAINT [DF_connection_failover_only] DEFAULT ((0)) FOR [failover_only]
+ALTER TABLE [guacamole].[guacamole_connection]
+    ADD CONSTRAINT [DF_guacamole_connection_failover_only] DEFAULT ((0)) FOR [failover_only]
 GO
 
 /**
@@ -147,7 +148,7 @@ GO
  */
 SET ANSI_NULLS ON
 SET QUOTED_IDENTIFIER ON
-CREATE TABLE [guacamole].[user](
+CREATE TABLE [guacamole].[guacamole_user](
     [user_id] [int] IDENTITY(1,1) NOT NULL,
     [username] [nvarchar](128) NOT NULL,
     [password_hash] [binary](32) NOT NULL,
@@ -165,7 +166,7 @@ CREATE TABLE [guacamole].[user](
     [organization] [nvarchar](256) NULL,
     [organizational_role] [nvarchar](256) NULL,
 
-    CONSTRAINT [PK_user] PRIMARY KEY CLUSTERED 
+    CONSTRAINT [PK_guacamole_user] PRIMARY KEY CLUSTERED 
         ([user_id] ASC)
         WITH (PAD_INDEX = OFF,
             STATISTICS_NORECOMPUTE = OFF,
@@ -178,10 +179,10 @@ CREATE TABLE [guacamole].[user](
 /**
  * Defaults for user table
  */
-ALTER TABLE [guacamole].[user]
-    ADD CONSTRAINT [DF_user_disabled] DEFAULT ((0)) FOR [disabled]
-ALTER TABLE [guacamole].[user]
-    ADD CONSTRAINT [DF_user_expired] DEFAULT ((0)) FOR [expired]
+ALTER TABLE [guacamole].[guacamole_user]
+    ADD CONSTRAINT [DF_guacamole_user_disabled] DEFAULT ((0)) FOR [disabled]
+ALTER TABLE [guacamole].[guacamole_user]
+    ADD CONSTRAINT [DF_guacamole_user_expired] DEFAULT ((0)) FOR [expired]
 GO
 
 /**
@@ -190,12 +191,12 @@ GO
  */
 SET ANSI_NULLS ON
 SET QUOTED_IDENTIFIER ON
-CREATE TABLE [guacamole].[sharing_profile](
+CREATE TABLE [guacamole].[guacamole_sharing_profile](
     [sharing_profile_id] [int] IDENTITY(1,1) NOT NULL,
     [sharing_profile_name] [nvarchar](128) NOT NULL,
     [primary_connection_id] [int] NOT NULL,
 
-    CONSTRAINT [PK_sharing_profile] PRIMARY KEY CLUSTERED 
+    CONSTRAINT [PK_guacamole_sharing_profile] PRIMARY KEY CLUSTERED 
         ([sharing_profile_id] ASC)
         WITH (PAD_INDEX = OFF,
             STATISTICS_NORECOMPUTE = OFF,
@@ -208,13 +209,13 @@ CREATE TABLE [guacamole].[sharing_profile](
 /**
  * Foreign keys for sharing_profile table.
  */
-ALTER TABLE [guacamole].[sharing_profile]
-    WITH CHECK ADD CONSTRAINT [FK_sharing_profile_connection] FOREIGN KEY([primary_connection_id])
-    REFERENCES [guacamole].[connection] ([connection_id])
+ALTER TABLE [guacamole].[guacamole_sharing_profile]
+    WITH CHECK ADD CONSTRAINT [FK_guacamole_sharing_profile_connection] FOREIGN KEY([primary_connection_id])
+    REFERENCES [guacamole].[guacamole_connection] ([connection_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE
-ALTER TABLE [guacamole].[sharing_profile]
-    CHECK CONSTRAINT [FK_sharing_profile_connection]
+ALTER TABLE [guacamole].[guacamole_sharing_profile]
+    CHECK CONSTRAINT [FK_guacamole_sharing_profile_connection]
 GO
 
 /**
@@ -223,12 +224,12 @@ GO
  */
 SET ANSI_NULLS ON
 SET QUOTED_IDENTIFIER ON
-CREATE TABLE [guacamole].[connection_parameter](
+CREATE TABLE [guacamole].[guacamole_connection_parameter](
     [connection_id] [int] NOT NULL,
     [parameter_name] [nvarchar](128) NOT NULL,
     [parameter_value] [nvarchar](max) NOT NULL,
 
-    CONSTRAINT [PK_connection_parameter] PRIMARY KEY CLUSTERED 
+    CONSTRAINT [PK_guacamole_connection_parameter] PRIMARY KEY CLUSTERED 
         ([connection_id] ASC, [parameter_name] ASC)
         WITH (PAD_INDEX = OFF,
             STATISTICS_NORECOMPUTE = OFF,
@@ -241,13 +242,13 @@ CREATE TABLE [guacamole].[connection_parameter](
 /**
  * Foreign keys for the connection_parameter table.
  */
-ALTER TABLE [guacamole].[connection_parameter]
-    WITH CHECK ADD CONSTRAINT [FK_connection_parameter_connection] FOREIGN KEY([connection_id])
-    REFERENCES [guacamole].[connection] ([connection_id])
+ALTER TABLE [guacamole].[guacamole_connection_parameter]
+    WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_parameter_connection] FOREIGN KEY([connection_id])
+    REFERENCES [guacamole].[guacamole_connection] ([connection_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE
-ALTER TABLE [guacamole].[connection_parameter]
-    CHECK CONSTRAINT [FK_connection_parameter_connection]
+ALTER TABLE [guacamole].[guacamole_connection_parameter]
+    CHECK CONSTRAINT [FK_guacamole_connection_parameter_connection]
 GO
 
 /**
@@ -256,12 +257,12 @@ GO
  */
 SET ANSI_NULLS ON
 SET QUOTED_IDENTIFIER ON
-CREATE TABLE [guacamole].[sharing_profile_parameter](
+CREATE TABLE [guacamole].[guacamole_sharing_profile_parameter](
     [sharing_profile_id] [int] NOT NULL,
     [parameter_name] [nvarchar](128) NOT NULL,
     [parameter_value] [nvarchar](max) NOT NULL,
 
-    CONSTRAINT [PK_sharing_profile_parameter] PRIMARY KEY CLUSTERED 
+    CONSTRAINT [PK_guacamole_sharing_profile_parameter] PRIMARY KEY CLUSTERED 
         ([sharing_profile_id] ASC, [parameter_name] ASC)
         WITH (PAD_INDEX = OFF,
             STATISTICS_NORECOMPUTE = OFF,
@@ -275,13 +276,13 @@ CREATE TABLE [guacamole].[sharing_profile_parameter](
  * Foreign keys for the sharing_profile_parameter
  * table.
  */
-ALTER TABLE [guacamole].[sharing_profile_parameter]
-    WITH CHECK ADD CONSTRAINT [FK_sharing_profile_parameter_sharing_profile] FOREIGN KEY([sharing_profile_id])
-    REFERENCES [guacamole].[sharing_profile] ([sharing_profile_id])
+ALTER TABLE [guacamole].[guacamole_sharing_profile_parameter]
+    WITH CHECK ADD CONSTRAINT [FK_guacamole_sharing_profile_parameter_sharing_profile] FOREIGN KEY([sharing_profile_id])
+    REFERENCES [guacamole].[guacamole_sharing_profile] ([sharing_profile_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE
-ALTER TABLE [guacamole].[sharing_profile_parameter]
-    CHECK CONSTRAINT [FK_sharing_profile_parameter_sharing_profile]
+ALTER TABLE [guacamole].[guacamole_sharing_profile_parameter]
+    CHECK CONSTRAINT [FK_guacamole_sharing_profile_parameter_sharing_profile]
 GO
 
 /**
@@ -290,12 +291,12 @@ GO
  */
 SET ANSI_NULLS ON
 SET QUOTED_IDENTIFIER ON
-CREATE TABLE [guacamole].[connection_permission](
+CREATE TABLE [guacamole].[guacamole_connection_permission](
     [user_id] [int] NOT NULL,
     [connection_id] [int] NOT NULL,
-    [permission] [guacamole].[permission] NOT NULL,
+    [permission] [guacamole].[guacamole_permission] NOT NULL,
 
-    CONSTRAINT [PK_connection_permission] PRIMARY KEY CLUSTERED 
+    CONSTRAINT [PK_guacamole_connection_permission] PRIMARY KEY CLUSTERED 
         ([user_id] ASC, [connection_id] ASC, [permission] ASC)
         WITH (PAD_INDEX = OFF,
             STATISTICS_NORECOMPUTE = OFF,
@@ -308,20 +309,20 @@ CREATE TABLE [guacamole].[connection_permission](
 /**
  * Foreign keys for the connection_permission table.
  */
-ALTER TABLE [guacamole].[connection_permission]
-    WITH CHECK ADD CONSTRAINT [FK_connection_permission_connection1] FOREIGN KEY([connection_id])
-    REFERENCES [guacamole].[connection] ([connection_id])
+ALTER TABLE [guacamole].[guacamole_connection_permission]
+    WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_permission_connection1] FOREIGN KEY([connection_id])
+    REFERENCES [guacamole].[guacamole_connection] ([connection_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE
-ALTER TABLE [guacamole].[connection_permission]
-    CHECK CONSTRAINT [FK_connection_permission_connection1]
-ALTER TABLE [guacamole].[connection_permission]
-    WITH CHECK ADD  CONSTRAINT [FK_connection_permission_user1] FOREIGN KEY([user_id])
-    REFERENCES [guacamole].[user] ([user_id])
+ALTER TABLE [guacamole].[guacamole_connection_permission]
+    CHECK CONSTRAINT [FK_guacamole_connection_permission_connection1]
+ALTER TABLE [guacamole].[guacamole_connection_permission]
+    WITH CHECK ADD  CONSTRAINT [FK_guacamole_connection_permission_user1] FOREIGN KEY([user_id])
+    REFERENCES [guacamole].[guacamole_user] ([user_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE
-ALTER TABLE [guacamole].[connection_permission]
-    CHECK CONSTRAINT [FK_connection_permission_user1]
+ALTER TABLE [guacamole].[guacamole_connection_permission]
+    CHECK CONSTRAINT [FK_guacamole_connection_permission_user1]
 GO
 
 /**
@@ -330,12 +331,12 @@ GO
  */
 SET ANSI_NULLS ON
 SET QUOTED_IDENTIFIER ON
-CREATE TABLE [guacamole].[connection_group_permission](
+CREATE TABLE [guacamole].[guacamole_connection_group_permission](
     [user_id] [int] NOT NULL,
     [connection_group_id] [int] NOT NULL,
-    [permission] [guacamole].[permission] NOT NULL,
+    [permission] [guacamole].[guacamole_permission] NOT NULL,
 
-    CONSTRAINT [PK_connection_group_permission] PRIMARY KEY CLUSTERED 
+    CONSTRAINT [PK_guacamole_connection_group_permission] PRIMARY KEY CLUSTERED 
         ([user_id] ASC,	[connection_group_id] ASC, [permission] ASC)
         WITH (PAD_INDEX = OFF,
             STATISTICS_NORECOMPUTE = OFF,
@@ -348,20 +349,20 @@ CREATE TABLE [guacamole].[connection_group_permission](
 /**
  * Foreign keys for the connection_group_permission table.
  */
-ALTER TABLE [guacamole].[connection_group_permission] 
-    WITH CHECK ADD CONSTRAINT [FK_connection_group_permission_connection_group] FOREIGN KEY([connection_group_id])
-    REFERENCES [guacamole].[connection_group] ([connection_group_id])
+ALTER TABLE [guacamole].[guacamole_connection_group_permission] 
+    WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_group_permission_connection_group] FOREIGN KEY([connection_group_id])
+    REFERENCES [guacamole].[guacamole_connection_group] ([connection_group_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE
-ALTER TABLE [guacamole].[connection_group_permission]
-    CHECK CONSTRAINT [FK_connection_group_permission_connection_group]
-ALTER TABLE [guacamole].[connection_group_permission]
-    WITH CHECK ADD CONSTRAINT [FK_connection_group_permission_user] FOREIGN KEY([user_id])
-    REFERENCES [guacamole].[user] ([user_id])
+ALTER TABLE [guacamole].[guacamole_connection_group_permission]
+    CHECK CONSTRAINT [FK_guacamole_connection_group_permission_connection_group]
+ALTER TABLE [guacamole].[guacamole_connection_group_permission]
+    WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_group_permission_user] FOREIGN KEY([user_id])
+    REFERENCES [guacamole].[guacamole_user] ([user_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE
-ALTER TABLE [guacamole].[connection_group_permission]
-    CHECK CONSTRAINT [FK_connection_group_permission_user]
+ALTER TABLE [guacamole].[guacamole_connection_group_permission]
+    CHECK CONSTRAINT [FK_guacamole_connection_group_permission_user]
 GO
 
 /**
@@ -370,12 +371,12 @@ GO
  */
 SET ANSI_NULLS ON
 SET QUOTED_IDENTIFIER ON
-CREATE TABLE [guacamole].[sharing_profile_permission](
+CREATE TABLE [guacamole].[guacamole_sharing_profile_permission](
     [user_id] [int] NOT NULL,
     [sharing_profile_id] [int] NOT NULL,
-    [permission] [guacamole].[permission] NOT NULL,
+    [permission] [guacamole].[guacamole_permission] NOT NULL,
 
-    CONSTRAINT [PK_sharing_profile_permission] PRIMARY KEY CLUSTERED 
+    CONSTRAINT [PK_guacamole_sharing_profile_permission] PRIMARY KEY CLUSTERED 
         ([user_id] ASC, [sharing_profile_id] ASC, [permission] ASC)
         WITH (PAD_INDEX = OFF,
             STATISTICS_NORECOMPUTE = OFF,
@@ -388,20 +389,20 @@ CREATE TABLE [guacamole].[sharing_profile_permission](
 /**
  * Foreign keys for the sharing_profile_permission table.
  */
-ALTER TABLE [guacamole].[sharing_profile_permission]
-    WITH CHECK ADD CONSTRAINT [FK_sharing_profile_permission_sharing_profile] FOREIGN KEY([sharing_profile_id])
-    REFERENCES [guacamole].[sharing_profile] ([sharing_profile_id])
+ALTER TABLE [guacamole].[guacamole_sharing_profile_permission]
+    WITH CHECK ADD CONSTRAINT [FK_guacamole_sharing_profile_permission_sharing_profile] FOREIGN KEY([sharing_profile_id])
+    REFERENCES [guacamole].[guacamole_sharing_profile] ([sharing_profile_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE
-ALTER TABLE [guacamole].[sharing_profile_permission]
-    CHECK CONSTRAINT [FK_sharing_profile_permission_sharing_profile]
-ALTER TABLE [guacamole].[sharing_profile_permission]
-    WITH CHECK ADD  CONSTRAINT [FK_sharing_profile_permission_user] FOREIGN KEY([user_id])
-    REFERENCES [guacamole].[user] ([user_id])
+ALTER TABLE [guacamole].[guacamole_sharing_profile_permission]
+    CHECK CONSTRAINT [FK_guacamole_sharing_profile_permission_sharing_profile]
+ALTER TABLE [guacamole].[guacamole_sharing_profile_permission]
+    WITH CHECK ADD  CONSTRAINT [FK_guacamole_sharing_profile_permission_user] FOREIGN KEY([user_id])
+    REFERENCES [guacamole].[guacamole_user] ([user_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE
-ALTER TABLE [guacamole].[sharing_profile_permission]
-    CHECK CONSTRAINT [FK_sharing_profile_permission_user]
+ALTER TABLE [guacamole].[guacamole_sharing_profile_permission]
+    CHECK CONSTRAINT [FK_guacamole_sharing_profile_permission_user]
 GO
 
 /**
@@ -410,11 +411,11 @@ GO
  */
 SET ANSI_NULLS ON
 SET QUOTED_IDENTIFIER ON
-CREATE TABLE [guacamole].[system_permission](
+CREATE TABLE [guacamole].[guacamole_system_permission](
     [user_id] [int] NOT NULL,
-    [permission] [guacamole].[system_permission] NOT NULL,
+    [permission] [guacamole].[guacamole_system_permission] NOT NULL,
 
-    CONSTRAINT [PK_system_permission] PRIMARY KEY CLUSTERED 
+    CONSTRAINT [PK_guacamole_system_permission] PRIMARY KEY CLUSTERED 
         ([user_id] ASC,	[permission] ASC)
         WITH (PAD_INDEX = OFF,
             STATISTICS_NORECOMPUTE = OFF,
@@ -427,13 +428,13 @@ CREATE TABLE [guacamole].[system_permission](
 /**
  * Foreign keys for system_permission table.
  */
-ALTER TABLE [guacamole].[system_permission]
-    WITH CHECK ADD CONSTRAINT [FK_system_permission_user] FOREIGN KEY([user_id])
-    REFERENCES [guacamole].[user] ([user_id])
+ALTER TABLE [guacamole].[guacamole_system_permission]
+    WITH CHECK ADD CONSTRAINT [FK_guacamole_system_permission_user] FOREIGN KEY([user_id])
+    REFERENCES [guacamole].[guacamole_user] ([user_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE
-ALTER TABLE [guacamole].[system_permission]
-    CHECK CONSTRAINT [FK_system_permission_user]
+ALTER TABLE [guacamole].[guacamole_system_permission]
+    CHECK CONSTRAINT [FK_guacamole_system_permission_user]
 GO
 
 /**
@@ -442,12 +443,12 @@ GO
  */
 SET ANSI_NULLS ON
 SET QUOTED_IDENTIFIER ON
-CREATE TABLE [guacamole].[user_permission](
+CREATE TABLE [guacamole].[guacamole_user_permission](
     [user_id] [int] NOT NULL,
     [affected_user_id] [int] NOT NULL,
-    [permission] [guacamole].[permission] NOT NULL,
+    [permission] [guacamole].[guacamole_permission] NOT NULL,
 
-    CONSTRAINT [PK_user_permission] PRIMARY KEY CLUSTERED 
+    CONSTRAINT [PK_guacamole_user_permission] PRIMARY KEY CLUSTERED 
         ([user_id] ASC,	[affected_user_id] ASC,	[permission] ASC)
         WITH (PAD_INDEX = OFF,
             STATISTICS_NORECOMPUTE = OFF,
@@ -460,18 +461,18 @@ CREATE TABLE [guacamole].[user_permission](
 /**
  * Foreign keys for user_permission table.
  */
-ALTER TABLE [guacamole].[user_permission]
-    WITH CHECK ADD CONSTRAINT [FK_user_permission_user] FOREIGN KEY([user_id])
-    REFERENCES [guacamole].[user] ([user_id])
+ALTER TABLE [guacamole].[guacamole_user_permission]
+    WITH CHECK ADD CONSTRAINT [FK_guacamole_user_permission_user] FOREIGN KEY([user_id])
+    REFERENCES [guacamole].[guacamole_user] ([user_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE
-ALTER TABLE [guacamole].[user_permission]
-    CHECK CONSTRAINT [FK_user_permission_user]
-ALTER TABLE [guacamole].[user_permission]
-    WITH CHECK ADD CONSTRAINT [FK_user_permission_user1] FOREIGN KEY([affected_user_id])
-    REFERENCES [guacamole].[user] ([user_id])
-ALTER TABLE [guacamole].[user_permission]
-    CHECK CONSTRAINT [FK_user_permission_user1]
+ALTER TABLE [guacamole].[guacamole_user_permission]
+    CHECK CONSTRAINT [FK_guacamole_user_permission_user]
+ALTER TABLE [guacamole].[guacamole_user_permission]
+    WITH CHECK ADD CONSTRAINT [FK_guacamole_user_permission_user1] FOREIGN KEY([affected_user_id])
+    REFERENCES [guacamole].[guacamole_user] ([user_id])
+ALTER TABLE [guacamole].[guacamole_user_permission]
+    CHECK CONSTRAINT [FK_guacamole_user_permission_user1]
 GO
 
 /**
@@ -480,7 +481,7 @@ GO
  */
 SET ANSI_NULLS ON
 SET QUOTED_IDENTIFIER ON
-CREATE TABLE [guacamole].[connection_history](
+CREATE TABLE [guacamole].[guacamole_connection_history](
     [history_id] [int] IDENTITY(1,1) NOT NULL,
     [user_id] [int] NULL,
     [username] [nvarchar](128) NOT NULL,
@@ -492,7 +493,7 @@ CREATE TABLE [guacamole].[connection_history](
     [start_date] [datetime] NOT NULL,
     [end_date] [datetime] NULL,
 
-    CONSTRAINT [PK_connection_history] PRIMARY KEY CLUSTERED 
+    CONSTRAINT [PK_guacamole_connection_history] PRIMARY KEY CLUSTERED 
         ([history_id] ASC)
         WITH (PAD_INDEX = OFF,
             STATISTICS_NORECOMPUTE = OFF,
@@ -505,25 +506,25 @@ CREATE TABLE [guacamole].[connection_history](
 /**
  * Foreign keys for connection_history table
  */
-ALTER TABLE [guacamole].[connection_history]
-    WITH CHECK ADD CONSTRAINT [FK_connection_history_connection] FOREIGN KEY([connection_id])
-    REFERENCES [guacamole].[connection] ([connection_id])
+ALTER TABLE [guacamole].[guacamole_connection_history]
+    WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_history_connection] FOREIGN KEY([connection_id])
+    REFERENCES [guacamole].[guacamole_connection] ([connection_id])
         ON UPDATE CASCADE
         ON DELETE SET NULL
-ALTER TABLE [guacamole].[connection_history]
-    CHECK CONSTRAINT [FK_connection_history_connection]
-ALTER TABLE [guacamole].[connection_history]
-    WITH CHECK ADD  CONSTRAINT [FK_connection_history_sharing_profile] FOREIGN KEY([sharing_profile_id])
-    REFERENCES [guacamole].[sharing_profile] ([sharing_profile_id])
-ALTER TABLE [guacamole].[connection_history]
-    CHECK CONSTRAINT [FK_connection_history_sharing_profile]
-ALTER TABLE [guacamole].[connection_history]
-    WITH CHECK ADD CONSTRAINT [FK_connection_history_user] FOREIGN KEY([user_id])
-    REFERENCES [guacamole].[user] ([user_id])
+ALTER TABLE [guacamole].[guacamole_connection_history]
+    CHECK CONSTRAINT [FK_guacamole_connection_history_connection]
+ALTER TABLE [guacamole].[guacamole_connection_history]
+    WITH CHECK ADD  CONSTRAINT [FK_guacamole_connection_history_sharing_profile] FOREIGN KEY([sharing_profile_id])
+    REFERENCES [guacamole].[guacamole_sharing_profile] ([sharing_profile_id])
+ALTER TABLE [guacamole].[guacamole_connection_history]
+    CHECK CONSTRAINT [FK_guacamole_connection_history_sharing_profile]
+ALTER TABLE [guacamole].[guacamole_connection_history]
+    WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_history_user] FOREIGN KEY([user_id])
+    REFERENCES [guacamole].[guacamole_user] ([user_id])
         ON UPDATE CASCADE
         ON DELETE SET NULL
-ALTER TABLE [guacamole].[connection_history]
-    CHECK CONSTRAINT [FK_connection_history_user]
+ALTER TABLE [guacamole].[guacamole_connection_history]
+    CHECK CONSTRAINT [FK_guacamole_connection_history_user]
 GO
 
 /**
@@ -533,14 +534,14 @@ GO
  */
 SET ANSI_NULLS ON
 SET QUOTED_IDENTIFIER ON
-CREATE TABLE [guacamole].[user_password_history](
+CREATE TABLE [guacamole].[guacamole_user_password_history](
     [password_history_id] [int] IDENTITY(1,1) NOT NULL,
     [user_id] [int] NOT NULL,
     [password_hash] [binary](32) NOT NULL,
     [password_salt] [binary](32) NULL,
     [password_date] [datetime] NOT NULL,
 
-    CONSTRAINT [PK_user_password_history] PRIMARY KEY CLUSTERED 
+    CONSTRAINT [PK_guacamole_user_password_history] PRIMARY KEY CLUSTERED 
         ([password_history_id] ASC)
         WITH (PAD_INDEX = OFF,
             STATISTICS_NORECOMPUTE = OFF,
@@ -553,11 +554,11 @@ CREATE TABLE [guacamole].[user_password_history](
 /**
  * Foreign keys for user_password_history table
  */
-ALTER TABLE [guacamole].[user_password_history]
-    WITH CHECK ADD  CONSTRAINT [FK_user_password_history_user] FOREIGN KEY([user_id])
-    REFERENCES [guacamole].[user] ([user_id])
+ALTER TABLE [guacamole].[guacamole_user_password_history]
+    WITH CHECK ADD  CONSTRAINT [FK_guacamole_user_password_history_user] FOREIGN KEY([user_id])
+    REFERENCES [guacamole].[guacamole_user] ([user_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE
-ALTER TABLE [guacamole].[user_password_history]
-    CHECK CONSTRAINT [FK_user_password_history_user]
+ALTER TABLE [guacamole].[guacamole_user_password_history]
+    CHECK CONSTRAINT [FK_guacamole_user_password_history_user]
 GO

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/c803be5c/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
index f71d283..fa807b2 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
@@ -20,18 +20,18 @@
 /**
  * Create the default admin user account and set up full privileges.
  */
-INSERT INTO [guacamole].[user] (username, password_hash, password_date)
+INSERT INTO [guacamole].[guacamole_user] (username, password_hash, password_date)
 VALUES ('guacadmin', HASHBYTES('SHA2_256', 'guacadmin'), getdate());
 
-INSERT INTO [guacamole].[user_permission]
-SELECT [guacamole].[user].[user_id], [affected].[user_id], permission
+INSERT INTO [guacamole].[guacamole_user_permission]
+SELECT [guacamole].[guacamole_user].[user_id], [affected].[user_id], permission
 FROM (
     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, 'ADMINISTER' AS permission)
     permissions
-    JOIN [guacamole].[user] ON permissions.username = [guacamole].[user].[username]
-    JOIN [guacamole].[user] affected ON permissions.affected_username = affected.username;
+    JOIN [guacamole].[guacamole_user] ON permissions.username = [guacamole].[guacamole_user].[username]
+    JOIN [guacamole].[guacamole_user] affected ON permissions.affected_username = affected.username;
 
 INSERT INTO [guacamole].[system_permission]
 SELECT user_id, permission
@@ -42,5 +42,5 @@ FROM (
         UNION SELECT 'guacadmin' AS username, 'CREATE_USER' AS permission
         UNION SELECT 'guacadmin' AS username, 'ADMINISTER' AS permission)
     permissions
-    JOIN [guacamole].[user] ON permissions.username = [guacamole].[user].[username];
+    JOIN [guacamole].[guacamole_user] ON permissions.username = [guacamole].[guacamole_user].[username];
 GO


[26/28] incubator-guacamole-client git commit: GUACAMOLE-363: Clean up formatting on SQL schema file.

Posted by mj...@apache.org.
GUACAMOLE-363: Clean up formatting on SQL schema file.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/1d10f989
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/1d10f989
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/1d10f989

Branch: refs/heads/master
Commit: 1d10f989dc8696168f3c472d4b7ccf444a6cfce1
Parents: e084f85
Author: Nick Couchman <vn...@apache.org>
Authored: Sat Sep 30 16:45:48 2017 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Sat Sep 30 16:45:48 2017 -0400

----------------------------------------------------------------------
 .../schema/001-create-schema.sql                | 132 +++++++++----------
 1 file changed, 66 insertions(+), 66 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/1d10f989/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
index a52ad7f..c64f6f9 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
@@ -42,10 +42,10 @@ GO;
 CREATE RULE [guacamole_system_permission_list] 
     AS
     @list IN ('CREATE_CONNECTION',
-        'CREATE_CONNECTION_GROUP',
-        'CREATE_SHARING_PROFILE',
-        'CREATE_USER',
-        'ADMINISTER');
+              'CREATE_CONNECTION_GROUP',
+              'CREATE_SHARING_PROFILE',
+              'CREATE_USER',
+              'ADMINISTER');
 GO;
 
 /**
@@ -65,16 +65,16 @@ GO;
  * The connection_group table stores organizational and balancing groups.
  */
 CREATE TABLE [guacamole_connection_group](
-    [connection_group_id] [int] IDENTITY(1,1) NOT NULL,
-    [parent_id] [int] NULL,
-    [connection_group_name] [nvarchar](128) NOT NULL,
-    [type] [nvarchar](32) NOT NULL,
-    [max_connections] [int] NULL,
+    [connection_group_id]      [int] IDENTITY(1,1) NOT NULL,
+    [parent_id]                [int] NULL,
+    [connection_group_name]    [nvarchar](128) NOT NULL,
+    [type]                     [nvarchar](32) NOT NULL,
+    [max_connections]          [int] NULL,
     [max_connections_per_user] [int] NULL,
-    [enable_session_affinity] [bit] NOT NULL,
+    [enable_session_affinity]  [bit] NOT NULL,
 
     CONSTRAINT [PK_guacmaole_connection_group] PRIMARY KEY CLUSTERED
-        ([connection_group_id] ASC) ON [PRIMARY]
+               ([connection_group_id] ASC) ON [PRIMARY]
 ) ON [PRIMARY];
 
 /**
@@ -82,7 +82,7 @@ CREATE TABLE [guacamole_connection_group](
  */
 ALTER TABLE [guacamole_connection_group]
     WITH CHECK ADD CONSTRAINT [FK_guacamole_connection_group_connection_group_id] FOREIGN KEY([parent_id])
-    REFERENCES [guacamole_connection_group] ([connection_group_id]);
+    REFERENCES                [guacamole_connection_group] ([connection_group_id]);
 ALTER TABLE [guacamole_connection_group]
     CHECK CONSTRAINT [FK_guacamole_connection_group_connection_group_id];
 ALTER TABLE [guacamole_connection_group]
@@ -104,17 +104,17 @@ GO;
  * The connection table, for storing connections and attributes.
  */
 CREATE TABLE [guacamole_connection](
-    [connection_id] [int] IDENTITY(1,1) NOT NULL,
-    [connection_name] [nvarchar](128) NOT NULL,
-    [parent_id] [int] NULL,
-    [protocol] [nvarchar](32) NOT NULL,
-    [proxy_port] [int] NULL,
-    [proxy_hostname] [nvarchar](512) NULL,
-    [proxy_encryption_method] [nvarchar](4) NULL,
-    [max_connections] [int] NULL,
+    [connection_id]            [int] IDENTITY(1,1) NOT NULL,
+    [connection_name]          [nvarchar](128) NOT NULL,
+    [parent_id]                [int] NULL,
+    [protocol]                 [nvarchar](32) NOT NULL,
+    [proxy_port]               [int] NULL,
+    [proxy_hostname]           [nvarchar](512) NULL,
+    [proxy_encryption_method]  [nvarchar](4) NULL,
+    [max_connections]          [int] NULL,
     [max_connections_per_user] [int] NULL,
-    [connection_weight] [int] NULL,
-    [failover_only] [bit] NOT NULL,
+    [connection_weight]        [int] NULL,
+    [failover_only]            [bit] NOT NULL,
 
     CONSTRAINT [PK_guacamole_connection] PRIMARY KEY CLUSTERED
 	([connection_id] ASC) ON [PRIMARY]
@@ -138,22 +138,22 @@ GO;
  * The user table stores user accounts, passwords, and properties.
  */
 CREATE TABLE [guacamole_user](
-    [user_id] [int] IDENTITY(1,1) NOT NULL,
-    [username] [nvarchar](128) NOT NULL,
-    [password_hash] [binary](32) NOT NULL,
-    [password_salt] [binary](32) NULL,
-    [password_date] [datetime] NOT NULL,
-    [disabled] [bit] NOT NULL,
-    [expired] [bit] NOT NULL,
-    [access_window_start] [time](7) NULL,
-    [access_window_end] [time](7) NULL,
-    [valid_from] [date] NULL,
-    [valid_until] [date] NULL,
-    [timezone] [nvarchar](64) NULL,
-    [full_name] [nvarchar](256) NULL,
-    [email_address] [nvarchar](256) NULL,
-    [organization] [nvarchar](256) NULL,
-    [organizational_role] [nvarchar](256) NULL,
+    [user_id]               [int] IDENTITY(1,1) NOT NULL,
+    [username]              [nvarchar](128) NOT NULL,
+    [password_hash]         [binary](32) NOT NULL,
+    [password_salt]         [binary](32) NULL,
+    [password_date]         [datetime] NOT NULL,
+    [disabled]              [bit] NOT NULL,
+    [expired]               [bit] NOT NULL,
+    [access_window_start]   [time](7) NULL,
+    [access_window_end]     [time](7) NULL,
+    [valid_from]            [date] NULL,
+    [valid_until]           [date] NULL,
+    [timezone]              [nvarchar](64) NULL,
+    [full_name]             [nvarchar](256) NULL,
+    [email_address]         [nvarchar](256) NULL,
+    [organization]          [nvarchar](256) NULL,
+    [organizational_role]   [nvarchar](256) NULL,
 
     CONSTRAINT [PK_guacamole_user] PRIMARY KEY CLUSTERED 
         ([user_id] ASC) ON [PRIMARY]
@@ -173,8 +173,8 @@ GO;
  * connections to be shared amongst multiple users.
  */
 CREATE TABLE [guacamole_sharing_profile](
-    [sharing_profile_id] [int] IDENTITY(1,1) NOT NULL,
-    [sharing_profile_name] [nvarchar](128) NOT NULL,
+    [sharing_profile_id]    [int] IDENTITY(1,1) NOT NULL,
+    [sharing_profile_name]  [nvarchar](128) NOT NULL,
     [primary_connection_id] [int] NOT NULL,
 
     CONSTRAINT [PK_guacamole_sharing_profile] PRIMARY KEY CLUSTERED 
@@ -198,8 +198,8 @@ GO;
  * connection objects.
  */
 CREATE TABLE [guacamole_connection_parameter](
-    [connection_id] [int] NOT NULL,
-    [parameter_name] [nvarchar](128) NOT NULL,
+    [connection_id]   [int] NOT NULL,
+    [parameter_name]  [nvarchar](128) NOT NULL,
     [parameter_value] [nvarchar](4000) NOT NULL,
 
     CONSTRAINT [PK_guacamole_connection_parameter] PRIMARY KEY CLUSTERED 
@@ -224,8 +224,8 @@ GO;
  */
 CREATE TABLE [guacamole_sharing_profile_parameter](
     [sharing_profile_id] [int] NOT NULL,
-    [parameter_name] [nvarchar](128) NOT NULL,
-    [parameter_value] [nvarchar](4000) NOT NULL,
+    [parameter_name]     [nvarchar](128) NOT NULL,
+    [parameter_value]    [nvarchar](4000) NOT NULL,
 
     CONSTRAINT [PK_guacamole_sharing_profile_parameter] PRIMARY KEY CLUSTERED 
         ([sharing_profile_id] ASC, [parameter_name] ASC) ON [PRIMARY]
@@ -249,9 +249,9 @@ GO;
  * mappings for connection objects.
  */
 CREATE TABLE [guacamole_connection_permission](
-    [user_id] [int] NOT NULL,
+    [user_id]       [int] NOT NULL,
     [connection_id] [int] NOT NULL,
-    [permission] [guacamole_permission] NOT NULL,
+    [permission]    [guacamole_permission] NOT NULL,
 
     CONSTRAINT [PK_guacamole_connection_permission] PRIMARY KEY CLUSTERED 
         ([user_id] ASC, [connection_id] ASC, [permission] ASC) ON [PRIMARY]
@@ -281,9 +281,9 @@ GO;
  * connection_group objects.
  */
 CREATE TABLE [guacamole_connection_group_permission](
-    [user_id] [int] NOT NULL,
+    [user_id]             [int] NOT NULL,
     [connection_group_id] [int] NOT NULL,
-    [permission] [guacamole_permission] NOT NULL,
+    [permission]          [guacamole_permission] NOT NULL,
 
     CONSTRAINT [PK_guacamole_connection_group_permission] PRIMARY KEY CLUSTERED 
         ([user_id] ASC,	[connection_group_id] ASC, [permission] ASC) ON [PRIMARY]
@@ -313,9 +313,9 @@ GO;
  * mappings for sharing_profile objects.
  */
 CREATE TABLE [guacamole_sharing_profile_permission](
-    [user_id] [int] NOT NULL,
+    [user_id]            [int] NOT NULL,
     [sharing_profile_id] [int] NOT NULL,
-    [permission] [guacamole_permission] NOT NULL,
+    [permission]         [guacamole_permission] NOT NULL,
 
     CONSTRAINT [PK_guacamole_sharing_profile_permission] PRIMARY KEY CLUSTERED 
         ([user_id] ASC, [sharing_profile_id] ASC, [permission] ASC) ON [PRIMARY]
@@ -345,7 +345,7 @@ GO;
  * for system-level operations.
  */
 CREATE TABLE [guacamole_system_permission](
-    [user_id] [int] NOT NULL,
+    [user_id]    [int] NOT NULL,
     [permission] [guacamole_system_permission] NOT NULL,
 
     CONSTRAINT [PK_guacamole_system_permission] PRIMARY KEY CLUSTERED 
@@ -369,9 +369,9 @@ GO;
  * for users to other users.
  */
 CREATE TABLE [guacamole_user_permission](
-    [user_id] [int] NOT NULL,
+    [user_id]          [int] NOT NULL,
     [affected_user_id] [int] NOT NULL,
-    [permission] [guacamole_permission] NOT NULL,
+    [permission]       [guacamole_permission] NOT NULL,
 
     CONSTRAINT [PK_guacamole_user_permission] PRIMARY KEY CLUSTERED 
         ([user_id] ASC,	[affected_user_id] ASC,	[permission] ASC) ON [PRIMARY]
@@ -399,16 +399,16 @@ GO;
  * connections.
  */
 CREATE TABLE [guacamole_connection_history](
-    [history_id] [int] IDENTITY(1,1) NOT NULL,
-    [user_id] [int] NULL,
-    [username] [nvarchar](128) NOT NULL,
-    [remote_host] [nvarchar](256) NULL,
-    [connection_id] [int] NULL,
-    [connection_name] [nvarchar](128) NOT NULL,
-    [sharing_profile_id] [int] NULL,
+    [history_id]           [int] IDENTITY(1,1) NOT NULL,
+    [user_id]              [int] NULL,
+    [username]             [nvarchar](128) NOT NULL,
+    [remote_host]          [nvarchar](256) NULL,
+    [connection_id]        [int] NULL,
+    [connection_name]      [nvarchar](128) NOT NULL,
+    [sharing_profile_id]   [int] NULL,
     [sharing_profile_name] [nvarchar](128) NULL,
-    [start_date] [datetime] NOT NULL,
-    [end_date] [datetime] NULL,
+    [start_date]           [datetime] NOT NULL,
+    [end_date]             [datetime] NULL,
 
     CONSTRAINT [PK_guacamole_connection_history] PRIMARY KEY CLUSTERED 
         ([history_id] ASC) ON [PRIMARY]
@@ -445,10 +445,10 @@ GO;
  */
 CREATE TABLE [guacamole_user_password_history](
     [password_history_id] [int] IDENTITY(1,1) NOT NULL,
-    [user_id] [int] NOT NULL,
-    [password_hash] [binary](32) NOT NULL,
-    [password_salt] [binary](32) NULL,
-    [password_date] [datetime] NOT NULL,
+    [user_id]             [int] NOT NULL,
+    [password_hash]       [binary](32) NOT NULL,
+    [password_salt]       [binary](32) NULL,
+    [password_date]       [datetime] NOT NULL,
 
     CONSTRAINT [PK_guacamole_user_password_history] PRIMARY KEY CLUSTERED 
         ([password_history_id] ASC) ON [PRIMARY]


[27/28] incubator-guacamole-client git commit: GUACAMOLE-363: Add SQL Server components to JDBC dist.

Posted by mj...@apache.org.
GUACAMOLE-363: Add SQL Server components to JDBC dist.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/56bce8db
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/56bce8db
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/56bce8db

Branch: refs/heads/master
Commit: 56bce8dbe73c049c0654ad54f59a38dfdce92fa3
Parents: 1d10f98
Author: Nick Couchman <vn...@apache.org>
Authored: Sat Sep 30 16:49:49 2017 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Sat Sep 30 20:34:59 2017 -0400

----------------------------------------------------------------------
 .../modules/guacamole-auth-jdbc-dist/pom.xml          |  7 +++++++
 .../guacamole-auth-jdbc-dist/project-assembly.xml     | 14 ++++++++++++++
 2 files changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/56bce8db/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-dist/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-dist/pom.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-dist/pom.xml
index 7b51fa2..05f5572 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-dist/pom.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-dist/pom.xml
@@ -109,6 +109,13 @@
             <version>0.9.13-incubating</version>
         </dependency>
 
+        <!-- SQL Server Authentication Extension -->
+        <dependency>
+            <groupId>org.apache.guacamole</groupId>
+            <artifactId>guacamole-auth-jdbc-sqlserver</artifactId>
+            <version>0.9.13-incubating</version>
+        </dependency>
+
     </dependencies>
 
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/56bce8db/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-dist/project-assembly.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-dist/project-assembly.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-dist/project-assembly.xml
index 523b3a0..58c886c 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-dist/project-assembly.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-dist/project-assembly.xml
@@ -49,6 +49,14 @@
             </includes>
         </dependencySet>
 
+        <!-- SQL Server extension .jar -->
+        <dependencySet>
+            <outputDirectory>sqlserver</outputDirectory>
+            <includes>
+                <include>org.apache.guacamole:guacamole-auth-jdbc-sqlserver</include>
+            </includes>
+        </dependencySet>
+
     </dependencySets>
 
     <!-- Include extension schema scripts -->
@@ -72,6 +80,12 @@
             <directory>../guacamole-auth-jdbc-postgresql/schema</directory>
         </fileSet>
 
+        <!-- SQL Server schema scripts -->
+        <fileSet>
+            <outputDirectory>sqlserver/schema</outputDirectory>
+            <directory>../guacamole-auth-jdbc-sqlserver/schema</directory>
+        </fileSet>
+
     </fileSets>
 
 </assembly>


[25/28] incubator-guacamole-client git commit: GUACAMOLE-363: Update ConnectionRecordMapper to new ActivityRecordSet class.

Posted by mj...@apache.org.
GUACAMOLE-363: Update ConnectionRecordMapper to new ActivityRecordSet class.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/e084f85d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/e084f85d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/e084f85d

Branch: refs/heads/master
Commit: e084f85d1804fede4576af9a8fc124e29959896f
Parents: 57dab6e
Author: Nick Couchman <vn...@apache.org>
Authored: Thu Sep 28 08:41:56 2017 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Thu Sep 28 08:41:56 2017 -0400

----------------------------------------------------------------------
 .../guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/e084f85d/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
index bca8139..d7ae41c 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
@@ -127,7 +127,7 @@
         </foreach>
 
         <!-- Bind sort property enum values for sake of readability -->
-        <bind name="START_DATE"      value="@org.apache.guacamole.net.auth.ConnectionRecordSet$SortableProperty@START_DATE"/>
+        <bind name="START_DATE" value="@org.apache.guacamole.net.auth.ActivityRecordSet$SortableProperty@START_DATE"/>
 
         <!-- Sort predicates -->
         <foreach collection="sortPredicates" item="sortPredicate"
@@ -195,7 +195,7 @@
         </foreach>
 
         <!-- Bind sort property enum values for sake of readability -->
-        <bind name="START_DATE"      value="@org.apache.guacamole.net.auth.ConnectionRecordSet$SortableProperty@START_DATE"/>
+        <bind name="START_DATE" value="@org.apache.guacamole.net.auth.ActivityRecordSet$SortableProperty@START_DATE"/>
 
         <!-- Sort predicates -->
         <foreach collection="sortPredicates" item="sortPredicate"


[24/28] incubator-guacamole-client git commit: GUACAMOLE-363: Minor fixes in schema files.

Posted by mj...@apache.org.
GUACAMOLE-363: Minor fixes in schema files.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/9d38306e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/9d38306e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/9d38306e

Branch: refs/heads/master
Commit: 9d38306e30795bcf41e91b5c7b5a1069f6839d8d
Parents: 66c4b86
Author: Nick Couchman <vn...@apache.org>
Authored: Sun Aug 27 16:32:35 2017 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Thu Sep 28 07:00:52 2017 -0400

----------------------------------------------------------------------
 .../guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql | 6 ------
 .../schema/002-create-admin-user.sql                           | 2 +-
 2 files changed, 1 insertion(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/9d38306e/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
index 92525dd..95382ef 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
@@ -18,12 +18,6 @@
  */
 
 /**
- * Create the guacamole schema.
- */
-CREATE SCHEMA [dbo]
-GO
-
-/**
  * List for permission data type.
  */
 CREATE RULE [dbo].[guacamole_permission_list] 

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/9d38306e/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
index 408d7ca..c6e6d9b 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
@@ -33,7 +33,7 @@ FROM (
     JOIN [dbo].[guacamole_user] ON permissions.username = [dbo].[guacamole_user].[username]
     JOIN [dbo].[guacamole_user] affected ON permissions.affected_username = affected.username;
 
-INSERT INTO [dbo].[system_permission]
+INSERT INTO [dbo].[guacamole_system_permission]
 SELECT user_id, permission
 FROM (
     SELECT 'guacadmin' AS username, 'CREATE_CONNECTION' AS permission


[17/28] incubator-guacamole-client git commit: GUACAMOLE-363: Implement new SQLServerDriver data type and property to select the property SQL Server driver.

Posted by mj...@apache.org.
GUACAMOLE-363: Implement new SQLServerDriver data type and property to select the property SQL Server driver.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/74c055e7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/74c055e7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/74c055e7

Branch: refs/heads/master
Commit: 74c055e76412797258b540a24cca8ca0bb1ee5df
Parents: 7755241
Author: Nick Couchman <vn...@apache.org>
Authored: Tue Sep 12 13:14:49 2017 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Thu Sep 28 07:00:52 2017 -0400

----------------------------------------------------------------------
 .../SQLServerAuthenticationProviderModule.java  |  33 +++--
 .../auth/sqlserver/SQLServerDriver.java         |  46 +++++++
 .../auth/sqlserver/SQLServerDriverProperty.java |  60 +++++++++
 .../auth/sqlserver/SQLServerEnvironment.java    | 133 +++----------------
 .../sqlserver/SQLServerGuacamoleProperties.java |   6 +-
 5 files changed, 145 insertions(+), 133 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/74c055e7/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java
index f514e41..ee0584b 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java
@@ -42,9 +42,9 @@ public class SQLServerAuthenticationProviderModule implements Module {
     private final Properties driverProperties = new Properties();
 
     /**
-     * Whether or not to use JTDS Driver
+     * Which SQL Server driver should be used.
      */
-    private String sqlServerDriver;
+    private SQLServerDriver sqlServerDriver;
 
     /**
      * Creates a new SQLServer authentication provider module that configures
@@ -83,16 +83,25 @@ public class SQLServerAuthenticationProviderModule implements Module {
     @Override
     public void configure(Binder binder) {
 
-        // Bind SQLServer-specific properties
-        // Look at the property to choose the correct driver.
-        if (sqlServerDriver.equals(SQLServerEnvironment.SQLSERVER_DRIVER_JTDS))
-            JdbcHelper.SQL_Server_jTDS.configure(binder);
-        else if (sqlServerDriver.equals(SQLServerEnvironment.SQLSERVER_DRIVER_DATADIRECT))
-            JdbcHelper.SQL_Server_DataDirect.configure(binder);
-        else if (sqlServerDriver.equals(SQLServerEnvironment.SQLSERVER_DRIVER_MS))
-            JdbcHelper.SQL_Server_MS_Driver.configure(binder);
-        else
-            JdbcHelper.SQL_Server_2005_MS_Driver.configure(binder);
+        // Bind SQLServer-specific properties with the configured driver.
+        switch(sqlServerDriver) {
+            case JTDS:
+                JdbcHelper.SQL_Server_jTDS.configure(binder);
+                break;
+
+            case DATA_DIRECT:
+                JdbcHelper.SQL_Server_DataDirect.configure(binder);
+                break;
+
+            case MICROSOFT_LEGACY:
+                JdbcHelper.SQL_Server_MS_Driver.configure(binder);
+                break;
+
+            case MICROSOFT_2005:
+            default:
+                JdbcHelper.SQL_Server_2005_MS_Driver.configure(binder);
+
+        }
         
         // Bind MyBatis properties
         Names.bindProperties(binder, myBatisProperties);

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/74c055e7/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerDriver.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerDriver.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerDriver.java
new file mode 100644
index 0000000..ec01d06
--- /dev/null
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerDriver.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.guacamole.auth.sqlserver;
+
+/**
+ * The possible SQL Server drivers to use when using a TDS-compatible database.
+ */
+public enum SQLServerDriver {
+
+    /**
+     * The open source jTDS driver.
+     */
+    JTDS,
+
+    /**
+     * The Progress DataDirect driver.
+     */
+    DATA_DIRECT,
+
+    /**
+     * The Microsoft Legacy SQL Server driver.
+     */
+    MICROSOFT_LEGACY,
+
+    /**
+     * The Microsoft 2005 SQL Server driver.
+     */
+    MICROSOFT_2005;
+}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/74c055e7/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerDriverProperty.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerDriverProperty.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerDriverProperty.java
new file mode 100644
index 0000000..21a6272
--- /dev/null
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerDriverProperty.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.guacamole.auth.sqlserver;
+
+import org.apache.guacamole.GuacamoleException;
+import org.apache.guacamole.GuacamoleServerException;
+import org.apache.guacamole.properties.GuacamoleProperty;
+
+/**
+ * A property whose value is a SQLServerDriver.  The incoming string values of "jtds", "datadirect",
+ * "microsoft", and "microsoft2005" into the corresponding SQLServerDriver enum value.  Any
+ * values that are not valid result in a parse error.
+ */
+public abstract class SQLServerDriverProperty implements GuacamoleProperty<SQLServerDriver> {
+
+    @Override
+    public SQLServerDriver parseValue(String value) throws GuacamoleException {
+
+        // If no value provided, return null.
+        if (value == null)
+            return null;
+
+        // jTDS Driver
+        if (value.equals("jtds"))
+            return SQLServerDriver.JTDS;
+
+        // Progress DataDirect Driver
+        if (value.equals("datadirect"))
+            return SQLServerDriver.DATA_DIRECT;
+
+        // Microsoft Legacy Driver
+        if (value.equals("microsoft"))
+            return SQLServerDriver.MICROSOFT_LEGACY;
+
+        // Microsoft 2005 Driver
+        if (value.equals("microsoft2005"))
+            return SQLServerDriver.MICROSOFT_2005;
+
+        throw new GuacamoleServerException("SQLServer driver must be one of \"jtds\", \"datadirect\", \"microsoft\", \"microsoft2005\".");
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/74c055e7/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java
index 4d3faba..efd7ae1 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java
@@ -56,69 +56,36 @@ public class SQLServerEnvironment extends JDBCEnvironment {
      * The default value for the maximum number of connections to be
      * allowed to the Guacamole server overall.
      */
-    private final int DEFAULT_ABSOLUTE_MAX_CONNECTIONS = 0;
+    private static final int DEFAULT_ABSOLUTE_MAX_CONNECTIONS = 0;
 
     /**
      * The default value for the default maximum number of connections to be
-     * allowed per user to any one connection. Note that, as long as the
-     * legacy "disallow duplicate" and "disallow simultaneous" properties are
-     * still supported, these cannot be constants, as the legacy properties
-     * dictate the values that should be used in the absence of the correct
-     * properties.
+     * allowed per user to any one connection.
      */
-    private int DEFAULT_MAX_CONNECTIONS_PER_USER = 1;
+    private static final int DEFAULT_MAX_CONNECTIONS_PER_USER = 1;
 
     /**
      * The default value for the default maximum number of connections to be
-     * allowed per user to any one connection group. Note that, as long as the
-     * legacy "disallow duplicate" and "disallow simultaneous" properties are
-     * still supported, these cannot be constants, as the legacy properties
-     * dictate the values that should be used in the absence of the correct
-     * properties.
+     * allowed per user to any one connection group.
      */
-    private int DEFAULT_MAX_GROUP_CONNECTIONS_PER_USER = 1;
+    private static final int DEFAULT_MAX_GROUP_CONNECTIONS_PER_USER = 1;
 
     /**
      * The default value for the default maximum number of connections to be
-     * allowed to any one connection. Note that, as long as the legacy
-     * "disallow duplicate" and "disallow simultaneous" properties are still
-     * supported, these cannot be constants, as the legacy properties dictate
-     * the values that should be used in the absence of the correct properties.
+     * allowed to any one connection.
      */
-    private int DEFAULT_MAX_CONNECTIONS = 0;
+    private static final int DEFAULT_MAX_CONNECTIONS = 0;
 
     /**
      * The default value for the default maximum number of connections to be
-     * allowed to any one connection group. Note that, as long as the legacy
-     * "disallow duplicate" and "disallow simultaneous" properties are still
-     * supported, these cannot be constants, as the legacy properties dictate
-     * the values that should be used in the absence of the correct properties.
+     * allowed to any one connection group.
      */
-    private int DEFAULT_MAX_GROUP_CONNECTIONS = 0;
+    private static final int DEFAULT_MAX_GROUP_CONNECTIONS = 0;
 
     /**
-     * The value for the sqlserver-driver property that triggers the use of
-     * the open source JTDS driver.
+     * The default SQLServer driver to use.
      */
-    public final static String SQLSERVER_DRIVER_JTDS = "jtds";
-
-    /**
-     * The value for the sqlserver-driver property that triggers the use of
-     * the DataDirect JDBC driver.
-     */
-    public final static String SQLSERVER_DRIVER_DATADIRECT = "datadirect";
-
-    /**
-     * The value for the sqlserver-driver property that triggers the use of
-     * the older Microsoft JDBC driver.
-     */
-    public final static String SQLSERVER_DRIVER_MS = "microsoft";
-
-    /**
-     * The value for the sqlserver-driver property that triggers the use of
-     * the Microsoft JDBC driver.  This is the default.
-     */
-    public final static String SQLSERVER_DRIVER_MS_2005 = "microsoft2005";
+    public static final SQLServerDriver SQLSERVER_DEFAULT_DRIVER = SQLServerDriver.MICROSOFT_2005;
 
     /**
      * Constructs a new SQLServerEnvironment, providing access to SQLServer-specific
@@ -133,75 +100,6 @@ public class SQLServerEnvironment extends JDBCEnvironment {
         // Init underlying JDBC environment
         super();
 
-        // Read legacy concurrency-related property
-        Boolean disallowSimultaneous = getProperty(SQLServerGuacamoleProperties.SQLSERVER_DISALLOW_SIMULTANEOUS_CONNECTIONS);
-        Boolean disallowDuplicate    = getProperty(SQLServerGuacamoleProperties.SQLSERVER_DISALLOW_DUPLICATE_CONNECTIONS);
-
-        // Legacy "simultaneous" property dictates only the maximum number of
-        // connections per connection
-        if (disallowSimultaneous != null) {
-
-            // Translate legacy property
-            if (disallowSimultaneous) {
-                DEFAULT_MAX_CONNECTIONS       = 1;
-                DEFAULT_MAX_GROUP_CONNECTIONS = 0;
-            }
-            else {
-                DEFAULT_MAX_CONNECTIONS       = 0;
-                DEFAULT_MAX_GROUP_CONNECTIONS = 0;
-            }
-
-            // Warn of deprecation
-            logger.warn("The \"{}\" property is deprecated. Use \"{}\" and \"{}\" instead.",
-                    SQLServerGuacamoleProperties.SQLSERVER_DISALLOW_SIMULTANEOUS_CONNECTIONS.getName(),
-                    SQLServerGuacamoleProperties.SQLSERVER_DEFAULT_MAX_CONNECTIONS.getName(),
-                    SQLServerGuacamoleProperties.SQLSERVER_DEFAULT_MAX_GROUP_CONNECTIONS.getName());
-
-            // Inform of new equivalent
-            logger.info("To achieve the same result of setting \"{}\" to \"{}\", set \"{}\" to \"{}\" and \"{}\" to \"{}\".",
-                    SQLServerGuacamoleProperties.SQLSERVER_DISALLOW_SIMULTANEOUS_CONNECTIONS.getName(), disallowSimultaneous,
-                    SQLServerGuacamoleProperties.SQLSERVER_DEFAULT_MAX_CONNECTIONS.getName(),           DEFAULT_MAX_CONNECTIONS,
-                    SQLServerGuacamoleProperties.SQLSERVER_DEFAULT_MAX_GROUP_CONNECTIONS.getName(),     DEFAULT_MAX_GROUP_CONNECTIONS);
-
-        }
-
-        // Legacy "duplicate" property dictates whether connections and groups
-        // may be used concurrently only by different users
-        if (disallowDuplicate != null) {
-
-            // Translate legacy property
-            if (disallowDuplicate) {
-                DEFAULT_MAX_CONNECTIONS_PER_USER       = 1;
-                DEFAULT_MAX_GROUP_CONNECTIONS_PER_USER = 1;
-            }
-            else {
-                DEFAULT_MAX_CONNECTIONS_PER_USER       = 0;
-                DEFAULT_MAX_GROUP_CONNECTIONS_PER_USER = 0;
-            }
-
-            // Warn of deprecation
-            logger.warn("The \"{}\" property is deprecated. Use \"{}\" and \"{}\" instead.",
-                    SQLServerGuacamoleProperties.SQLSERVER_DISALLOW_DUPLICATE_CONNECTIONS.getName(),
-                    SQLServerGuacamoleProperties.SQLSERVER_DEFAULT_MAX_CONNECTIONS_PER_USER.getName(),
-                    SQLServerGuacamoleProperties.SQLSERVER_DEFAULT_MAX_GROUP_CONNECTIONS.getName());
-
-            // Inform of new equivalent
-            logger.info("To achieve the same result of setting \"{}\" to \"{}\", set \"{}\" to \"{}\" and \"{}\" to \"{}\".",
-                    SQLServerGuacamoleProperties.SQLSERVER_DISALLOW_DUPLICATE_CONNECTIONS.getName(),         disallowDuplicate,
-                    SQLServerGuacamoleProperties.SQLSERVER_DEFAULT_MAX_CONNECTIONS_PER_USER.getName(),       DEFAULT_MAX_CONNECTIONS_PER_USER,
-                    SQLServerGuacamoleProperties.SQLSERVER_DEFAULT_MAX_GROUP_CONNECTIONS_PER_USER.getName(), DEFAULT_MAX_GROUP_CONNECTIONS_PER_USER);
-
-        }
-
-        // Check driver property is one of the acceptable values.
-        String driver = getProperty(SQLServerGuacamoleProperties.SQLSERVER_DRIVER);
-        if (driver != null && !(driver.equals(SQLSERVER_DRIVER_JTDS) ||
-                                driver.equals(SQLSERVER_DRIVER_DATADIRECT) ||
-                                driver.equals(SQLSERVER_DRIVER_MS) ||
-                                driver.equals(SQLSERVER_DRIVER_MS_2005)))
-            logger.warn("{} property has been set to an invalid value.  The default Microsoft 2005 driver will be used.",
-                        SQLServerGuacamoleProperties.SQLSERVER_DRIVER.getName());
-
     }
 
     @Override
@@ -337,20 +235,19 @@ public class SQLServerEnvironment extends JDBCEnvironment {
     }
 
     /**
-     * Returns whether or not to use the SourceForge JTDS driver for more
-     * generic JTDS connections instead of the Microsoft-provided JDBC driver.
+     * Returns which JDBC driver should be used to make the SQLServer/TDS connection.
      *
      * @return
-     *     True if the JTDS driver should be used; false by default.
+     *     Which TDS-compatible JDBC driver should be used.
      *
      * @throws GuacamoleException
      *     If an error occurs while retrieving the property value, or if the
      *     value was not set, as this property is required.
      */
-    public String getSQLServerDriver() throws GuacamoleException {
+    public SQLServerDriver getSQLServerDriver() throws GuacamoleException {
         return getProperty(
             SQLServerGuacamoleProperties.SQLSERVER_DRIVER,
-            SQLSERVER_DRIVER_MS_2005
+            SQLSERVER_DEFAULT_DRIVER
         );
     }
     

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/74c055e7/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerGuacamoleProperties.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerGuacamoleProperties.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerGuacamoleProperties.java
index 9d9b386..8aa02b3 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerGuacamoleProperties.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerGuacamoleProperties.java
@@ -198,10 +198,10 @@ public class SQLServerGuacamoleProperties {
     };
 
     /**
-     * Whether or not to use the JTDS driver for SQL Server connections.
+     * Which TDS-compatible JDBC driver should be used for the connection.
      */
-    public static final StringGuacamoleProperty
-            SQLSERVER_DRIVER = new StringGuacamoleProperty() {
+    public static final SQLServerDriverProperty
+            SQLSERVER_DRIVER = new SQLServerDriverProperty() {
 
         @Override
         public String getName() { return "sqlserver-driver"; }


[13/28] incubator-guacamole-client git commit: GUACAMOLE-363: Standardize table names with other JDBC modules; switch back to dbo schema for now.

Posted by mj...@apache.org.
GUACAMOLE-363: Standardize table names with other JDBC modules; switch back to dbo schema for now.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/66c4b86b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/66c4b86b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/66c4b86b

Branch: refs/heads/master
Commit: 66c4b86b0aeb3550fe39489b57d8862d51486b8e
Parents: c803be5
Author: Nick Couchman <vn...@apache.org>
Authored: Sun Aug 27 16:08:33 2017 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Thu Sep 28 07:00:52 2017 -0400

----------------------------------------------------------------------
 .../schema/001-create-schema.sql                | 172 +++++++++----------
 .../schema/002-create-admin-user.sql            |  14 +-
 .../auth/jdbc/connection/ConnectionMapper.xml   |  38 ++--
 .../connection/ConnectionParameterMapper.xml    |   6 +-
 .../jdbc/connection/ConnectionRecordMapper.xml  | 110 ++++++------
 .../connectiongroup/ConnectionGroupMapper.xml   |  46 ++---
 .../ConnectionGroupPermissionMapper.xml         |  30 ++--
 .../permission/ConnectionPermissionMapper.xml   |  30 ++--
 .../SharingProfilePermissionMapper.xml          |  30 ++--
 .../jdbc/permission/SystemPermissionMapper.xml  |  26 +--
 .../jdbc/permission/UserPermissionMapper.xml    |  52 +++---
 .../sharingprofile/SharingProfileMapper.xml     |  24 +--
 .../SharingProfileParameterMapper.xml           |   6 +-
 .../auth/jdbc/user/PasswordRecordMapper.xml     |  22 +--
 .../guacamole/auth/jdbc/user/UserMapper.xml     |  26 +--
 15 files changed, 316 insertions(+), 316 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/66c4b86b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
index 44e498e..92525dd 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
@@ -20,13 +20,13 @@
 /**
  * Create the guacamole schema.
  */
-CREATE SCHEMA [guacamole]
+CREATE SCHEMA [dbo]
 GO
 
 /**
  * List for permission data type.
  */
-CREATE RULE [guacamole].[guacamole_permission_list] 
+CREATE RULE [dbo].[guacamole_permission_list] 
     AS
     @list IN ('READ','UPDATE','DELETE','ADMINISTER')
 GO
@@ -34,7 +34,7 @@ GO
 /**
  * List for system permission data type.
  */
-CREATE RULE [guacamole].[guacamole_system_permission_list] 
+CREATE RULE [dbo].[guacamole_system_permission_list] 
     AS
     @list IN ('CREATE_CONNECTION',
         'CREATE_CONNECTION_GROUP',
@@ -46,12 +46,12 @@ GO
 /**
  * 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.
  */
-CREATE TYPE [guacamole].[guacamole_system_permission] FROM [nvarchar](32) NOT NULL
+CREATE TYPE [dbo].[guacamole_system_permission] FROM [nvarchar](32) NOT NULL
 GO
 
 /**
@@ -59,7 +59,7 @@ GO
  */
 SET ANSI_NULLS 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,
     [parent_id] [int] NULL,
     [connection_group_name] [nvarchar](128) NOT NULL,
@@ -81,23 +81,23 @@ CREATE TABLE [guacamole].[guacamole_connection_group](
 /**
  * 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])
-    REFERENCES [guacamole].[guacamole_connection_group] ([connection_group_id])
-ALTER TABLE [guacamole].[guacamole_connection_group]
+    REFERENCES [dbo].[guacamole_connection_group] ([connection_group_id])
+ALTER TABLE [dbo].[guacamole_connection_group]
     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] 
     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]
 
 /**
  * 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]
-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]
 GO
 
@@ -106,7 +106,7 @@ GO
  */
 SET ANSI_NULLS ON
 SET QUOTED_IDENTIFIER ON
-CREATE TABLE [guacamole].[guacamole_connection](
+CREATE TABLE [dbo].[guacamole_connection](
     [connection_id] [int] IDENTITY(1,1) NOT NULL,
     [connection_name] [nvarchar](128) NOT NULL,
     [parent_id] [int] NULL,
@@ -129,17 +129,17 @@ CREATE TABLE [guacamole].[guacamole_connection](
         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])
-REFERENCES [guacamole].[guacamole_connection_group] ([connection_group_id])
-ALTER TABLE [guacamole].[guacamole_connection]
+REFERENCES [dbo].[guacamole_connection_group] ([connection_group_id])
+ALTER TABLE [dbo].[guacamole_connection]
     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]
     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]
-ALTER TABLE [guacamole].[guacamole_connection]
+ALTER TABLE [dbo].[guacamole_connection]
     ADD CONSTRAINT [DF_guacamole_connection_failover_only] DEFAULT ((0)) FOR [failover_only]
 GO
 
@@ -148,7 +148,7 @@ GO
  */
 SET ANSI_NULLS ON
 SET QUOTED_IDENTIFIER ON
-CREATE TABLE [guacamole].[guacamole_user](
+CREATE TABLE [dbo].[guacamole_user](
     [user_id] [int] IDENTITY(1,1) NOT NULL,
     [username] [nvarchar](128) NOT NULL,
     [password_hash] [binary](32) NOT NULL,
@@ -179,9 +179,9 @@ CREATE TABLE [guacamole].[guacamole_user](
 /**
  * Defaults for user table
  */
-ALTER TABLE [guacamole].[guacamole_user]
+ALTER TABLE [dbo].[guacamole_user]
     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]
 GO
 
@@ -191,7 +191,7 @@ GO
  */
 SET ANSI_NULLS 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_name] [nvarchar](128) NOT NULL,
     [primary_connection_id] [int] NOT NULL,
@@ -209,12 +209,12 @@ CREATE TABLE [guacamole].[guacamole_sharing_profile](
 /**
  * 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])
-    REFERENCES [guacamole].[guacamole_connection] ([connection_id])
+    REFERENCES [dbo].[guacamole_connection] ([connection_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE
-ALTER TABLE [guacamole].[guacamole_sharing_profile]
+ALTER TABLE [dbo].[guacamole_sharing_profile]
     CHECK CONSTRAINT [FK_guacamole_sharing_profile_connection]
 GO
 
@@ -224,7 +224,7 @@ GO
  */
 SET ANSI_NULLS ON
 SET QUOTED_IDENTIFIER ON
-CREATE TABLE [guacamole].[guacamole_connection_parameter](
+CREATE TABLE [dbo].[guacamole_connection_parameter](
     [connection_id] [int] NOT NULL,
     [parameter_name] [nvarchar](128) 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.
  */
-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])
-    REFERENCES [guacamole].[guacamole_connection] ([connection_id])
+    REFERENCES [dbo].[guacamole_connection] ([connection_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE
-ALTER TABLE [guacamole].[guacamole_connection_parameter]
+ALTER TABLE [dbo].[guacamole_connection_parameter]
     CHECK CONSTRAINT [FK_guacamole_connection_parameter_connection]
 GO
 
@@ -257,7 +257,7 @@ GO
  */
 SET ANSI_NULLS 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,
     [parameter_name] [nvarchar](128) 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
  * 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])
-    REFERENCES [guacamole].[guacamole_sharing_profile] ([sharing_profile_id])
+    REFERENCES [dbo].[guacamole_sharing_profile] ([sharing_profile_id])
         ON UPDATE 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]
 GO
 
@@ -291,10 +291,10 @@ GO
  */
 SET ANSI_NULLS ON
 SET QUOTED_IDENTIFIER ON
-CREATE TABLE [guacamole].[guacamole_connection_permission](
+CREATE TABLE [dbo].[guacamole_connection_permission](
     [user_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 
         ([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.
  */
-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])
-    REFERENCES [guacamole].[guacamole_connection] ([connection_id])
+    REFERENCES [dbo].[guacamole_connection] ([connection_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE
-ALTER TABLE [guacamole].[guacamole_connection_permission]
+ALTER TABLE [dbo].[guacamole_connection_permission]
     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])
-    REFERENCES [guacamole].[guacamole_user] ([user_id])
+    REFERENCES [dbo].[guacamole_user] ([user_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE
-ALTER TABLE [guacamole].[guacamole_connection_permission]
+ALTER TABLE [dbo].[guacamole_connection_permission]
     CHECK CONSTRAINT [FK_guacamole_connection_permission_user1]
 GO
 
@@ -331,10 +331,10 @@ GO
  */
 SET ANSI_NULLS ON
 SET QUOTED_IDENTIFIER ON
-CREATE TABLE [guacamole].[guacamole_connection_group_permission](
+CREATE TABLE [dbo].[guacamole_connection_group_permission](
     [user_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 
         ([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.
  */
-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])
-    REFERENCES [guacamole].[guacamole_connection_group] ([connection_group_id])
+    REFERENCES [dbo].[guacamole_connection_group] ([connection_group_id])
         ON UPDATE 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]
-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])
-    REFERENCES [guacamole].[guacamole_user] ([user_id])
+    REFERENCES [dbo].[guacamole_user] ([user_id])
         ON UPDATE 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]
 GO
 
@@ -371,10 +371,10 @@ GO
  */
 SET ANSI_NULLS ON
 SET QUOTED_IDENTIFIER ON
-CREATE TABLE [guacamole].[guacamole_sharing_profile_permission](
+CREATE TABLE [dbo].[guacamole_sharing_profile_permission](
     [user_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 
         ([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.
  */
-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])
-    REFERENCES [guacamole].[guacamole_sharing_profile] ([sharing_profile_id])
+    REFERENCES [dbo].[guacamole_sharing_profile] ([sharing_profile_id])
         ON UPDATE 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]
-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])
-    REFERENCES [guacamole].[guacamole_user] ([user_id])
+    REFERENCES [dbo].[guacamole_user] ([user_id])
         ON UPDATE 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]
 GO
 
@@ -411,9 +411,9 @@ GO
  */
 SET ANSI_NULLS ON
 SET QUOTED_IDENTIFIER ON
-CREATE TABLE [guacamole].[guacamole_system_permission](
+CREATE TABLE [dbo].[guacamole_system_permission](
     [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 
         ([user_id] ASC,	[permission] ASC)
@@ -428,12 +428,12 @@ CREATE TABLE [guacamole].[guacamole_system_permission](
 /**
  * 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])
-    REFERENCES [guacamole].[guacamole_user] ([user_id])
+    REFERENCES [dbo].[guacamole_user] ([user_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE
-ALTER TABLE [guacamole].[guacamole_system_permission]
+ALTER TABLE [dbo].[guacamole_system_permission]
     CHECK CONSTRAINT [FK_guacamole_system_permission_user]
 GO
 
@@ -443,10 +443,10 @@ GO
  */
 SET ANSI_NULLS ON
 SET QUOTED_IDENTIFIER ON
-CREATE TABLE [guacamole].[guacamole_user_permission](
+CREATE TABLE [dbo].[guacamole_user_permission](
     [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 
         ([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.
  */
-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])
-    REFERENCES [guacamole].[guacamole_user] ([user_id])
+    REFERENCES [dbo].[guacamole_user] ([user_id])
         ON UPDATE CASCADE
         ON DELETE CASCADE
-ALTER TABLE [guacamole].[guacamole_user_permission]
+ALTER TABLE [dbo].[guacamole_user_permission]
     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])
-    REFERENCES [guacamole].[guacamole_user] ([user_id])
-ALTER TABLE [guacamole].[guacamole_user_permission]
+    REFERENCES [dbo].[guacamole_user] ([user_id])
+ALTER TABLE [dbo].[guacamole_user_permission]
     CHECK CONSTRAINT [FK_guacamole_user_permission_user1]
 GO
 
@@ -481,7 +481,7 @@ GO
  */
 SET ANSI_NULLS 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,
     [user_id] [int] NULL,
     [username] [nvarchar](128) NOT NULL,
@@ -506,24 +506,24 @@ CREATE TABLE [guacamole].[guacamole_connection_history](
 /**
  * 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])
-    REFERENCES [guacamole].[guacamole_connection] ([connection_id])
+    REFERENCES [dbo].[guacamole_connection] ([connection_id])
         ON UPDATE CASCADE
         ON DELETE SET NULL
-ALTER TABLE [guacamole].[guacamole_connection_history]
+ALTER TABLE [dbo].[guacamole_connection_history]
     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])
-    REFERENCES [guacamole].[guacamole_sharing_profile] ([sharing_profile_id])
-ALTER TABLE [guacamole].[guacamole_connection_history]
+    REFERENCES [dbo].[guacamole_sharing_profile] ([sharing_profile_id])
+ALTER TABLE [dbo].[guacamole_connection_history]
     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])
-    REFERENCES [guacamole].[guacamole_user] ([user_id])
+    REFERENCES [dbo].[guacamole_user] ([user_id])
         ON UPDATE CASCADE
         ON DELETE SET NULL
-ALTER TABLE [guacamole].[guacamole_connection_history]
+ALTER TABLE [dbo].[guacamole_connection_history]
     CHECK CONSTRAINT [FK_guacamole_connection_history_user]
 GO
 
@@ -534,7 +534,7 @@ GO
  */
 SET ANSI_NULLS 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,
     [user_id] [int] 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
  */
-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])
-    REFERENCES [guacamole].[guacamole_user] ([user_id])
+    REFERENCES [dbo].[guacamole_user] ([user_id])
         ON UPDATE 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]
 GO

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/66c4b86b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
index fa807b2..408d7ca 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
@@ -20,20 +20,20 @@
 /**
  * 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());
 
-INSERT INTO [guacamole].[guacamole_user_permission]
-SELECT [guacamole].[guacamole_user].[user_id], [affected].[user_id], permission
+INSERT INTO [dbo].[guacamole_user_permission]
+SELECT [dbo].[guacamole_user].[user_id], [affected].[user_id], permission
 FROM (
     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, 'ADMINISTER' AS permission)
     permissions
-    JOIN [guacamole].[guacamole_user] ON permissions.username = [guacamole].[guacamole_user].[username]
-    JOIN [guacamole].[guacamole_user] affected ON permissions.affected_username = affected.username;
+    JOIN [dbo].[guacamole_user] ON permissions.username = [dbo].[guacamole_user].[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
 FROM (
     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, 'ADMINISTER' AS permission)
     permissions
-    JOIN [guacamole].[guacamole_user] ON permissions.username = [guacamole].[guacamole_user].[username];
+    JOIN [dbo].[guacamole_user] ON permissions.username = [dbo].[guacamole_user].[username];
 GO

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/66c4b86b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionMapper.xml
index 24008fc..c62ca6f 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionMapper.xml
@@ -51,13 +51,13 @@
     <!-- Select all connection identifiers -->
     <select id="selectIdentifiers" resultType="string">
         SELECT connection_id 
-        FROM [guacamole].[connection]
+        FROM [dbo].[guacamole_connection]
     </select>
 
     <!-- Select identifiers of all readable connections -->
     <select id="selectReadableIdentifiers" resultType="string">
         SELECT connection_id
-        FROM [guacamole].[connection_permission]
+        FROM [dbo].[guacamole_connection_permission]
         WHERE
             user_id = #{user.objectID,jdbcType=INTEGER}
             AND permission = 'READ'
@@ -66,7 +66,7 @@
     <!-- Select all connection identifiers within a particular connection group -->
     <select id="selectIdentifiersWithin" resultType="string">
         SELECT connection_id 
-        FROM [guacamole].[connection]
+        FROM [dbo].[guacamole_connection]
         WHERE
             <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</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 id="selectReadableIdentifiersWithin" resultType="string">
-        SELECT [guacamole].[connection].connection_id
-        FROM [guacamole].[connection]
-        JOIN [guacamole].[connection_permission] ON [guacamole].[connection_permission].connection_id = [guacamole].[connection].connection_id
+        SELECT [dbo].[guacamole_connection].connection_id
+        FROM [dbo].[guacamole_connection]
+        JOIN [dbo].[guacamole_connection_permission] ON [dbo].[guacamole_connection_permission].connection_id = [dbo].[guacamole_connection].connection_id
         WHERE
             <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if>
             <if test="parentIdentifier == null">parent_id IS NULL</if>
@@ -100,7 +100,7 @@
             proxy_encryption_method,
             connection_weight,
             failover_only
-        FROM [guacamole].[connection]
+        FROM [dbo].[guacamole_connection]
         WHERE connection_id IN
             <foreach collection="identifiers" item="identifier"
                      open="(" separator="," close=")">
@@ -108,7 +108,7 @@
             </foreach>;
 
         SELECT primary_connection_id, sharing_profile_id
-        FROM [guacamole].[sharing_profile]
+        FROM [dbo].[guacamole_sharing_profile]
         WHERE primary_connection_id IN
             <foreach collection="identifiers" item="identifier"
                      open="(" separator="," close=")">
@@ -122,7 +122,7 @@
             resultSets="connections,sharingProfiles">
 
         SELECT
-            [guacamole].[connection].connection_id,
+            [dbo].[guacamole_connection].connection_id,
             connection_name,
             parent_id,
             protocol,
@@ -133,9 +133,9 @@
             proxy_encryption_method,
             connection_weight,
             failover_only
-        FROM [guacamole].[connection]
-        JOIN [guacamole].[connection_permission] ON [guacamole].[connection_permission].connection_id = [guacamole].[connection].connection_id
-        WHERE [guacamole].[connection].connection_id IN
+        FROM [dbo].[guacamole_connection]
+        JOIN [dbo].[guacamole_connection_permission] ON [dbo].[guacamole_connection_permission].connection_id = [dbo].[guacamole_connection].connection_id
+        WHERE [dbo].[guacamole_connection].connection_id IN
             <foreach collection="identifiers" item="identifier"
                      open="(" separator="," close=")">
                 #{identifier,jdbcType=INTEGER}
@@ -143,9 +143,9 @@
             AND user_id = #{user.objectID,jdbcType=INTEGER}
             AND permission = 'READ';
 
-        SELECT primary_connection_id, [guacamole].[sharing_profile].sharing_profile_id
-        FROM [guacamole].[sharing_profile]
-        JOIN [guacamole].[sharing_profile_permission] ON [guacamole].[sharing_profile_permission].sharing_profile_id = [guacamole].[sharing_profile].sharing_profile_id
+        SELECT primary_connection_id, [dbo].[guacamole_sharing_profile].sharing_profile_id
+        FROM [dbo].[guacamole_sharing_profile]
+        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
             <foreach collection="identifiers" item="identifier"
                      open="(" separator="," close=")">
@@ -171,7 +171,7 @@
             proxy_encryption_method,
             connection_weight,
             failover_only
-        FROM [guacamole].[connection]
+        FROM [dbo].[guacamole_connection]
         WHERE 
             <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if>
             <if test="parentIdentifier == null">parent_id IS NULL</if>
@@ -181,7 +181,7 @@
 
     <!-- Delete single connection by identifier -->
     <delete id="delete">
-        DELETE FROM [guacamole].[connection]
+        DELETE FROM [dbo].[guacamole_connection]
         WHERE connection_id = #{identifier,jdbcType=INTEGER}
     </delete>
 
@@ -189,7 +189,7 @@
     <insert id="insert" useGeneratedKeys="true" keyProperty="object.objectID"
             parameterType="org.apache.guacamole.auth.jdbc.connection.ConnectionModel">
 
-        INSERT INTO [guacamole].[connection] (
+        INSERT INTO [dbo].[guacamole_connection] (
             connection_name,
             parent_id,
             protocol,
@@ -218,7 +218,7 @@
 
     <!-- Update single connection -->
     <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},
             parent_id                = #{object.parentIdentifier,jdbcType=INTEGER},
             protocol                 = #{object.protocol,jdbcType=VARCHAR},

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/66c4b86b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionParameterMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionParameterMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionParameterMapper.xml
index de1ab97..0d13aeb 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionParameterMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionParameterMapper.xml
@@ -36,21 +36,21 @@
             connection_id,
             parameter_name,
             parameter_value
-        FROM [guacamole].[connection_parameter]
+        FROM [dbo].[guacamole_connection_parameter]
         WHERE
             connection_id = #{identifier,jdbcType=INTEGER}
     </select>
 
     <!-- Delete all parameters of a given connection -->
     <delete id="delete">
-        DELETE FROM [guacamole].[connection_parameter]
+        DELETE FROM [dbo].[guacamole_connection_parameter]
         WHERE connection_id = #{identifier,jdbcType=INTEGER}
     </delete>
 
     <!-- Insert all given parameters -->
     <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.connection.ConnectionParameterModel">
 
-        INSERT INTO [guacamole].[connection_parameter] (
+        INSERT INTO [dbo].[guacamole_connection_parameter] (
             connection_id,
             parameter_name,
             parameter_value

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/66c4b86b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
index 2b873bb..648d16f 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
@@ -40,28 +40,28 @@
     <select id="select" resultMap="ConnectionRecordResultMap">
 
         SELECT
-            [guacamole].[connection_history].connection_id,
-            [guacamole].[connection_history].connection_name,
-            [guacamole].[connection_history].remote_host,
-            [guacamole].[connection_history].sharing_profile_id,
-            [guacamole].[connection_history].sharing_profile_name,
-            [guacamole].[connection_history].user_id,
-            [guacamole].[connection_history].username,
-            [guacamole].[connection_history].start_date,
-            [guacamole].[connection_history].end_date
-        FROM [guacamole].[connection_history]
+            [dbo].[guacamole_connection_history].connection_id,
+            [dbo].[guacamole_connection_history].connection_name,
+            [dbo].[guacamole_connection_history].remote_host,
+            [dbo].[guacamole_connection_history].sharing_profile_id,
+            [dbo].[guacamole_connection_history].sharing_profile_name,
+            [dbo].[guacamole_connection_history].user_id,
+            [dbo].[guacamole_connection_history].username,
+            [dbo].[guacamole_connection_history].start_date,
+            [dbo].[guacamole_connection_history].end_date
+        FROM [dbo].[guacamole_connection_history]
         WHERE
-            [guacamole].[connection_history].connection_id = #{identifier,jdbcType=INTEGER}
+            [dbo].[guacamole_connection_history].connection_id = #{identifier,jdbcType=INTEGER}
         ORDER BY
-            [guacamole].[connection_history].start_date DESC,
-            [guacamole].[connection_history].end_date DESC
+            [dbo].[guacamole_connection_history].start_date DESC,
+            [dbo].[guacamole_connection_history].end_date DESC
 
     </select>
 
     <!-- Insert the given connection record -->
     <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_name,
             remote_host,
@@ -78,7 +78,7 @@
             #{record.remoteHost,jdbcType=VARCHAR},
             #{record.sharingProfileIdentifier,jdbcType=INTEGER},
             #{record.sharingProfileName,jdbcType=VARCHAR},
-            (SELECT user_id FROM [guacamole].[user]
+            (SELECT user_id FROM [dbo].[guacamole_user]
              WHERE username = #{record.username,jdbcType=VARCHAR}),
             #{record.username,jdbcType=VARCHAR},
             #{record.startDate,jdbcType=TIMESTAMP},
@@ -91,31 +91,31 @@
     <select id="search" resultMap="ConnectionRecordResultMap">
 
         SELECT TOP (#{limit,jdbcType=INTEGER})
-            [guacamole].[connection_history].connection_id,
-            [guacamole].[connection_history].connection_name,
-            [guacamole].[connection_history].remote_host,
-            [guacamole].[connection_history].sharing_profile_id,
-            [guacamole].[connection_history].sharing_profile_name,
-            [guacamole].[connection_history].user_id,
-            [guacamole].[connection_history].username,
-            [guacamole].[connection_history].start_date,
-            [guacamole].[connection_history].end_date
-        FROM [guacamole].[connection_history]
+            [dbo].[guacamole_connection_history].connection_id,
+            [dbo].[guacamole_connection_history].connection_name,
+            [dbo].[guacamole_connection_history].remote_host,
+            [dbo].[guacamole_connection_history].sharing_profile_id,
+            [dbo].[guacamole_connection_history].sharing_profile_name,
+            [dbo].[guacamole_connection_history].user_id,
+            [dbo].[guacamole_connection_history].username,
+            [dbo].[guacamole_connection_history].start_date,
+            [dbo].[guacamole_connection_history].end_date
+        FROM [dbo].[guacamole_connection_history]
 
         <!-- Search terms -->
         <foreach collection="terms" item="term"
                  open="WHERE " separator=" AND ">
             (
 
-                [guacamole].[connection_history].user_id IN (
+                [dbo].[guacamole_connection_history].user_id IN (
                     SELECT user_id
-                    FROM [guacamole].[user]
+                    FROM [dbo].[guacamole_user]
                     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
-                    FROM [guacamole].[connection]
+                    FROM [dbo].[guacamole_connection]
                     WHERE POSITION(#{term.term,jdbcType=VARCHAR} IN connection_name) > 0
                 )
 
@@ -133,7 +133,7 @@
         <foreach collection="sortPredicates" item="sortPredicate"
                  open="ORDER BY " separator=", ">
             <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>
             </choose>
             <if test="sortPredicate.descending">DESC</if>
@@ -145,45 +145,45 @@
     <select id="searchReadable" resultMap="ConnectionRecordResultMap">
 
         SELECT TOP (#{limit,jdbcType=INTEGER})
-            [guacamole].[connection_history].connection_id,
-            [guacamole].[connection_history].connection_name,
-            [guacamole].[connection_history].remote_host,
-            [guacamole].[connection_history].sharing_profile_id,
-            [guacamole].[connection_history].sharing_profile_name,
-            [guacamole].[connection_history].user_id,
-            [guacamole].[connection_history].username,
-            [guacamole].[connection_history].start_date,
-            [guacamole].[connection_history].end_date
-        FROM [guacamole].[connection_history]
-        LEFT JOIN [guacamole].[connection]            ON [guacamole].[connection_history].connection_id = [guacamole].[connection].connection_id
-        LEFT JOIN [guacamole].[user]                  ON [guacamole].[connection_history].user_id       = [guacamole].[user].user_id
+            [dbo].[guacamole_connection_history].connection_id,
+            [dbo].[guacamole_connection_history].connection_name,
+            [dbo].[guacamole_connection_history].remote_host,
+            [dbo].[guacamole_connection_history].sharing_profile_id,
+            [dbo].[guacamole_connection_history].sharing_profile_name,
+            [dbo].[guacamole_connection_history].user_id,
+            [dbo].[guacamole_connection_history].username,
+            [dbo].[guacamole_connection_history].start_date,
+            [dbo].[guacamole_connection_history].end_date
+        FROM [dbo].[guacamole_connection_history]
+        LEFT JOIN [dbo].[guacamole_connection]            ON [dbo].[guacamole_connection_history].connection_id = [dbo].[guacamole_connection].connection_id
+        LEFT JOIN [dbo].[guacamole_user]                  ON [dbo].[guacamole_connection_history].user_id       = [dbo].[guacamole_user].user_id
 
         <!-- Restrict to readable connections -->
-        JOIN [guacamole].[connection_permission] ON
-                [guacamole].[connection_history].connection_id = [guacamole].[connection_permission].connection_id
-            AND [guacamole].[connection_permission].user_id    = #{user.objectID,jdbcType=INTEGER}
-            AND [guacamole].[connection_permission].permission = 'READ'
+        JOIN [dbo].[guacamole_connection_permission] ON
+                [dbo].[guacamole_connection_history].connection_id = [dbo].[guacamole_connection_permission].connection_id
+            AND [dbo].[guacamole_connection_permission].user_id    = #{user.objectID,jdbcType=INTEGER}
+            AND [dbo].[guacamole_connection_permission].permission = 'READ'
 
         <!-- Restrict to readable users -->
-        JOIN [guacamole].[user_permission] ON
-                [guacamole].[connection_history].user_id = [guacamole].[user_permission].affected_user_id
-            AND [guacamole].[user_permission].user_id    = #{user.objectID,jdbcType=INTEGER}
-            AND [guacamole].[user_permission].permission = 'READ'
+        JOIN [dbo].[guacamole_user_permission] ON
+                [dbo].[guacamole_connection_history].user_id = [dbo].[guacamole_user_permission].affected_user_id
+            AND [dbo].[guacamole_user_permission].user_id    = #{user.objectID,jdbcType=INTEGER}
+            AND [dbo].[guacamole_user_permission].permission = 'READ'
 
         <!-- Search terms -->
         <foreach collection="terms" item="term"
                  open="WHERE " separator=" AND ">
             (
 
-                [guacamole].[connection_history].user_id IN (
+                [dbo].[guacamole_connection_history].user_id IN (
                     SELECT user_id
-                    FROM [guacamole].[user]
+                    FROM [dbo].[guacamole_user]
                     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
-                    FROM [guacamole].[connection]
+                    FROM [dbo].[guacamole_connection]
                     WHERE POSITION(#{term.term,jdbcType=VARCHAR} IN connection_name) > 0
                 )
 
@@ -201,7 +201,7 @@
         <foreach collection="sortPredicates" item="sortPredicate"
                  open="ORDER BY " separator=", ">
             <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>
             </choose>
             <if test="sortPredicate.descending">DESC</if>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/66c4b86b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connectiongroup/ConnectionGroupMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connectiongroup/ConnectionGroupMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connectiongroup/ConnectionGroupMapper.xml
index 47a3e63..d1f97a7 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connectiongroup/ConnectionGroupMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connectiongroup/ConnectionGroupMapper.xml
@@ -53,13 +53,13 @@
     <!-- Select all connection group identifiers -->
     <select id="selectIdentifiers" resultType="string">
         SELECT connection_group_id 
-        FROM [guacamole].[connection_group]
+        FROM [dbo].[guacamole_connection_group]
     </select>
 
     <!-- Select identifiers of all readable connection groups -->
     <select id="selectReadableIdentifiers" resultType="string">
         SELECT connection_group_id
-        FROM [guacamole].[connection_group_permission]
+        FROM [dbo].[guacamole_connection_group_permission]
         WHERE
             user_id = #{user.objectID,jdbcType=INTEGER}
             AND permission = 'READ'
@@ -68,7 +68,7 @@
     <!-- Select all connection identifiers within a particular connection group -->
     <select id="selectIdentifiersWithin" resultType="string">
         SELECT connection_group_id 
-        FROM [guacamole].[connection_group]
+        FROM [dbo].[guacamole_connection_group]
         WHERE
             <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</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 id="selectReadableIdentifiersWithin" resultType="string">
-        SELECT [guacamole].[connection_group].connection_group_id
-        FROM [guacamole].[connection_group]
-        JOIN [guacamole].[connection_group_permission] ON [guacamole].[connection_group_permission].connection_group_id = [guacamole].[connection_group].connection_group_id
+        SELECT [dbo].[guacamole_connection_group].connection_group_id
+        FROM [dbo].[guacamole_connection_group]
+        JOIN [dbo].[guacamole_connection_group_permission] ON [dbo].[guacamole_connection_group_permission].connection_group_id = [dbo].[guacamole_connection_group].connection_group_id
         WHERE
             <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if>
             <if test="parentIdentifier == null">parent_id IS NULL</if>
@@ -98,7 +98,7 @@
             max_connections,
             max_connections_per_user,
             enable_session_affinity
-        FROM [guacamole].[connection_group]
+        FROM [dbo].[guacamole_connection_group]
         WHERE connection_group_id IN
             <foreach collection="identifiers" item="identifier"
                      open="(" separator="," close=")">
@@ -106,7 +106,7 @@
             </foreach>;
 
         SELECT parent_id, connection_group_id
-        FROM [guacamole].[connection_group]
+        FROM [dbo].[guacamole_connection_group]
         WHERE parent_id IN
             <foreach collection="identifiers" item="identifier"
                      open="(" separator="," close=")">
@@ -114,7 +114,7 @@
             </foreach>;
 
         SELECT parent_id, connection_id
-        FROM [guacamole].[connection]
+        FROM [dbo].[guacamole_connection]
         WHERE parent_id IN
             <foreach collection="identifiers" item="identifier"
                      open="(" separator="," close=")">
@@ -128,16 +128,16 @@
             resultSets="connectionGroups,childConnectionGroups,childConnections">
 
         SELECT
-            [guacamole].[connection_group].connection_group_id,
+            [dbo].[guacamole_connection_group].connection_group_id,
             connection_group_name,
             parent_id,
             type,
             max_connections,
             max_connections_per_user,
             enable_session_affinity
-        FROM [guacamole].[connection_group]
-        JOIN [guacamole].[connection_group_permission] ON [guacamole].[connection_group_permission].connection_group_id = [guacamole].[connection_group].connection_group_id
-        WHERE [guacamole].[connection_group].connection_group_id IN
+        FROM [dbo].[guacamole_connection_group]
+        JOIN [dbo].[guacamole_connection_group_permission] ON [dbo].[guacamole_connection_group_permission].connection_group_id = [dbo].[guacamole_connection_group].connection_group_id
+        WHERE [dbo].[guacamole_connection_group].connection_group_id IN
             <foreach collection="identifiers" item="identifier"
                      open="(" separator="," close=")">
                 #{identifier,jdbcType=INTEGER}
@@ -145,9 +145,9 @@
             AND user_id = #{user.objectID,jdbcType=INTEGER}
             AND permission = 'READ';
 
-        SELECT parent_id, [guacamole].[connection_group].connection_group_id
-        FROM [guacamole].[connection_group]
-        JOIN [guacamole].[connection_group_permission] ON [guacamole].[connection_group_permission].connection_group_id = [guacamole].[connection_group].connection_group_id
+        SELECT parent_id, [dbo].[guacamole_connection_group].connection_group_id
+        FROM [dbo].[guacamole_connection_group]
+        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
             <foreach collection="identifiers" item="identifier"
                      open="(" separator="," close=")">
@@ -156,9 +156,9 @@
             AND user_id = #{user.objectID,jdbcType=INTEGER}
             AND permission = 'READ';
 
-        SELECT parent_id, [guacamole].[connection].connection_id
-        FROM [guacamole].[connection]
-        JOIN [guacamole].[connection_permission] ON [guacamole].[connection_permission].connection_id = [guacamole].[connection].connection_id
+        SELECT parent_id, [dbo].[guacamole_connection].connection_id
+        FROM [dbo].[guacamole_connection]
+        JOIN [dbo].[guacamole_connection_permission] ON [dbo].[guacamole_connection_permission].connection_id = [dbo].[guacamole_connection].connection_id
         WHERE parent_id IN
             <foreach collection="identifiers" item="identifier"
                      open="(" separator="," close=")">
@@ -180,7 +180,7 @@
             max_connections,
             max_connections_per_user,
             enable_session_affinity
-        FROM [guacamole].[connection_group]
+        FROM [dbo].[guacamole_connection_group]
         WHERE 
             <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if>
             <if test="parentIdentifier == null">parent_id IS NULL</if>
@@ -190,7 +190,7 @@
 
     <!-- Delete single connection group by identifier -->
     <delete id="delete">
-        DELETE FROM [guacamole].[connection_group]
+        DELETE FROM [dbo].[guacamole_connection_group]
         WHERE connection_group_id = #{identifier,jdbcType=INTEGER}
     </delete>
 
@@ -198,7 +198,7 @@
     <insert id="insert" useGeneratedKeys="true" keyProperty="object.objectID"
             parameterType="org.apache.guacamole.auth.jdbc.connectiongroup.ConnectionGroupModel">
 
-        INSERT INTO [guacamole].[connection_group] (
+        INSERT INTO [dbo].[guacamole_connection_group] (
             connection_group_name,
             parent_id,
             type,
@@ -219,7 +219,7 @@
 
     <!-- Update single connection group -->
     <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},
             parent_id                = #{object.parentIdentifier,jdbcType=INTEGER},
             type                     = #{object.type,jdbcType=VARCHAR},

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/66c4b86b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionGroupPermissionMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionGroupPermissionMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionGroupPermissionMapper.xml
index a799888..ff69a75 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionGroupPermissionMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionGroupPermissionMapper.xml
@@ -36,13 +36,13 @@
     <select id="select" resultMap="ConnectionGroupPermissionResultMap">
 
         SELECT
-            [guacamole].[connection_group_permission].user_id,
+            [dbo].[guacamole_connection_group_permission].user_id,
             username,
             permission,
             connection_group_id
-        FROM [guacamole].[connection_group_permission]
-        JOIN [guacamole].[user] ON [guacamole].[connection_group_permission].user_id = [guacamole].[user].user_id
-        WHERE [guacamole].[connection_group_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+        FROM [dbo].[guacamole_connection_group_permission]
+        JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_connection_group_permission].user_id = [dbo].[guacamole_user].user_id
+        WHERE [dbo].[guacamole_connection_group_permission].user_id = #{user.objectID,jdbcType=INTEGER}
 
     </select>
 
@@ -50,14 +50,14 @@
     <select id="selectOne" resultMap="ConnectionGroupPermissionResultMap">
 
         SELECT
-            [guacamole].[connection_group_permission].user_id,
+            [dbo].[guacamole_connection_group_permission].user_id,
             username,
             permission,
             connection_group_id
-        FROM [guacamole].[connection_group_permission]
-        JOIN [guacamole].[user] ON [guacamole].[connection_group_permission].user_id = [guacamole].[user].user_id
+        FROM [dbo].[guacamole_connection_group_permission]
+        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}
+            [dbo].[guacamole_connection_group_permission].user_id = #{user.objectID,jdbcType=INTEGER}
             AND permission = #{type,jdbcType=VARCHAR}
             AND connection_group_id = #{identifier,jdbcType=INTEGER}
 
@@ -67,7 +67,7 @@
     <select id="selectAccessibleIdentifiers" resultType="string">
 
         SELECT DISTINCT connection_group_id 
-        FROM [guacamole].[connection_group_permission]
+        FROM [dbo].[guacamole_connection_group_permission]
         WHERE
             user_id = #{user.objectID,jdbcType=INTEGER}
             AND connection_group_id IN
@@ -86,7 +86,7 @@
     <!-- Delete all given permissions -->
     <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
             <foreach collection="permissions" item="permission"
                      open="(" separator="," close=")">
@@ -100,7 +100,7 @@
     <!-- Insert all given permissions -->
     <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,
             permission,
             connection_group_id
@@ -117,10 +117,10 @@
                        #{permission.objectIdentifier,jdbcType=INTEGER} AS connection_group_id
             </foreach>
         AS permissions
-        WHERE NOT EXISTS (SELECT 1 FROM [guacamole].[connection_group_permission]
-            WHERE [guacamole].[connection_group_permission].user_id = permissions.user_id AND
-            [guacamole].[connection_group_permission].permission = permissions.permission AND
-            [guacamole].[connection_group_permission].connection_group_id = permissions.connection_group_id
+        WHERE NOT EXISTS (SELECT 1 FROM [dbo].[guacamole_connection_group_permission]
+            WHERE [dbo].[guacamole_connection_group_permission].user_id = permissions.user_id AND
+            [dbo].[guacamole_connection_group_permission].permission = permissions.permission AND
+            [dbo].[guacamole_connection_group_permission].connection_group_id = permissions.connection_group_id
         );
 
     </insert>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/66c4b86b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionPermissionMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionPermissionMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionPermissionMapper.xml
index 08e875c..fa25f63 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionPermissionMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionPermissionMapper.xml
@@ -36,13 +36,13 @@
     <select id="select" resultMap="ConnectionPermissionResultMap">
 
         SELECT
-            [guacamole].[connection_permission].user_id,
+            [dbo].[guacamole_connection_permission].user_id,
             username,
             permission,
             connection_id
-        FROM [guacamole].[connection_permission]
-        JOIN [guacamole].[user] ON [guacamole].[connection_permission].user_id = [guacamole].[user].user_id
-        WHERE [guacamole].[connection_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+        FROM [dbo].[guacamole_connection_permission]
+        JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_connection_permission].user_id = [dbo].[guacamole_user].user_id
+        WHERE [dbo].[guacamole_connection_permission].user_id = #{user.objectID,jdbcType=INTEGER}
 
     </select>
 
@@ -50,14 +50,14 @@
     <select id="selectOne" resultMap="ConnectionPermissionResultMap">
 
         SELECT
-            [guacamole].[connection_permission].user_id,
+            [dbo].[guacamole_connection_permission].user_id,
             username,
             permission,
             connection_id
-        FROM [guacamole].[connection_permission]
-        JOIN [guacamole].[user] ON [guacamole].[connection_permission].user_id = [guacamole].[user].user_id
+        FROM [dbo].[guacamole_connection_permission]
+        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}
+            [dbo].[guacamole_connection_permission].user_id = #{user.objectID,jdbcType=INTEGER}
             AND permission = #{type,jdbcType=VARCHAR}
             AND connection_id = #{identifier,jdbcType=INTEGER}
 
@@ -67,7 +67,7 @@
     <select id="selectAccessibleIdentifiers" resultType="string">
 
         SELECT DISTINCT connection_id 
-        FROM [guacamole].[connection_permission]
+        FROM [dbo].[guacamole_connection_permission]
         WHERE
             user_id = #{user.objectID,jdbcType=INTEGER}
             AND connection_id IN
@@ -86,7 +86,7 @@
     <!-- Delete all given permissions -->
     <delete id="delete" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
 
-        DELETE FROM [guacamole].[connection_permission]
+        DELETE FROM [dbo].[guacamole_connection_permission]
         WHERE
             <foreach collection="permissions" item="permission"
                      open="(" separator=" OR " close=")">
@@ -100,7 +100,7 @@
     <!-- Insert all given permissions -->
     <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
 
-        INSERT INTO [guacamole].[connection_permission] (
+        INSERT INTO [dbo].[guacamole_connection_permission] (
             user_id,
             permission,
             connection_id
@@ -117,10 +117,10 @@
                        #{permission.objectIdentifier,jdbcType=INTEGER} AS connection_id
             </foreach>
         AS permissions
-        WHERE NOT EXISTS ( SELECT 1 FROM [guacamole].[connection_permission]
-            WHERE [guacamole].[connection_permission].user_id = permissions.user_id AND
-            [guacamole].[connection_permission].permission = permissions.permission AND
-            [guacamole].[connection_permission].connection_id = permissions.connection_id
+        WHERE NOT EXISTS ( SELECT 1 FROM [dbo].[guacamole_connection_permission]
+            WHERE [dbo].[guacamole_connection_permission].user_id = permissions.user_id AND
+            [dbo].[guacamole_connection_permission].permission = permissions.permission AND
+            [dbo].[guacamole_connection_permission].connection_id = permissions.connection_id
         );
 
     </insert>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/66c4b86b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SharingProfilePermissionMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SharingProfilePermissionMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SharingProfilePermissionMapper.xml
index 354dfb5..40e9907 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SharingProfilePermissionMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SharingProfilePermissionMapper.xml
@@ -36,13 +36,13 @@
     <select id="select" resultMap="SharingProfilePermissionResultMap">
 
         SELECT
-            [guacamole].[sharing_profile_permission].user_id,
+            [dbo].[guacamole_sharing_profile_permission].user_id,
             username,
             permission,
             sharing_profile_id
-        FROM [guacamole].[sharing_profile_permission]
-        JOIN [guacamole].[user] ON [guacamole].[sharing_profile_permission].user_id = [guacamole].[user].user_id
-        WHERE [guacamole].[sharing_profile_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+        FROM [dbo].[guacamole_sharing_profile_permission]
+        JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_sharing_profile_permission].user_id = [dbo].[guacamole_user].user_id
+        WHERE [dbo].[guacamole_sharing_profile_permission].user_id = #{user.objectID,jdbcType=INTEGER}
 
     </select>
 
@@ -50,14 +50,14 @@
     <select id="selectOne" resultMap="SharingProfilePermissionResultMap">
 
         SELECT
-            [guacamole].[sharing_profile_permission].user_id,
+            [dbo].[guacamole_sharing_profile_permission].user_id,
             username,
             permission,
             sharing_profile_id
-        FROM [guacamole].[sharing_profile_permission]
-        JOIN [guacamole].[user] ON [guacamole].[sharing_profile_permission].user_id = [guacamole].[user].user_id
+        FROM [dbo].[guacamole_sharing_profile_permission]
+        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}
+            [dbo].[guacamole_sharing_profile_permission].user_id = #{user.objectID,jdbcType=INTEGER}
             AND permission = #{type,jdbcType=VARCHAR}
             AND sharing_profile_id = #{identifier,jdbcType=INTEGER}
 
@@ -67,7 +67,7 @@
     <select id="selectAccessibleIdentifiers" resultType="string">
 
         SELECT DISTINCT sharing_profile_id
-        FROM [guacamole].[sharing_profile_permission]
+        FROM [dbo].[guacamole_sharing_profile_permission]
         WHERE
             user_id = #{user.objectID,jdbcType=INTEGER}
             AND sharing_profile_id IN
@@ -86,7 +86,7 @@
     <!-- Delete all given permissions -->
     <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
             <foreach collection="permissions" item="permission"
                      open="(" separator=" OR " close=")">
@@ -100,7 +100,7 @@
     <!-- Insert all given permissions -->
     <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,
             permission,
             sharing_profile_id
@@ -117,10 +117,10 @@
                        #{permission.objectIdentifier,jdbcType=INTEGER} AS sharing_profile_id
             </foreach>
         AS permissions
-        WHERE NOT EXISTS (SELECT 1 FROM [guacamole].[sharing_profile_permission]
-            WHERE [guacamole].[sharing_profile_permission].user_id = permissions.user_id
-            AND [guacamole].[sharing_profile_permission].permission = permissions.permission
-            AND [guacamole].[sharing_profile_permission].sharing_profile_id = permissions.sharing_profile_id
+        WHERE NOT EXISTS (SELECT 1 FROM [dbo].[guacamole_sharing_profile_permission]
+            WHERE [dbo].[guacamole_sharing_profile_permission].user_id = permissions.user_id
+            AND [dbo].[guacamole_sharing_profile_permission].permission = permissions.permission
+            AND [dbo].[guacamole_sharing_profile_permission].sharing_profile_id = permissions.sharing_profile_id
         );
 
     </insert>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/66c4b86b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SystemPermissionMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SystemPermissionMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SystemPermissionMapper.xml
index 0488779..d33dd3b 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SystemPermissionMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SystemPermissionMapper.xml
@@ -35,12 +35,12 @@
     <select id="select" resultMap="SystemPermissionResultMap">
 
         SELECT
-            [guacamole].[system_permission].user_id,
+            [dbo].[guacamole_system_permission].user_id,
             username,
             permission
-        FROM [guacamole].[system_permission]
-        JOIN [guacamole].[user] ON [guacamole].[system_permission].user_id = [guacamole].[user].user_id
-        WHERE [guacamole].[system_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+        FROM [dbo].[guacamole_system_permission]
+        JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_system_permission].user_id = [dbo].[guacamole_user].user_id
+        WHERE [dbo].[guacamole_system_permission].user_id = #{user.objectID,jdbcType=INTEGER}
 
     </select>
 
@@ -48,13 +48,13 @@
     <select id="selectOne" resultMap="SystemPermissionResultMap">
 
         SELECT
-            [guacamole].[system_permission].user_id,
+            [dbo].[guacamole_system_permission].user_id,
             username,
             permission
-        FROM [guacamole].[system_permission]
-        JOIN [guacamole].[user] ON [guacamole].[system_permission].user_id = [guacamole].[user].user_id
+        FROM [dbo].[guacamole_system_permission]
+        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}
+            [dbo].[guacamole_system_permission].user_id = #{user.objectID,jdbcType=INTEGER}
             AND permission = #{type,jdbcType=VARCHAR}
 
     </select>
@@ -62,7 +62,7 @@
     <!-- Delete all given permissions -->
     <delete id="delete" parameterType="org.apache.guacamole.auth.jdbc.permission.SystemPermissionModel">
 
-        DELETE FROM [guacamole].[system_permission]
+        DELETE FROM [dbo].[guacamole_system_permission]
         WHERE
             <foreach collection="permissions" item="permission"
                      open="(" separator=" OR " close=")">
@@ -75,7 +75,7 @@
     <!-- Insert all given permissions -->
     <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.permission.SystemPermissionModel">
 
-        INSERT INTO [guacamole].[system_permission] (
+        INSERT INTO [dbo].[guacamole_system_permission] (
             user_id,
             permission
         )
@@ -89,9 +89,9 @@
                        #{permission.type,jdbcType=VARCHAR} AS permission
             </foreach>
         AS permissions
-        WHERE NOT EXISTS (SELECT 1 FROM [guacamole].[system_permission]
-            WHERE [guacamole].[system_permission].user_id = permissions.user_id
-            AND [guacamole].[system_permission].permission = permissions.permission
+        WHERE NOT EXISTS (SELECT 1 FROM [dbo].[guacamole_system_permission]
+            WHERE [dbo].[guacamole_system_permission].user_id = permissions.user_id
+            AND [dbo].[guacamole_system_permission].permission = permissions.permission
         );
 
     </insert>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/66c4b86b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/UserPermissionMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/UserPermissionMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/UserPermissionMapper.xml
index 606719d..a2d416f 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/UserPermissionMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/UserPermissionMapper.xml
@@ -36,14 +36,14 @@
     <select id="select" resultMap="UserPermissionResultMap">
 
         SELECT
-            [guacamole].[user_permission].user_id,
-            [guacamole].[user].username,
+            [dbo].[guacamole_user_permission].user_id,
+            [dbo].[guacamole_user].username,
             permission,
             affected.username AS affected_username
-        FROM [guacamole].[user_permission]
-        JOIN [guacamole].[user] ON [guacamole].[user_permission].user_id = [guacamole].[user].user_id
-        JOIN [guacamole].[user] affected ON [guacamole].[user_permission].affected_user_id = affected.user_id
-        WHERE [guacamole].[user_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+        FROM [dbo].[guacamole_user_permission]
+        JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_user_permission].user_id = [dbo].[guacamole_user].user_id
+        JOIN [dbo].[guacamole_user] affected ON [dbo].[guacamole_user_permission].affected_user_id = affected.user_id
+        WHERE [dbo].[guacamole_user_permission].user_id = #{user.objectID,jdbcType=INTEGER}
 
     </select>
 
@@ -51,15 +51,15 @@
     <select id="selectOne" resultMap="UserPermissionResultMap">
 
         SELECT
-            [guacamole].[user_permission].user_id,
-            [guacamole].[user].username,
+            [dbo].[guacamole_user_permission].user_id,
+            [dbo].[guacamole_user].username,
             permission,
             affected.username AS affected_username
-        FROM [guacamole].[user_permission]
-        JOIN [guacamole].[user] ON [guacamole].[user_permission].user_id = [guacamole].[user].user_id
-        JOIN [guacamole].[user] affected ON [guacamole].[user_permission].affected_user_id = affected.user_id
+        FROM [dbo].[guacamole_user_permission]
+        JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_user_permission].user_id = [dbo].[guacamole_user].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}
+            [dbo].[guacamole_user_permission].user_id = #{user.objectID,jdbcType=INTEGER}
             AND permission = #{type,jdbcType=VARCHAR}
             AND affected.username = #{identifier,jdbcType=INTEGER}
 
@@ -69,10 +69,10 @@
     <select id="selectAccessibleIdentifiers" resultType="string">
 
         SELECT DISTINCT username
-        FROM [guacamole].[user_permission]
-        JOIN [guacamole].[user] ON [guacamole].[user_permission].affected_user_id = [guacamole].[user].user_id
+        FROM [dbo].[guacamole_user_permission]
+        JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_user_permission].affected_user_id = [dbo].[guacamole_user].user_id
         WHERE
-            [guacamole].[user_permission].user_id = #{user.objectID,jdbcType=INTEGER}
+            [dbo].[guacamole_user_permission].user_id = #{user.objectID,jdbcType=INTEGER}
             AND username IN
                 <foreach collection="identifiers" item="identifier"
                          open="(" separator="," close=")">
@@ -89,11 +89,11 @@
     <!-- Delete all given permissions -->
     <delete id="delete" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
 
-        DELETE FROM [guacamole].[user_permission]
-        USING [guacamole].[user] affected
+        DELETE FROM [dbo].[guacamole_user_permission]
+        USING [dbo].[guacamole_user] affected
         WHERE
-            [guacamole].[user_permission].affected_user_id = affected.user_id
-            AND ([guacamole].[user_permission].user_id, permission, affected.username) IN
+            [dbo].[guacamole_user_permission].affected_user_id = affected.user_id
+            AND ([dbo].[guacamole_user_permission].user_id, permission, affected.username) IN
                 <foreach collection="permissions" item="permission"
                          open="(" separator="," close=")">
                     (#{permission.userID,jdbcType=INTEGER},
@@ -106,7 +106,7 @@
     <!-- Insert all given permissions -->
     <insert id="insert" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
 
-        INSERT INTO [guacamole].[user_permission] (
+        INSERT INTO [dbo].[guacamole_user_permission] (
             user_id,
             permission,
             affected_user_id
@@ -114,7 +114,7 @@
         SELECT DISTINCT
             permissions.user_id,
             permissions.permission,
-            [guacamole].[user].user_id
+            [dbo].[guacamole_user].user_id
         FROM
             <foreach collection="permissions" item="permission"
                      open="(" separator="UNION ALL" close=")">
@@ -123,11 +123,11 @@
                        #{permission.objectIdentifier,jdbcType=INTEGER}                       AS username
             </foreach>
         AS permissions
-        JOIN [guacamole].[user] ON [guacamole].[user].username = permissions.username
-        WHERE NOT EXISTS (SELECT 1 FROM [guacamole].[user_permission]
-            WHERE [guacamole].[user_permission].user_id = permissions.user_id
-            AND [guacamole].[user_permission].permission = permissions.permission
-            AND [guacamole].[user_permission].affected_user_id = [guacamole].[user].user_id
+        JOIN [dbo].[guacamole_user] ON [dbo].[guacamole_user].username = permissions.username
+        WHERE NOT EXISTS (SELECT 1 FROM [dbo].[guacamole_user_permission]
+            WHERE [dbo].[guacamole_user_permission].user_id = permissions.user_id
+            AND [dbo].[guacamole_user_permission].permission = permissions.permission
+            AND [dbo].[guacamole_user_permission].affected_user_id = [dbo].[guacamole_user].user_id
         );
 
     </insert>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/66c4b86b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileMapper.xml
index 9d7d45a..d3b5c10 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileMapper.xml
@@ -33,13 +33,13 @@
     <!-- Select all sharing profile identifiers -->
     <select id="selectIdentifiers" resultType="string">
         SELECT sharing_profile_id
-        FROM [guacamole].[sharing_profile]
+        FROM [dbo].[guacamole_sharing_profile]
     </select>
 
     <!-- Select identifiers of all readable sharing profiles -->
     <select id="selectReadableIdentifiers" resultType="string">
         SELECT sharing_profile_id
-        FROM [guacamole].[sharing_profile_permission]
+        FROM [dbo].[guacamole_sharing_profile_permission]
         WHERE
             user_id = #{user.objectID,jdbcType=INTEGER}
             AND permission = 'READ'
@@ -52,7 +52,7 @@
             sharing_profile_id,
             sharing_profile_name,
             primary_connection_id
-        FROM [guacamole].[sharing_profile]
+        FROM [dbo].[guacamole_sharing_profile]
         WHERE sharing_profile_id IN
             <foreach collection="identifiers" item="identifier"
                      open="(" separator="," close=")">
@@ -65,12 +65,12 @@
     <select id="selectReadable" resultMap="SharingProfileResultMap">
 
         SELECT
-            [guacamole].[sharing_profile].sharing_profile_id,
-            [guacamole].[sharing_profile].sharing_profile_name,
+            [dbo].[guacamole_sharing_profile].sharing_profile_id,
+            [dbo].[guacamole_sharing_profile].sharing_profile_name,
             primary_connection_id
-        FROM [guacamole].[sharing_profile]
-        JOIN [guacamole].[sharing_profile_permission] ON [guacamole].[sharing_profile_permission].sharing_profile_id = [guacamole].[sharing_profile].sharing_profile_id
-        WHERE [guacamole].[sharing_profile].sharing_profile_id IN
+        FROM [dbo].[guacamole_sharing_profile]
+        JOIN [dbo].[guacamole_sharing_profile_permission] ON [dbo].[guacamole_sharing_profile_permission].sharing_profile_id = [dbo].[guacamole_sharing_profile].sharing_profile_id
+        WHERE [dbo].[guacamole_sharing_profile].sharing_profile_id IN
             <foreach collection="identifiers" item="identifier"
                      open="(" separator="," close=")">
                 #{identifier,jdbcType=INTEGER}
@@ -87,7 +87,7 @@
             sharing_profile_id,
             sharing_profile_name,
             primary_connection_id
-        FROM [guacamole].[sharing_profile]
+        FROM [dbo].[guacamole_sharing_profile]
         WHERE 
             primary_connection_id = #{parentIdentifier,jdbcType=INTEGER}
             AND sharing_profile_name = #{name,jdbcType=VARCHAR}
@@ -96,7 +96,7 @@
 
     <!-- Delete single sharing profile by identifier -->
     <delete id="delete">
-        DELETE FROM [guacamole].[sharing_profile]
+        DELETE FROM [dbo].[guacamole_sharing_profile]
         WHERE sharing_profile_id = #{identifier,jdbcType=INTEGER}
     </delete>
 
@@ -104,7 +104,7 @@
     <insert id="insert" useGeneratedKeys="true" keyProperty="object.objectID"
             parameterType="org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileModel">
 
-        INSERT INTO [guacamole].[sharing_profile] (
+        INSERT INTO [dbo].[guacamole_sharing_profile] (
             sharing_profile_name,
             primary_connection_id
         )
@@ -117,7 +117,7 @@
 
     <!-- Update single sharing profile -->
     <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},
             primary_connection_id = #{object.parentIdentifier,jdbcType=INTEGER}
         WHERE sharing_profile_id = #{object.objectID,jdbcType=INTEGER}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/66c4b86b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileParameterMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileParameterMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileParameterMapper.xml
index 8f4a3fa..c902276 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileParameterMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileParameterMapper.xml
@@ -36,21 +36,21 @@
             sharing_profile_id,
             parameter_name,
             parameter_value
-        FROM [guacamole].[sharing_profile_parameter]
+        FROM [dbo].[guacamole_sharing_profile_parameter]
         WHERE
             sharing_profile_id = #{identifier,jdbcType=INTEGER}
     </select>
 
     <!-- Delete all parameters of a given sharing profile -->
     <delete id="delete">
-        DELETE FROM [guacamole].[sharing_profile_parameter]
+        DELETE FROM [dbo].[guacamole_sharing_profile_parameter]
         WHERE sharing_profile_id = #{identifier,jdbcType=INTEGER}
     </delete>
 
     <!-- Insert all given parameters -->
     <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,
             parameter_name,
             parameter_value


[14/28] incubator-guacamole-client git commit: GUACAMOLE-263: Change user creation to use hash values used by other modules.

Posted by mj...@apache.org.
GUACAMOLE-263: Change user creation to use hash values used by other modules.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/b4d2f876
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/b4d2f876
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/b4d2f876

Branch: refs/heads/master
Commit: b4d2f8761aa5f49c13aa857a4370cfbf8a171679
Parents: 5ef7d11
Author: Nick Couchman <vn...@apache.org>
Authored: Wed Sep 27 09:38:43 2017 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Thu Sep 28 07:00:52 2017 -0400

----------------------------------------------------------------------
 .../schema/002-create-admin-user.sql                          | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b4d2f876/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
index d348b61..15944a2 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/002-create-admin-user.sql
@@ -20,8 +20,11 @@
 /**
  * Create the default admin user account and set up full privileges.
  */
-INSERT INTO [guacamole_user] (username, password_hash, password_date)
-VALUES ('guacadmin', HASHBYTES('SHA2_256', 'guacadmin'), getdate());
+INSERT INTO [guacamole_user] (username, password_hash, password_salt, password_date)
+VALUES ('guacadmin', 
+    0xCA458A7D494E3BE824F5E1E175A1556C0F8EEF2C2D7DF3633BEC4A29C4411960,
+    0xFE24ADC5E11E2B25288D1704ABE67A79E342ECC26064CE69C5B3177795A82264,
+    getdate());
 
 INSERT INTO [guacamole_user_permission]
 SELECT [guacamole_user].[user_id], [affected].[user_id], permission


[06/28] incubator-guacamole-client git commit: GUACAMOLE-363: Fix up JDBC maps for proper SQL Server syntax.

Posted by mj...@apache.org.
GUACAMOLE-363: Fix up JDBC maps for proper SQL Server syntax.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/75f51f22
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/75f51f22
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/75f51f22

Branch: refs/heads/master
Commit: 75f51f2244ac537c70c24283586b35975abfb663
Parents: b6e88d3
Author: Nick Couchman <vn...@apache.org>
Authored: Tue Aug 15 14:28:20 2017 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Thu Sep 28 07:00:52 2017 -0400

----------------------------------------------------------------------
 .../jdbc/connection/ConnectionRecordMapper.xml  |  8 ++------
 .../ConnectionGroupPermissionMapper.xml         | 10 ++++------
 .../permission/ConnectionPermissionMapper.xml   | 20 +++++++++-----------
 .../SharingProfilePermissionMapper.xml          | 20 +++++++++-----------
 .../jdbc/permission/SystemPermissionMapper.xml  | 16 +++++++---------
 .../jdbc/permission/UserPermissionMapper.xml    | 10 ++++------
 .../SharingProfileParameterMapper.xml           |  2 +-
 7 files changed, 36 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/75f51f22/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
index ec077db..2b873bb 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
@@ -90,7 +90,7 @@
     <!-- Search for specific connection records -->
     <select id="search" resultMap="ConnectionRecordResultMap">
 
-        SELECT
+        SELECT TOP (#{limit,jdbcType=INTEGER})
             [guacamole].[connection_history].connection_id,
             [guacamole].[connection_history].connection_name,
             [guacamole].[connection_history].remote_host,
@@ -139,14 +139,12 @@
             <if test="sortPredicate.descending">DESC</if>
         </foreach>
 
-        LIMIT #{limit,jdbcType=INTEGER}
-
     </select>
 
     <!-- Search for specific connection records -->
     <select id="searchReadable" resultMap="ConnectionRecordResultMap">
 
-        SELECT
+        SELECT TOP (#{limit,jdbcType=INTEGER})
             [guacamole].[connection_history].connection_id,
             [guacamole].[connection_history].connection_name,
             [guacamole].[connection_history].remote_host,
@@ -209,8 +207,6 @@
             <if test="sortPredicate.descending">DESC</if>
         </foreach>
 
-        LIMIT #{limit,jdbcType=INTEGER}
-
     </select>
 
 </mapper>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/75f51f22/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionGroupPermissionMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionGroupPermissionMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionGroupPermissionMapper.xml
index 2890ab3..a799888 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionGroupPermissionMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionGroupPermissionMapper.xml
@@ -117,12 +117,10 @@
                        #{permission.objectIdentifier,jdbcType=INTEGER} AS connection_group_id
             </foreach>
         AS permissions
-        WHERE (user_id, permission, connection_group_id) NOT IN (
-            SELECT
-                [guacamole].[connection_group_permission].user_id,
-                [guacamole].[connection_group_permission].permission,
-                [guacamole].[connection_group_permission].connection_group_id
-            FROM [guacamole].[connection_group_permission]
+        WHERE NOT EXISTS (SELECT 1 FROM [guacamole].[connection_group_permission]
+            WHERE [guacamole].[connection_group_permission].user_id = permissions.user_id AND
+            [guacamole].[connection_group_permission].permission = permissions.permission AND
+            [guacamole].[connection_group_permission].connection_group_id = permissions.connection_group_id
         );
 
     </insert>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/75f51f22/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionPermissionMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionPermissionMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionPermissionMapper.xml
index 8ea85bc..08e875c 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionPermissionMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/ConnectionPermissionMapper.xml
@@ -87,12 +87,12 @@
     <delete id="delete" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
 
         DELETE FROM [guacamole].[connection_permission]
-        WHERE (user_id, permission, connection_id) IN
+        WHERE
             <foreach collection="permissions" item="permission"
-                     open="(" separator="," close=")">
-                (#{permission.userID,jdbcType=INTEGER},
-                 #{permission.type,jdbcType=VARCHAR},
-                 #{permission.objectIdentifier,jdbcType=INTEGER})
+                     open="(" separator=" OR " close=")">
+                (user_id = #{permission.userID,jdbcType=INTEGER} AND
+                 permission = #{permission.type,jdbcType=VARCHAR} AND
+                 connection_id = #{permission.objectIdentifier,jdbcType=INTEGER})
             </foreach>
 
     </delete>
@@ -117,12 +117,10 @@
                        #{permission.objectIdentifier,jdbcType=INTEGER} AS connection_id
             </foreach>
         AS permissions
-        WHERE (user_id, permission, connection_id) NOT IN (
-            SELECT
-                [guacamole].[connection_permission].user_id,
-                [guacamole].[connection_permission].permission,
-                [guacamole].[connection_permission].connection_id
-            FROM [guacamole].[connection_permission]
+        WHERE NOT EXISTS ( SELECT 1 FROM [guacamole].[connection_permission]
+            WHERE [guacamole].[connection_permission].user_id = permissions.user_id AND
+            [guacamole].[connection_permission].permission = permissions.permission AND
+            [guacamole].[connection_permission].connection_id = permissions.connection_id
         );
 
     </insert>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/75f51f22/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SharingProfilePermissionMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SharingProfilePermissionMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SharingProfilePermissionMapper.xml
index cb706b8..354dfb5 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SharingProfilePermissionMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SharingProfilePermissionMapper.xml
@@ -87,12 +87,12 @@
     <delete id="delete" parameterType="org.apache.guacamole.auth.jdbc.permission.ObjectPermissionModel">
 
         DELETE FROM [guacamole].[sharing_profile_permission]
-        WHERE (user_id, permission, sharing_profile_id) IN
+        WHERE
             <foreach collection="permissions" item="permission"
-                     open="(" separator="," close=")">
-                (#{permission.userID,jdbcType=INTEGER},
-                 #{permission.type,jdbcType=VARCHAR},
-                 #{permission.objectIdentifier,jdbcType=INTEGER})
+                     open="(" separator=" OR " close=")">
+                (user_id = #{permission.userID,jdbcType=INTEGER} AND
+                 permission = #{permission.type,jdbcType=VARCHAR} AND
+                 sharing_profile_id = #{permission.objectIdentifier,jdbcType=INTEGER})
             </foreach>
 
     </delete>
@@ -117,12 +117,10 @@
                        #{permission.objectIdentifier,jdbcType=INTEGER} AS sharing_profile_id
             </foreach>
         AS permissions
-        WHERE (user_id, permission, sharing_profile_id) NOT IN (
-            SELECT
-                [guacamole].[sharing_profile_permission].user_id,
-                [guacamole].[sharing_profile_permission].permission,
-                [guacamole].[sharing_profile_permission].sharing_profile_id
-            FROM [guacamole].[sharing_profile_permission]
+        WHERE NOT EXISTS (SELECT 1 FROM [guacamole].[sharing_profile_permission]
+            WHERE [guacamole].[sharing_profile_permission].user_id = permissions.user_id
+            AND [guacamole].[sharing_profile_permission].permission = permissions.permission
+            AND [guacamole].[sharing_profile_permission].sharing_profile_id = permissions.sharing_profile_id
         );
 
     </insert>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/75f51f22/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SystemPermissionMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SystemPermissionMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SystemPermissionMapper.xml
index d9e622b..0488779 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SystemPermissionMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/SystemPermissionMapper.xml
@@ -63,11 +63,11 @@
     <delete id="delete" parameterType="org.apache.guacamole.auth.jdbc.permission.SystemPermissionModel">
 
         DELETE FROM [guacamole].[system_permission]
-        WHERE (user_id, permission) IN
+        WHERE
             <foreach collection="permissions" item="permission"
-                     open="(" separator="," close=")">
-                (#{permission.userID,jdbcType=INTEGER},
-                 #{permission.type,jdbcType=VARCHAR})
+                     open="(" separator=" OR " close=")">
+                     (user_id = #{permission.userID,jdbcType=INTEGER}
+                      AND permission = #{permission.type,jdbcType=VARCHAR})
             </foreach>
 
     </delete>
@@ -89,11 +89,9 @@
                        #{permission.type,jdbcType=VARCHAR} AS permission
             </foreach>
         AS permissions
-        WHERE (user_id, permission) NOT IN (
-            SELECT
-                [guacamole].[system_permission].user_id,
-                [guacamole].[system_permission].permission
-            FROM [guacamole].[system_permission]
+        WHERE NOT EXISTS (SELECT 1 FROM [guacamole].[system_permission]
+            WHERE [guacamole].[system_permission].user_id = permissions.user_id
+            AND [guacamole].[system_permission].permission = permissions.permission
         );
 
     </insert>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/75f51f22/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/UserPermissionMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/UserPermissionMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/UserPermissionMapper.xml
index 595c326..606719d 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/UserPermissionMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/permission/UserPermissionMapper.xml
@@ -124,12 +124,10 @@
             </foreach>
         AS permissions
         JOIN [guacamole].[user] ON [guacamole].[user].username = permissions.username
-        WHERE (permissions.user_id, permissions.permission, [guacamole].[user].user_id) NOT IN (
-            SELECT
-                [guacamole].[user_permission].user_id,
-                [guacamole].[user_permission].permission,
-                [guacamole].[user_permission].affected_user_id
-            FROM [guacamole].[user_permission]
+        WHERE NOT EXISTS (SELECT 1 FROM [guacamole].[user_permission]
+            WHERE [guacamole].[user_permission].user_id = permissions.user_id
+            AND [guacamole].[user_permission].permission = permissions.permission
+            AND [guacamole].[user_permission].affected_user_id = [guacamole].[user].user_id
         );
 
     </insert>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/75f51f22/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileParameterMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileParameterMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileParameterMapper.xml
index 8835350..8f4a3fa 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileParameterMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/resources/org/apache/guacamole/auth/jdbc/sharingprofile/SharingProfileParameterMapper.xml
@@ -57,7 +57,7 @@
         )
         VALUES 
             <foreach collection="parameters" item="parameter" separator=",">
-                (#{parameter.sharingProfileIdentifier,jdbcType=INTEGER}
+                (#{parameter.sharingProfileIdentifier,jdbcType=INTEGER},
                  #{parameter.name,jdbcType=VARCHAR},
                  #{parameter.value,jdbcType=VARCHAR})
             </foreach>


[22/28] incubator-guacamole-client git commit: GUACAMOLE-363: Change default driver case to throw an exception instead of default to SQL Server 2005 driver.

Posted by mj...@apache.org.
GUACAMOLE-363: Change default driver case to throw an exception instead of default to SQL Server 2005 driver.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/0459181e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/0459181e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/0459181e

Branch: refs/heads/master
Commit: 0459181e802dd12d868630569a2a508796181487
Parents: 7ecd391
Author: Nick Couchman <vn...@apache.org>
Authored: Wed Sep 27 09:05:56 2017 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Thu Sep 28 07:00:52 2017 -0400

----------------------------------------------------------------------
 .../auth/sqlserver/SQLServerAuthenticationProviderModule.java | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/0459181e/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java
index ee0584b..22cb474 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java
@@ -22,6 +22,7 @@ package org.apache.guacamole.auth.sqlserver;
 import com.google.inject.Binder;
 import com.google.inject.Module;
 import com.google.inject.name.Names;
+import java.lang.UnsupportedOperationException;
 import java.util.Properties;
 import org.apache.guacamole.GuacamoleException;
 import org.mybatis.guice.datasource.helper.JdbcHelper;
@@ -98,9 +99,13 @@ public class SQLServerAuthenticationProviderModule implements Module {
                 break;
 
             case MICROSOFT_2005:
-            default:
                 JdbcHelper.SQL_Server_2005_MS_Driver.configure(binder);
+                break;
 
+            default:
+                throw new UnsupportedOperationException(
+                    "A driver has been specified that is not supported by this module."
+                );
         }
         
         // Bind MyBatis properties


[18/28] incubator-guacamole-client git commit: GUACAMOLE-363: Make DEFAULT_USER_REQUIRED false.

Posted by mj...@apache.org.
GUACAMOLE-363: Make DEFAULT_USER_REQUIRED false.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/34711b7a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/34711b7a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/34711b7a

Branch: refs/heads/master
Commit: 34711b7a92d439aae8af3e51dc295c7d9ae635bf
Parents: 0459181
Author: Nick Couchman <vn...@apache.org>
Authored: Wed Sep 27 09:22:30 2017 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Thu Sep 28 07:00:52 2017 -0400

----------------------------------------------------------------------
 .../org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/34711b7a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java
index efd7ae1..20361e6 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java
@@ -50,7 +50,7 @@ public class SQLServerEnvironment extends JDBCEnvironment {
      * Whether a database user account is required by default for authentication
      * to succeed.
      */
-    private static final boolean DEFAULT_USER_REQUIRED = true;
+    private static final boolean DEFAULT_USER_REQUIRED = false;
 
     /**
      * The default value for the maximum number of connections to be


[28/28] incubator-guacamole-client git commit: GUACAMOLE-363: Merge support for SQL Server databases.

Posted by mj...@apache.org.
GUACAMOLE-363: Merge support for SQL Server databases.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/d808f7fb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/d808f7fb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/d808f7fb

Branch: refs/heads/master
Commit: d808f7fbbdef9a0e14b139ac31e9fa225354efc6
Parents: 81ffa5c 56bce8d
Author: Michael Jumper <mj...@apache.org>
Authored: Sat Sep 30 19:05:08 2017 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Sat Sep 30 19:05:08 2017 -0700

----------------------------------------------------------------------
 .../modules/guacamole-auth-jdbc-dist/pom.xml    |   7 +
 .../project-assembly.xml                        |  14 +
 .../guacamole-auth-jdbc-sqlserver/.gitignore    |   2 +
 .../guacamole-auth-jdbc-sqlserver/pom.xml       | 128 +++++
 .../schema/001-create-schema.sql                | 467 +++++++++++++++++++
 .../schema/002-create-admin-user.sql            |  49 ++
 .../SQLServerAuthenticationProvider.java        |  50 ++
 .../SQLServerAuthenticationProviderModule.java  | 121 +++++
 .../auth/sqlserver/SQLServerDriver.java         |  46 ++
 .../auth/sqlserver/SQLServerDriverProperty.java |  60 +++
 .../auth/sqlserver/SQLServerEnvironment.java    | 254 ++++++++++
 .../sqlserver/SQLServerGuacamoleProperties.java | 185 ++++++++
 .../sqlserver/SQLServerInjectorProvider.java    |  49 ++
 .../auth/sqlserver/SQLServerPasswordPolicy.java | 194 ++++++++
 .../SQLServerSharedAuthenticationProvider.java  |  50 ++
 .../guacamole/auth/sqlserver/package-info.java  |  23 +
 .../src/main/resources/guac-manifest.json       |  28 ++
 .../auth/jdbc/connection/ConnectionMapper.xml   | 235 ++++++++++
 .../connection/ConnectionParameterMapper.xml    |  68 +++
 .../jdbc/connection/ConnectionRecordMapper.xml  | 212 +++++++++
 .../connectiongroup/ConnectionGroupMapper.xml   | 232 +++++++++
 .../ConnectionGroupPermissionMapper.xml         | 128 +++++
 .../permission/ConnectionPermissionMapper.xml   | 128 +++++
 .../SharingProfilePermissionMapper.xml          | 128 +++++
 .../jdbc/permission/SystemPermissionMapper.xml  |  99 ++++
 .../jdbc/permission/UserPermissionMapper.xml    | 135 ++++++
 .../sharingprofile/SharingProfileMapper.xml     | 126 +++++
 .../SharingProfileParameterMapper.xml           |  68 +++
 .../auth/jdbc/user/PasswordRecordMapper.xml     |  79 ++++
 .../guacamole/auth/jdbc/user/UserMapper.xml     | 216 +++++++++
 extensions/guacamole-auth-jdbc/pom.xml          |   1 +
 31 files changed, 3582 insertions(+)
----------------------------------------------------------------------



[05/28] incubator-guacamole-client git commit: GUACAMOLE-363: Update so that any of the available TDS-compatible drivers can be used.

Posted by mj...@apache.org.
GUACAMOLE-363: Update so that any of the available TDS-compatible drivers can be used.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/b72dba6b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/b72dba6b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/b72dba6b

Branch: refs/heads/master
Commit: b72dba6b033a0da3c6bd8db248b848313dfe8fe9
Parents: d6d7c37
Author: Nick Couchman <vn...@apache.org>
Authored: Thu Sep 7 16:07:59 2017 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Thu Sep 28 07:00:52 2017 -0400

----------------------------------------------------------------------
 .../SQLServerAuthenticationProviderModule.java  | 15 +++++---
 .../auth/sqlserver/SQLServerEnvironment.java    | 39 ++++++++++++++++++--
 .../sqlserver/SQLServerGuacamoleProperties.java |  6 +--
 3 files changed, 49 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b72dba6b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java
index d936f14..22c5434 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java
@@ -44,8 +44,8 @@ public class SQLServerAuthenticationProviderModule implements Module {
     /**
      * Whether or not to use JTDS Driver
      */
-    private Boolean useJTDSDriver = false;
-    
+    private String sqlServerDriver;
+
     /**
      * Creates a new SQLServer authentication provider module that configures
      * driver and MyBatis properties using the given environment.
@@ -75,8 +75,8 @@ public class SQLServerAuthenticationProviderModule implements Module {
         // Use UTF-8 in database
         driverProperties.setProperty("characterEncoding", "UTF-8");
 
-        // Capture whether or not to use the JTDS driver.
-        this.useJTDSDriver = environment.getSQLServerJTDSDriver();
+        // Capture which driver to use for the connection.
+        this.sqlServerDriver = environment.getSQLServerDriver();
 
     }
 
@@ -84,8 +84,13 @@ public class SQLServerAuthenticationProviderModule implements Module {
     public void configure(Binder binder) {
 
         // Bind SQLServer-specific properties
-        if (this.useJTDSDriver)
+        // Look at the property to choose the correct driver.
+        if (sqlServerDriver.equals(SQLServerEnvironment.SQLSERVER_DRIVER_JTDS))
             JdbcHelper.SQL_Server_jTDS.configure(binder);
+        else if(sqlServerDriver.equals(SQLServerEnvironment.SQLSERVER_DRIVER_DATADIRECT))
+            JdbcHelper.SQL_Server_DataDirect.configure(binder);
+        else if(sqlServerDriver.equals(SQLServerEnvironment.SQLSERVER_DRIVER_MS))
+            JdbcHelper.SQL_Server_MS_Driver.configure(binder);
         else
             JdbcHelper.SQL_Server_2005_MS_Driver.configure(binder);
         

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b72dba6b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java
index 4d24dd3..2110b0c 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java
@@ -97,6 +97,30 @@ public class SQLServerEnvironment extends JDBCEnvironment {
     private int DEFAULT_MAX_GROUP_CONNECTIONS = 0;
 
     /**
+     * The value for the sqlserver-driver property that triggers the use of
+     * the open source JTDS driver.
+     */
+    public final static String SQLSERVER_DRIVER_JTDS = "jtds";
+
+    /**
+     * The value for the sqlserver-driver property that triggers the use of
+     * the DataDirect JDBC driver.
+     */
+    public final static String SQLSERVER_DRIVER_DATADIRECT = "datadirect";
+
+    /**
+     * The value for the sqlserver-driver property that triggers the use of
+     * the older Microsoft JDBC driver.
+     */
+    public final static String SQLSERVER_DRIVER_MS = "microsoft";
+
+    /**
+     * The value for the sqlserver-driver property that triggers the use of
+     * the Microsoft JDBC driver.  This is the default.
+     */
+    public final static String SQLSERVER_DRIVER_MS_2005 = "microsoft2005";
+
+    /**
      * Constructs a new SQLServerEnvironment, providing access to SQLServer-specific
      * configuration options.
      * 
@@ -169,6 +193,15 @@ public class SQLServerEnvironment extends JDBCEnvironment {
 
         }
 
+        // Check driver property is one of the acceptable values.
+        String driver = getProperty(SQLServerGuacamoleProperties.SQLSERVER_DRIVER);
+        if (!(driver.equals(SQLSERVER_DRIVER_JTDS) ||
+                                driver.equals(SQLSERVER_DRIVER_DATADIRECT) ||
+                                driver.equals(SQLSERVER_DRIVER_MS) ||
+                                driver.equals(SQLSERVER_DRIVER_MS_2005)))
+            logger.warn("{} property has been set to an invalid value.  The default Microsoft 2005 driver will be used.",
+                        SQLServerGuacamoleProperties.SQLSERVER_DRIVER.getName());
+
     }
 
     @Override
@@ -314,10 +347,10 @@ public class SQLServerEnvironment extends JDBCEnvironment {
      *     If an error occurs while retrieving the property value, or if the
      *     value was not set, as this property is required.
      */
-    public Boolean getSQLServerJTDSDriver() throws GuacamoleException {
+    public String getSQLServerDriver() throws GuacamoleException {
         return getProperty(
-            SQLServerGuacamoleProperties.SQLSERVER_JTDS_DRIVER,
-            false
+            SQLServerGuacamoleProperties.SQLSERVER_DRIVER,
+            SQLSERVER_DRIVER_MS_2005
         );
     }
     

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b72dba6b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerGuacamoleProperties.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerGuacamoleProperties.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerGuacamoleProperties.java
index d04d9a1..9d9b386 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerGuacamoleProperties.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerGuacamoleProperties.java
@@ -200,11 +200,11 @@ public class SQLServerGuacamoleProperties {
     /**
      * Whether or not to use the JTDS driver for SQL Server connections.
      */
-    public static final BooleanGuacamoleProperty
-            SQLSERVER_JTDS_DRIVER = new BooleanGuacamoleProperty() {
+    public static final StringGuacamoleProperty
+            SQLSERVER_DRIVER = new StringGuacamoleProperty() {
 
         @Override
-        public String getName() { return "sqlserver-use-jtds-driver"; }
+        public String getName() { return "sqlserver-driver"; }
 
     };
 


[20/28] incubator-guacamole-client git commit: GUACAMOLE-363: Add binding for permission list rules to data types.

Posted by mj...@apache.org.
GUACAMOLE-363: Add binding for permission list rules to data types.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/82d1b142
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/82d1b142
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/82d1b142

Branch: refs/heads/master
Commit: 82d1b142be887372069ff69397a858183711c61e
Parents: 74c055e
Author: Nick Couchman <vn...@apache.org>
Authored: Wed Sep 27 08:54:43 2017 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Thu Sep 28 07:00:52 2017 -0400

----------------------------------------------------------------------
 .../guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql     | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/82d1b142/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
index 1a1e324..6c3cd7b 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/schema/001-create-schema.sql
@@ -41,11 +41,13 @@ GO;
  * The permission data type.
  */
 CREATE TYPE [guacamole_permission] FROM [nvarchar](10) NOT NULL;
+EXEC sp_bindrule 'guacamole_permission_list','guacamole_permission';
 
 /**
  * The system permission data type.
  */
 CREATE TYPE [guacamole_system_permission] FROM [nvarchar](32) NOT NULL;
+EXEC sp_bindrule 'guacamole_system_permission_list','guacamole_system_permission';
 GO;
 
 /**


[23/28] incubator-guacamole-client git commit: GUACAMOLE-363: Allow use of alternate JTDS driver.

Posted by mj...@apache.org.
GUACAMOLE-363: Allow use of alternate JTDS driver.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/d6d7c376
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/d6d7c376
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/d6d7c376

Branch: refs/heads/master
Commit: d6d7c3768fb5945033627907c691c896c915bc51
Parents: 2eb4889
Author: Nick Couchman <vn...@apache.org>
Authored: Tue Aug 29 21:41:00 2017 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Thu Sep 28 07:00:52 2017 -0400

----------------------------------------------------------------------
 .../SQLServerAuthenticationProviderModule.java  | 13 ++++++++++++-
 .../auth/sqlserver/SQLServerEnvironment.java    | 20 +++++++++++++++++++-
 .../sqlserver/SQLServerGuacamoleProperties.java | 11 +++++++++++
 3 files changed, 42 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/d6d7c376/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java
index ebb1a06..d936f14 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java
@@ -40,6 +40,11 @@ public class SQLServerAuthenticationProviderModule implements Module {
      * SQLServer-specific driver configuration properties.
      */
     private final Properties driverProperties = new Properties();
+
+    /**
+     * Whether or not to use JTDS Driver
+     */
+    private Boolean useJTDSDriver = false;
     
     /**
      * Creates a new SQLServer authentication provider module that configures
@@ -70,13 +75,19 @@ public class SQLServerAuthenticationProviderModule implements Module {
         // Use UTF-8 in database
         driverProperties.setProperty("characterEncoding", "UTF-8");
 
+        // Capture whether or not to use the JTDS driver.
+        this.useJTDSDriver = environment.getSQLServerJTDSDriver();
+
     }
 
     @Override
     public void configure(Binder binder) {
 
         // Bind SQLServer-specific properties
-        JdbcHelper.SQL_Server_2005_MS_Driver.configure(binder);
+        if (this.useJTDSDriver)
+            JdbcHelper.SQL_Server_jTDS.configure(binder);
+        else
+            JdbcHelper.SQL_Server_2005_MS_Driver.configure(binder);
         
         // Bind MyBatis properties
         Names.bindProperties(binder, myBatisProperties);

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/d6d7c376/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java
index 67d8827..4d24dd3 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java
@@ -272,7 +272,7 @@ public class SQLServerEnvironment extends JDBCEnvironment {
     public String getSQLServerDatabase() throws GuacamoleException {
         return getRequiredProperty(SQLServerGuacamoleProperties.SQLSERVER_DATABASE);
     }
-    
+
     /**
      * Returns the username that should be used when authenticating with the
      * SQLServer database containing the Guacamole authentication tables.
@@ -302,5 +302,23 @@ public class SQLServerEnvironment extends JDBCEnvironment {
     public String getSQLServerPassword() throws GuacamoleException {
         return getRequiredProperty(SQLServerGuacamoleProperties.SQLSERVER_PASSWORD);
     }
+
+    /**
+     * Returns whether or not to use the SourceForge JTDS driver for more
+     * generic JTDS connections instead of the Microsoft-provided JDBC driver.
+     *
+     * @return
+     *     True if the JTDS driver should be used; false by default.
+     *
+     * @throws GuacamoleException
+     *     If an error occurs while retrieving the property value, or if the
+     *     value was not set, as this property is required.
+     */
+    public Boolean getSQLServerJTDSDriver() throws GuacamoleException {
+        return getProperty(
+            SQLServerGuacamoleProperties.SQLSERVER_JTDS_DRIVER,
+            false
+        );
+    }
     
 }

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/d6d7c376/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerGuacamoleProperties.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerGuacamoleProperties.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerGuacamoleProperties.java
index e45f502..d04d9a1 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerGuacamoleProperties.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerGuacamoleProperties.java
@@ -197,4 +197,15 @@ public class SQLServerGuacamoleProperties {
 
     };
 
+    /**
+     * Whether or not to use the JTDS driver for SQL Server connections.
+     */
+    public static final BooleanGuacamoleProperty
+            SQLSERVER_JTDS_DRIVER = new BooleanGuacamoleProperty() {
+
+        @Override
+        public String getName() { return "sqlserver-use-jtds-driver"; }
+
+    };
+
 }