mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-27 23:23:07 +00:00 
			
		
		
		
	GUAC-830: Add concurrency limitations to schema and mapping.
This commit is contained in:
		| @@ -32,6 +32,10 @@ CREATE TABLE `guacamole_connection_group` ( | ||||
|   `type`                  enum('ORGANIZATIONAL', | ||||
|                                'BALANCING') NOT NULL DEFAULT 'ORGANIZATIONAL', | ||||
|  | ||||
|   -- Concurrency limits | ||||
|   `max_connections`          int(11), | ||||
|   `max_connections_per_user` int(11), | ||||
|  | ||||
|   PRIMARY KEY (`connection_group_id`), | ||||
|   UNIQUE KEY `connection_group_name_parent` (`connection_group_name`, `parent_id`), | ||||
|  | ||||
| @@ -54,6 +58,10 @@ CREATE TABLE `guacamole_connection` ( | ||||
|   `parent_id`           int(11), | ||||
|   `protocol`            varchar(32)  NOT NULL, | ||||
|    | ||||
|   -- Concurrency limits | ||||
|   `max_connections`          int(11), | ||||
|   `max_connections_per_user` int(11), | ||||
|  | ||||
|   PRIMARY KEY (`connection_id`), | ||||
|   UNIQUE KEY `connection_name_parent` (`connection_name`, `parent_id`), | ||||
|  | ||||
|   | ||||
| @@ -39,3 +39,17 @@ ALTER TABLE guacamole_user ADD COLUMN valid_until DATE; | ||||
| -- | ||||
|  | ||||
| ALTER TABLE guacamole_user ADD COLUMN timezone VARCHAR(64); | ||||
|  | ||||
| -- | ||||
| -- Add connection concurrency limits | ||||
| -- | ||||
|  | ||||
| ALTER TABLE guacamole_connection ADD COLUMN max_connections          INT(11); | ||||
| ALTER TABLE guacamole_connection ADD COLUMN max_connections_per_user INT(11); | ||||
|  | ||||
| -- | ||||
| -- Add connection group concurrency limits | ||||
| -- | ||||
|  | ||||
| ALTER TABLE guacamole_connection_group ADD COLUMN max_connections          INT(11); | ||||
| ALTER TABLE guacamole_connection_group ADD COLUMN max_connections_per_user INT(11); | ||||
|   | ||||
| @@ -28,10 +28,12 @@ | ||||
|  | ||||
|     <!-- Result mapper for connection objects --> | ||||
|     <resultMap id="ConnectionResultMap" type="org.glyptodon.guacamole.auth.jdbc.connection.ConnectionModel" > | ||||
|         <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"/> | ||||
|         <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"/> | ||||
|     </resultMap> | ||||
|  | ||||
|     <!-- Select all connection identifiers --> | ||||
| @@ -77,7 +79,9 @@ | ||||
|             connection_id, | ||||
|             connection_name, | ||||
|             parent_id, | ||||
|             protocol  | ||||
|             protocol, | ||||
|             max_connections, | ||||
|             max_connections_per_user | ||||
|         FROM guacamole_connection | ||||
|         WHERE connection_id IN | ||||
|             <foreach collection="identifiers" item="identifier" | ||||
| @@ -94,7 +98,9 @@ | ||||
|             guacamole_connection.connection_id, | ||||
|             connection_name, | ||||
|             parent_id, | ||||
|             protocol  | ||||
|             protocol, | ||||
|             max_connections, | ||||
|             max_connections_per_user | ||||
|         FROM guacamole_connection | ||||
|         JOIN guacamole_connection_permission ON guacamole_connection_permission.connection_id = guacamole_connection.connection_id | ||||
|         WHERE guacamole_connection.connection_id IN | ||||
| @@ -114,7 +120,9 @@ | ||||
|             connection_id, | ||||
|             connection_name, | ||||
|             parent_id, | ||||
|             protocol  | ||||
|             protocol, | ||||
|             max_connections, | ||||
|             max_connections_per_user | ||||
|         FROM guacamole_connection | ||||
|         WHERE  | ||||
|             <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=VARCHAR}</if> | ||||
| @@ -136,12 +144,16 @@ | ||||
|         INSERT INTO guacamole_connection ( | ||||
|             connection_name, | ||||
|             parent_id, | ||||
|             protocol  | ||||
|             protocol, | ||||
|             max_connections, | ||||
|             max_connections_per_user | ||||
|         ) | ||||
|         VALUES ( | ||||
|             #{object.name,jdbcType=VARCHAR}, | ||||
|             #{object.parentIdentifier,jdbcType=VARCHAR}, | ||||
|             #{object.protocol,jdbcType=VARCHAR} | ||||
|             #{object.protocol,jdbcType=VARCHAR}, | ||||
|             #{object.maxConnections,jdbcType=INTEGER}, | ||||
|             #{object.maxConnectionsPerUser,jdbcType=INTEGER} | ||||
|         ) | ||||
|  | ||||
|     </insert> | ||||
| @@ -149,9 +161,11 @@ | ||||
|     <!-- Update single connection --> | ||||
|     <update id="update" parameterType="org.glyptodon.guacamole.auth.jdbc.connection.ConnectionModel"> | ||||
|         UPDATE guacamole_connection | ||||
|         SET connection_name = #{object.name,jdbcType=VARCHAR}, | ||||
|             parent_id       = #{object.parentIdentifier,jdbcType=VARCHAR}, | ||||
|             protocol        = #{object.protocol,jdbcType=VARCHAR} | ||||
|         SET connection_name          = #{object.name,jdbcType=VARCHAR}, | ||||
|             parent_id                = #{object.parentIdentifier,jdbcType=VARCHAR}, | ||||
|             protocol                 = #{object.protocol,jdbcType=VARCHAR}, | ||||
|             max_connections          = #{object.maxConnections,jdbcType=INTEGER}, | ||||
|             max_connections_per_user = #{object.maxConnectionsPerUser,jdbcType=INTEGER} | ||||
|         WHERE connection_id = #{object.objectID,jdbcType=INTEGER} | ||||
|     </update> | ||||
|  | ||||
|   | ||||
| @@ -28,11 +28,13 @@ | ||||
|  | ||||
|     <!-- Result mapper for connection objects --> | ||||
|     <resultMap id="ConnectionGroupResultMap" type="org.glyptodon.guacamole.auth.jdbc.connectiongroup.ConnectionGroupModel" > | ||||
|         <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" | ||||
|         <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.glyptodon.guacamole.net.auth.ConnectionGroup$Type"/> | ||||
|         <result column="max_connections"          property="maxConnections"        jdbcType="INTEGER"/> | ||||
|         <result column="max_connections_per_user" property="maxConnectionsPerUser" jdbcType="INTEGER"/> | ||||
|     </resultMap> | ||||
|  | ||||
|     <!-- Select all connection group identifiers --> | ||||
| @@ -78,7 +80,9 @@ | ||||
|             connection_group_id, | ||||
|             connection_group_name, | ||||
|             parent_id, | ||||
|             type | ||||
|             type, | ||||
|             max_connections, | ||||
|             max_connections_per_user | ||||
|         FROM guacamole_connection_group | ||||
|         WHERE connection_group_id IN | ||||
|             <foreach collection="identifiers" item="identifier" | ||||
| @@ -95,7 +99,9 @@ | ||||
|             guacamole_connection_group.connection_group_id, | ||||
|             connection_group_name, | ||||
|             parent_id, | ||||
|             type  | ||||
|             type, | ||||
|             max_connections, | ||||
|             max_connections_per_user | ||||
|         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 | ||||
| @@ -115,7 +121,9 @@ | ||||
|             connection_group_id, | ||||
|             connection_group_name, | ||||
|             parent_id, | ||||
|             type | ||||
|             type, | ||||
|             max_connections, | ||||
|             max_connections_per_user | ||||
|         FROM guacamole_connection_group | ||||
|         WHERE  | ||||
|             <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=VARCHAR}</if> | ||||
| @@ -137,12 +145,16 @@ | ||||
|         INSERT INTO guacamole_connection_group ( | ||||
|             connection_group_name, | ||||
|             parent_id, | ||||
|             type | ||||
|             type, | ||||
|             max_connections, | ||||
|             max_connections_per_user | ||||
|         ) | ||||
|         VALUES ( | ||||
|             #{object.name,jdbcType=VARCHAR}, | ||||
|             #{object.parentIdentifier,jdbcType=VARCHAR}, | ||||
|             #{object.type,jdbcType=VARCHAR} | ||||
|             #{object.type,jdbcType=VARCHAR}, | ||||
|             #{object.maxConnections,jdbcType=INTEGER}, | ||||
|             #{object.maxConnectionsPerUser,jdbcType=INTEGER} | ||||
|         ) | ||||
|  | ||||
|     </insert> | ||||
| @@ -150,9 +162,11 @@ | ||||
|     <!-- Update single connection group --> | ||||
|     <update id="update" parameterType="org.glyptodon.guacamole.auth.jdbc.connectiongroup.ConnectionGroupModel"> | ||||
|         UPDATE guacamole_connection_group | ||||
|         SET connection_group_name = #{object.name,jdbcType=VARCHAR}, | ||||
|             parent_id             = #{object.parentIdentifier,jdbcType=VARCHAR}, | ||||
|             type                  = #{object.type,jdbcType=VARCHAR} | ||||
|         SET connection_group_name    = #{object.name,jdbcType=VARCHAR}, | ||||
|             parent_id                = #{object.parentIdentifier,jdbcType=VARCHAR}, | ||||
|             type                     = #{object.type,jdbcType=VARCHAR}, | ||||
|             max_connections          = #{object.maxConnections,jdbcType=INTEGER}, | ||||
|             max_connections_per_user = #{object.maxConnectionsPerUser,jdbcType=INTEGER} | ||||
|         WHERE connection_group_id = #{object.objectID,jdbcType=INTEGER} | ||||
|     </update> | ||||
|  | ||||
|   | ||||
| @@ -63,6 +63,10 @@ CREATE TABLE guacamole_connection_group ( | ||||
|   type                  guacamole_connection_group_type | ||||
|                         NOT NULL DEFAULT 'ORGANIZATIONAL', | ||||
|  | ||||
|   -- Concurrency limits | ||||
|   max_connections          integer, | ||||
|   max_connections_per_user integer, | ||||
|  | ||||
|   PRIMARY KEY (connection_group_id), | ||||
|  | ||||
|   CONSTRAINT connection_group_name_parent | ||||
| @@ -90,6 +94,10 @@ CREATE TABLE guacamole_connection ( | ||||
|   parent_id           integer, | ||||
|   protocol            varchar(32)  NOT NULL, | ||||
|    | ||||
|   -- Concurrency limits | ||||
|   max_connections          integer, | ||||
|   max_connections_per_user integer, | ||||
|  | ||||
|   PRIMARY KEY (connection_id), | ||||
|  | ||||
|   CONSTRAINT connection_name_parent | ||||
|   | ||||
| @@ -39,3 +39,17 @@ ALTER TABLE guacamole_user ADD COLUMN valid_until date; | ||||
| -- | ||||
|  | ||||
| ALTER TABLE guacamole_user ADD COLUMN timezone varchar(64); | ||||
|  | ||||
| -- | ||||
| -- Add connection concurrency limits | ||||
| -- | ||||
|  | ||||
| ALTER TABLE guacamole_connection ADD COLUMN max_connections          integer; | ||||
| ALTER TABLE guacamole_connection ADD COLUMN max_connections_per_user integer; | ||||
|  | ||||
| -- | ||||
| -- Add connection group concurrency limits | ||||
| -- | ||||
|  | ||||
| ALTER TABLE guacamole_connection_group ADD COLUMN max_connections          integer; | ||||
| ALTER TABLE guacamole_connection_group ADD COLUMN max_connections_per_user integer; | ||||
|   | ||||
| @@ -28,10 +28,12 @@ | ||||
|  | ||||
|     <!-- Result mapper for connection objects --> | ||||
|     <resultMap id="ConnectionResultMap" type="org.glyptodon.guacamole.auth.jdbc.connection.ConnectionModel" > | ||||
|         <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"/> | ||||
|         <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"/> | ||||
|     </resultMap> | ||||
|  | ||||
|     <!-- Select all connection identifiers --> | ||||
| @@ -77,7 +79,9 @@ | ||||
|             connection_id, | ||||
|             connection_name, | ||||
|             parent_id, | ||||
|             protocol  | ||||
|             protocol, | ||||
|             max_connections, | ||||
|             max_connections_per_user | ||||
|         FROM guacamole_connection | ||||
|         WHERE connection_id IN | ||||
|             <foreach collection="identifiers" item="identifier" | ||||
| @@ -94,7 +98,9 @@ | ||||
|             guacamole_connection.connection_id, | ||||
|             connection_name, | ||||
|             parent_id, | ||||
|             protocol  | ||||
|             protocol, | ||||
|             max_connections, | ||||
|             max_connections_per_user | ||||
|         FROM guacamole_connection | ||||
|         JOIN guacamole_connection_permission ON guacamole_connection_permission.connection_id = guacamole_connection.connection_id | ||||
|         WHERE guacamole_connection.connection_id IN | ||||
| @@ -114,7 +120,9 @@ | ||||
|             connection_id, | ||||
|             connection_name, | ||||
|             parent_id, | ||||
|             protocol  | ||||
|             protocol, | ||||
|             max_connections, | ||||
|             max_connections_per_user | ||||
|         FROM guacamole_connection | ||||
|         WHERE  | ||||
|             <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}::integer</if> | ||||
| @@ -136,12 +144,16 @@ | ||||
|         INSERT INTO guacamole_connection ( | ||||
|             connection_name, | ||||
|             parent_id, | ||||
|             protocol  | ||||
|             protocol, | ||||
|             max_connections, | ||||
|             max_connections_per_user | ||||
|         ) | ||||
|         VALUES ( | ||||
|             #{object.name,jdbcType=VARCHAR}, | ||||
|             #{object.parentIdentifier,jdbcType=INTEGER}::integer, | ||||
|             #{object.protocol,jdbcType=VARCHAR} | ||||
|             #{object.protocol,jdbcType=VARCHAR}, | ||||
|             #{object.maxConnections,jdbcType=INTEGER}, | ||||
|             #{object.maxConnectionsPerUser,jdbcType=INTEGER} | ||||
|         ) | ||||
|  | ||||
|     </insert> | ||||
| @@ -149,9 +161,11 @@ | ||||
|     <!-- Update single connection --> | ||||
|     <update id="update" parameterType="org.glyptodon.guacamole.auth.jdbc.connection.ConnectionModel"> | ||||
|         UPDATE guacamole_connection | ||||
|         SET connection_name = #{object.name,jdbcType=VARCHAR}, | ||||
|             parent_id       = #{object.parentIdentifier,jdbcType=INTEGER}::integer, | ||||
|             protocol        = #{object.protocol,jdbcType=VARCHAR} | ||||
|         SET connection_name          = #{object.name,jdbcType=VARCHAR}, | ||||
|             parent_id                = #{object.parentIdentifier,jdbcType=INTEGER}::integer, | ||||
|             protocol                 = #{object.protocol,jdbcType=VARCHAR}, | ||||
|             max_connections          = #{object.maxConnections,jdbcType=INTEGER}, | ||||
|             max_connections_per_user = #{object.maxConnectionsPerUser,jdbcType=INTEGER} | ||||
|         WHERE connection_id = #{object.objectID,jdbcType=INTEGER}::integer | ||||
|     </update> | ||||
|  | ||||
|   | ||||
| @@ -28,11 +28,13 @@ | ||||
|  | ||||
|     <!-- Result mapper for connection objects --> | ||||
|     <resultMap id="ConnectionGroupResultMap" type="org.glyptodon.guacamole.auth.jdbc.connectiongroup.ConnectionGroupModel" > | ||||
|         <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" | ||||
|         <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.glyptodon.guacamole.net.auth.ConnectionGroup$Type"/> | ||||
|         <result column="max_connections"          property="maxConnections"        jdbcType="INTEGER"/> | ||||
|         <result column="max_connections_per_user" property="maxConnectionsPerUser" jdbcType="INTEGER"/> | ||||
|     </resultMap> | ||||
|  | ||||
|     <!-- Select all connection group identifiers --> | ||||
| @@ -78,7 +80,9 @@ | ||||
|             connection_group_id, | ||||
|             connection_group_name, | ||||
|             parent_id, | ||||
|             type | ||||
|             type, | ||||
|             max_connections, | ||||
|             max_connections_per_user | ||||
|         FROM guacamole_connection_group | ||||
|         WHERE connection_group_id IN | ||||
|             <foreach collection="identifiers" item="identifier" | ||||
| @@ -95,7 +99,9 @@ | ||||
|             guacamole_connection_group.connection_group_id, | ||||
|             connection_group_name, | ||||
|             parent_id, | ||||
|             type  | ||||
|             type, | ||||
|             max_connections, | ||||
|             max_connections_per_user | ||||
|         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 | ||||
| @@ -115,7 +121,9 @@ | ||||
|             connection_group_id, | ||||
|             connection_group_name, | ||||
|             parent_id, | ||||
|             type | ||||
|             type, | ||||
|             max_connections, | ||||
|             max_connections_per_user | ||||
|         FROM guacamole_connection_group | ||||
|         WHERE  | ||||
|             <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}::integer</if> | ||||
| @@ -137,12 +145,16 @@ | ||||
|         INSERT INTO guacamole_connection_group ( | ||||
|             connection_group_name, | ||||
|             parent_id, | ||||
|             type | ||||
|             type, | ||||
|             max_connections, | ||||
|             max_connections_per_user | ||||
|         ) | ||||
|         VALUES ( | ||||
|             #{object.name,jdbcType=VARCHAR}, | ||||
|             #{object.parentIdentifier,jdbcType=INTEGER}::integer, | ||||
|             #{object.type,jdbcType=VARCHAR}::guacamole_connection_group_type | ||||
|             #{object.type,jdbcType=VARCHAR}::guacamole_connection_group_type, | ||||
|             #{object.maxConnections,jdbcType=INTEGER}, | ||||
|             #{object.maxConnectionsPerUser,jdbcType=INTEGER} | ||||
|         ) | ||||
|  | ||||
|     </insert> | ||||
| @@ -150,9 +162,11 @@ | ||||
|     <!-- Update single connection group --> | ||||
|     <update id="update" parameterType="org.glyptodon.guacamole.auth.jdbc.connectiongroup.ConnectionGroupModel"> | ||||
|         UPDATE guacamole_connection_group | ||||
|         SET connection_group_name = #{object.name,jdbcType=VARCHAR}, | ||||
|             parent_id             = #{object.parentIdentifier,jdbcType=INTEGER}::integer, | ||||
|             type                  = #{object.type,jdbcType=VARCHAR}::guacamole_connection_group_type | ||||
|         SET connection_group_name    = #{object.name,jdbcType=VARCHAR}, | ||||
|             parent_id                = #{object.parentIdentifier,jdbcType=INTEGER}::integer, | ||||
|             type                     = #{object.type,jdbcType=VARCHAR}::guacamole_connection_group_type, | ||||
|             max_connections          = #{object.maxConnections,jdbcType=INTEGER}, | ||||
|             max_connections_per_user = #{object.maxConnectionsPerUser,jdbcType=INTEGER} | ||||
|         WHERE connection_group_id = #{object.objectID,jdbcType=INTEGER}::integer | ||||
|     </update> | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user