diff --git a/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/ActiveConnectionSet.java b/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/ActiveConnectionSet.java index 38d651214..4e5ba4937 100644 --- a/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/ActiveConnectionSet.java +++ b/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/ActiveConnectionSet.java @@ -59,12 +59,12 @@ public class ActiveConnectionSet { */ @Inject private ConnectionHistoryMapper connectionHistoryDAO; - + /** * Set of all the connections that are currently active. */ private Set activeConnectionSet = new HashSet(); - + /** * Check if a connection is currently in use. * @param connectionID The connection to check the status of. @@ -73,7 +73,7 @@ public class ActiveConnectionSet { public boolean isActive(int connectionID) { return activeConnectionSet.contains(connectionID); } - + /** * Set a connection as open. * @param connectionID The ID of the connection that is being opened. @@ -81,20 +81,20 @@ public class ActiveConnectionSet { * @return The ID of the history record created for this open connection. */ public int openConnection(int connectionID, int userID) { - + // Create the connection history record ConnectionHistory connectionHistory = new ConnectionHistory(); connectionHistory.setConnection_id(connectionID); connectionHistory.setUser_id(userID); connectionHistory.setStart_date(new Date()); connectionHistoryDAO.insert(connectionHistory); - + // Mark the connection as active activeConnectionSet.add(connectionID); - + return connectionHistory.getHistory_id(); } - + /** * Set a connection as closed. * @param connectionID The ID of the connection that is being opened. @@ -103,18 +103,18 @@ public class ActiveConnectionSet { */ public void closeConnection(int connectionID, int historyID) throws GuacamoleException { - + // Get the existing history record - ConnectionHistory connectionHistory = + ConnectionHistory connectionHistory = connectionHistoryDAO.selectByPrimaryKey(historyID); - + if(connectionHistory == null) throw new GuacamoleException("History record not found."); - + // Update the connection history record to mark that it is now closed connectionHistory.setEnd_date(new Date()); connectionHistoryDAO.updateByPrimaryKey(connectionHistory); - + // Remove the connection from the set of active connections. activeConnectionSet.remove(connectionID); } diff --git a/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/MySQLConnection.java b/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/MySQLConnection.java index 3ce094ada..dc68cfcb4 100644 --- a/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/MySQLConnection.java +++ b/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/MySQLConnection.java @@ -59,7 +59,7 @@ public class MySQLConnection extends AbstractConnection { * The ID associated with this connection in the database. */ private Integer connectionID; - + /** * The ID of the user who queried or created this connection. */ @@ -116,7 +116,7 @@ public class MySQLConnection extends AbstractConnection { setConfiguration(config); this.history.addAll(history); this.userID = userID; - + } @Override diff --git a/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/MySQLConnectionRecord.java b/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/MySQLConnectionRecord.java index 77ee93af7..3ab0bc325 100644 --- a/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/MySQLConnectionRecord.java +++ b/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/MySQLConnectionRecord.java @@ -51,12 +51,12 @@ public class MySQLConnectionRecord implements ConnectionRecord { * The start date of the ConnectionRecord. */ private Date startDate; - + /** * The end date of the ConnectionRecord. */ private Date endDate; - + /** * The name of the user that is associated with this ConnectionRecord. */ diff --git a/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/MySQLGuacamoleSocket.java b/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/MySQLGuacamoleSocket.java index 084537d2b..8b2b6aade 100644 --- a/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/MySQLGuacamoleSocket.java +++ b/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/MySQLGuacamoleSocket.java @@ -65,7 +65,7 @@ public class MySQLGuacamoleSocket implements GuacamoleSocket { * socket. */ private int connectionID; - + /** * The ID of the history record associated with this instance of the * connection. diff --git a/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/service/ConnectionService.java b/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/service/ConnectionService.java index cae971d71..c28dcdf31 100644 --- a/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/service/ConnectionService.java +++ b/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/service/ConnectionService.java @@ -114,7 +114,7 @@ public class ConnectionService { */ @Inject private ActiveConnectionSet activeConnectionSet; - + /** * Service managing users. */ @@ -282,7 +282,7 @@ public class ConnectionService { * connection. */ public List retrieveHistory(int connectionID) { - + // Retrieve history records relating to given connection ID ConnectionHistoryExample example = new ConnectionHistoryExample(); example.createCriteria().andConnection_idEqualTo(connectionID); @@ -299,10 +299,10 @@ public class ConnectionService { for(ConnectionHistory history : connectionHistories) { userIDSet.add(history.getUser_id()); } - + // Get all the usernames for the users who are in the history Map usernameMap = userService.retrieveUsernames(userIDSet); - + // Create the new ConnectionRecords for(ConnectionHistory history : connectionHistories) { Date startDate = history.getStart_date(); @@ -349,7 +349,7 @@ public class ConnectionService { // Mark this connection as active int historyID = activeConnectionSet.openConnection(connection.getConnectionID(), userID); - + // Return new MySQLGuacamoleSocket MySQLGuacamoleSocket mySQLGuacamoleSocket = mySQLGuacamoleSocketProvider.get(); mySQLGuacamoleSocket.init(socket, connection.getConnectionID(), historyID); diff --git a/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/service/PermissionCheckService.java b/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/service/PermissionCheckService.java index f6669bf33..a0d9b8dde 100644 --- a/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/service/PermissionCheckService.java +++ b/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/service/PermissionCheckService.java @@ -360,7 +360,7 @@ public class PermissionCheckService { // Set of all permissions Set permissions = new HashSet(); - + // And finally, system permissions SystemPermissionExample systemPermissionExample = new SystemPermissionExample(); systemPermissionExample.createCriteria().andUser_idEqualTo(userID);