mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-760: Add support for configuring server timezone.
This commit is contained in:
@@ -24,6 +24,7 @@ import com.google.inject.Module;
|
||||
import com.google.inject.name.Names;
|
||||
import java.io.File;
|
||||
import java.util.Properties;
|
||||
import java.util.TimeZone;
|
||||
import org.apache.guacamole.GuacamoleException;
|
||||
import org.apache.guacamole.auth.mysql.conf.MySQLDriver;
|
||||
import org.apache.guacamole.auth.mysql.conf.MySQLEnvironment;
|
||||
@@ -115,6 +116,11 @@ public class MySQLAuthenticationProviderModule implements Module {
|
||||
// Get the MySQL-compatible driver to use.
|
||||
mysqlDriver = environment.getMySQLDriver();
|
||||
|
||||
// If timezone is present, set it.
|
||||
TimeZone serverTz = environment.getServerTimeZone();
|
||||
if (serverTz != null)
|
||||
driverProperties.setProperty("serverTimezone", serverTz.getID());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -23,6 +23,7 @@ import java.io.File;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.util.TimeZone;
|
||||
import org.apache.guacamole.GuacamoleException;
|
||||
import org.apache.guacamole.auth.jdbc.JDBCEnvironment;
|
||||
import org.slf4j.Logger;
|
||||
@@ -393,4 +394,18 @@ public class MySQLEnvironment extends JDBCEnvironment {
|
||||
false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the server timezone if configured in guacamole.properties, or
|
||||
* null if the configuration option is not present.
|
||||
*
|
||||
* @return
|
||||
* The server timezone as configured in guacamole.properties.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* If an error occurs retrieving the configuration value.
|
||||
*/
|
||||
public TimeZone getServerTimeZone() throws GuacamoleException {
|
||||
return getProperty(MySQLGuacamoleProperties.SERVER_TIMEZONE);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@ import org.apache.guacamole.properties.EnumGuacamoleProperty;
|
||||
import org.apache.guacamole.properties.FileGuacamoleProperty;
|
||||
import org.apache.guacamole.properties.IntegerGuacamoleProperty;
|
||||
import org.apache.guacamole.properties.StringGuacamoleProperty;
|
||||
import org.apache.guacamole.properties.TimeZoneGuacamoleProperty;
|
||||
|
||||
/**
|
||||
* Properties used by the MySQL Authentication plugin.
|
||||
@@ -251,6 +252,16 @@ public class MySQLGuacamoleProperties {
|
||||
|
||||
@Override
|
||||
public String getName() { return "mysql-auto-create-accounts"; }
|
||||
};
|
||||
|
||||
/**
|
||||
* The time zone of the MySQL database server.
|
||||
*/
|
||||
public static final TimeZoneGuacamoleProperty SERVER_TIMEZONE =
|
||||
new TimeZoneGuacamoleProperty() {
|
||||
|
||||
@Override
|
||||
public String getName() { return "mysql-server-timezone"; }
|
||||
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user