From 2aa8054065a91825f6d95a385ce565c4c482103b Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Thu, 1 Feb 2018 22:53:17 -0800 Subject: [PATCH] GUACAMOLE-494: Remove support for "mysql-disallow-*" and "postgresql-disallow-*" properties, deprecated since 0.9.8 (9b27a27). --- .../auth/mysql/MySQLEnvironment.java | 90 ++----------------- .../auth/mysql/MySQLGuacamoleProperties.java | 22 ----- .../postgresql/PostgreSQLEnvironment.java | 68 +------------- .../PostgreSQLGuacamoleProperties.java | 26 ------ 4 files changed, 12 insertions(+), 194 deletions(-) diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/java/org/apache/guacamole/auth/mysql/MySQLEnvironment.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/java/org/apache/guacamole/auth/mysql/MySQLEnvironment.java index 19a8ef448..dc676db89 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/java/org/apache/guacamole/auth/mysql/MySQLEnvironment.java +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/java/org/apache/guacamole/auth/mysql/MySQLEnvironment.java @@ -60,41 +60,27 @@ public class MySQLEnvironment extends JDBCEnvironment { /** * 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 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 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 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 final int DEFAULT_MAX_GROUP_CONNECTIONS = 0; /** * Constructs a new MySQLEnvironment, providing access to MySQL-specific @@ -109,66 +95,6 @@ public class MySQLEnvironment extends JDBCEnvironment { // Init underlying JDBC environment super(); - // Read legacy concurrency-related property - Boolean disallowSimultaneous = getProperty(MySQLGuacamoleProperties.MYSQL_DISALLOW_SIMULTANEOUS_CONNECTIONS); - Boolean disallowDuplicate = getProperty(MySQLGuacamoleProperties.MYSQL_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.", - MySQLGuacamoleProperties.MYSQL_DISALLOW_SIMULTANEOUS_CONNECTIONS.getName(), - MySQLGuacamoleProperties.MYSQL_DEFAULT_MAX_CONNECTIONS.getName(), - MySQLGuacamoleProperties.MYSQL_DEFAULT_MAX_GROUP_CONNECTIONS.getName()); - - // Inform of new equivalent - logger.info("To achieve the same result of setting \"{}\" to \"{}\", set \"{}\" to \"{}\" and \"{}\" to \"{}\".", - MySQLGuacamoleProperties.MYSQL_DISALLOW_SIMULTANEOUS_CONNECTIONS.getName(), disallowSimultaneous, - MySQLGuacamoleProperties.MYSQL_DEFAULT_MAX_CONNECTIONS.getName(), DEFAULT_MAX_CONNECTIONS, - MySQLGuacamoleProperties.MYSQL_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.", - MySQLGuacamoleProperties.MYSQL_DISALLOW_DUPLICATE_CONNECTIONS.getName(), - MySQLGuacamoleProperties.MYSQL_DEFAULT_MAX_CONNECTIONS_PER_USER.getName(), - MySQLGuacamoleProperties.MYSQL_DEFAULT_MAX_GROUP_CONNECTIONS.getName()); - - // Inform of new equivalent - logger.info("To achieve the same result of setting \"{}\" to \"{}\", set \"{}\" to \"{}\" and \"{}\" to \"{}\".", - MySQLGuacamoleProperties.MYSQL_DISALLOW_DUPLICATE_CONNECTIONS.getName(), disallowDuplicate, - MySQLGuacamoleProperties.MYSQL_DEFAULT_MAX_CONNECTIONS_PER_USER.getName(), DEFAULT_MAX_CONNECTIONS_PER_USER, - MySQLGuacamoleProperties.MYSQL_DEFAULT_MAX_GROUP_CONNECTIONS_PER_USER.getName(), DEFAULT_MAX_GROUP_CONNECTIONS_PER_USER); - - } - } @Override diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/java/org/apache/guacamole/auth/mysql/MySQLGuacamoleProperties.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/java/org/apache/guacamole/auth/mysql/MySQLGuacamoleProperties.java index 9039c029b..145174036 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/java/org/apache/guacamole/auth/mysql/MySQLGuacamoleProperties.java +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/java/org/apache/guacamole/auth/mysql/MySQLGuacamoleProperties.java @@ -100,28 +100,6 @@ public class MySQLGuacamoleProperties { }; - /** - * Whether or not multiple users accessing the same connection at the same - * time should be disallowed. - */ - public static final BooleanGuacamoleProperty MYSQL_DISALLOW_SIMULTANEOUS_CONNECTIONS = new BooleanGuacamoleProperty() { - - @Override - public String getName() { return "mysql-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 MYSQL_DISALLOW_DUPLICATE_CONNECTIONS = new BooleanGuacamoleProperty() { - - @Override - public String getName() { return "mysql-disallow-duplicate-connections"; } - - }; - /** * The maximum number of concurrent connections to allow overall. Zero * denotes unlimited. diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/java/org/apache/guacamole/auth/postgresql/PostgreSQLEnvironment.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/java/org/apache/guacamole/auth/postgresql/PostgreSQLEnvironment.java index e0ee75ff1..da0caead2 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/java/org/apache/guacamole/auth/postgresql/PostgreSQLEnvironment.java +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/java/org/apache/guacamole/auth/postgresql/PostgreSQLEnvironment.java @@ -66,7 +66,7 @@ public class PostgreSQLEnvironment extends JDBCEnvironment { * dictate the values that should be used in the absence of the correct * properties. */ - private int DEFAULT_MAX_CONNECTIONS_PER_USER = 1; + private final int DEFAULT_MAX_CONNECTIONS_PER_USER = 1; /** * The default value for the default maximum number of connections to be @@ -76,7 +76,7 @@ public class PostgreSQLEnvironment extends JDBCEnvironment { * dictate the values that should be used in the absence of the correct * properties. */ - private int DEFAULT_MAX_GROUP_CONNECTIONS_PER_USER = 1; + private final int DEFAULT_MAX_GROUP_CONNECTIONS_PER_USER = 1; /** * The default value for the default maximum number of connections to be @@ -85,7 +85,7 @@ public class PostgreSQLEnvironment extends JDBCEnvironment { * 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; + private final int DEFAULT_MAX_CONNECTIONS = 0; /** * The default value for the default maximum number of connections to be @@ -94,7 +94,7 @@ public class PostgreSQLEnvironment extends JDBCEnvironment { * 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; + private final int DEFAULT_MAX_GROUP_CONNECTIONS = 0; /** * Constructs a new PostgreSQLEnvironment, providing access to PostgreSQL-specific @@ -109,66 +109,6 @@ public class PostgreSQLEnvironment extends JDBCEnvironment { // Init underlying JDBC environment super(); - // Read legacy concurrency-related property - Boolean disallowSimultaneous = getProperty(PostgreSQLGuacamoleProperties.POSTGRESQL_DISALLOW_SIMULTANEOUS_CONNECTIONS); - Boolean disallowDuplicate = getProperty(PostgreSQLGuacamoleProperties.POSTGRESQL_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.", - PostgreSQLGuacamoleProperties.POSTGRESQL_DISALLOW_SIMULTANEOUS_CONNECTIONS.getName(), - PostgreSQLGuacamoleProperties.POSTGRESQL_DEFAULT_MAX_CONNECTIONS.getName(), - PostgreSQLGuacamoleProperties.POSTGRESQL_DEFAULT_MAX_GROUP_CONNECTIONS.getName()); - - // Inform of new equivalent - logger.info("To achieve the same result of setting \"{}\" to \"{}\", set \"{}\" to \"{}\" and \"{}\" to \"{}\".", - PostgreSQLGuacamoleProperties.POSTGRESQL_DISALLOW_SIMULTANEOUS_CONNECTIONS.getName(), disallowSimultaneous, - PostgreSQLGuacamoleProperties.POSTGRESQL_DEFAULT_MAX_CONNECTIONS.getName(), DEFAULT_MAX_CONNECTIONS, - PostgreSQLGuacamoleProperties.POSTGRESQL_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.", - PostgreSQLGuacamoleProperties.POSTGRESQL_DISALLOW_DUPLICATE_CONNECTIONS.getName(), - PostgreSQLGuacamoleProperties.POSTGRESQL_DEFAULT_MAX_CONNECTIONS_PER_USER.getName(), - PostgreSQLGuacamoleProperties.POSTGRESQL_DEFAULT_MAX_GROUP_CONNECTIONS.getName()); - - // Inform of new equivalent - logger.info("To achieve the same result of setting \"{}\" to \"{}\", set \"{}\" to \"{}\" and \"{}\" to \"{}\".", - PostgreSQLGuacamoleProperties.POSTGRESQL_DISALLOW_DUPLICATE_CONNECTIONS.getName(), disallowDuplicate, - PostgreSQLGuacamoleProperties.POSTGRESQL_DEFAULT_MAX_CONNECTIONS_PER_USER.getName(), DEFAULT_MAX_CONNECTIONS_PER_USER, - PostgreSQLGuacamoleProperties.POSTGRESQL_DEFAULT_MAX_GROUP_CONNECTIONS_PER_USER.getName(), DEFAULT_MAX_GROUP_CONNECTIONS_PER_USER); - - } - } @Override diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/java/org/apache/guacamole/auth/postgresql/PostgreSQLGuacamoleProperties.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/java/org/apache/guacamole/auth/postgresql/PostgreSQLGuacamoleProperties.java index 3da972fe7..971165141 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/java/org/apache/guacamole/auth/postgresql/PostgreSQLGuacamoleProperties.java +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/java/org/apache/guacamole/auth/postgresql/PostgreSQLGuacamoleProperties.java @@ -105,32 +105,6 @@ public class PostgreSQLGuacamoleProperties { }; - /** - * Whether or not multiple users accessing the same connection at the same - * time should be disallowed. - */ - public static final BooleanGuacamoleProperty - POSTGRESQL_DISALLOW_SIMULTANEOUS_CONNECTIONS = - new BooleanGuacamoleProperty() { - - @Override - public String getName() { return "postgresql-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 - POSTGRESQL_DISALLOW_DUPLICATE_CONNECTIONS = - new BooleanGuacamoleProperty() { - - @Override - public String getName() { return "postgresql-disallow-duplicate-connections"; } - - }; - /** * The maximum number of concurrent connections to allow overall. Zero * denotes unlimited.