mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
Ticket #263: Make sure that no group cycles can be created, and change it so you can move items to ROOT.
This commit is contained in:
@@ -295,16 +295,16 @@ public class ConnectionDirectory implements Directory<String, Connection>{
|
||||
throws GuacamoleException {
|
||||
|
||||
if(!(directory instanceof ConnectionDirectory))
|
||||
throw new GuacamoleException("Directory not from database");
|
||||
throw new GuacamoleClientException("Directory not from database");
|
||||
|
||||
int toConnectionGroupID = ((ConnectionDirectory)directory).parentID;
|
||||
Integer toConnectionGroupID = ((ConnectionDirectory)directory).parentID;
|
||||
|
||||
// Get connection
|
||||
MySQLConnection mySQLConnection =
|
||||
connectionService.retrieveConnection(identifier, user_id);
|
||||
|
||||
if(mySQLConnection == null)
|
||||
throw new GuacamoleException("Connection not found.");
|
||||
throw new GuacamoleClientException("Connection not found.");
|
||||
|
||||
// Verify permission to update the connection
|
||||
permissionCheckService.verifyConnectionAccess(this.user_id,
|
||||
|
@@ -244,19 +244,19 @@ public class ConnectionGroupDirectory implements Directory<String, ConnectionGro
|
||||
throws GuacamoleException {
|
||||
|
||||
if(MySQLConstants.CONNECTION_GROUP_ROOT_IDENTIFIER.equals(identifier))
|
||||
throw new GuacamoleException("The root connection group cannot be moved.");
|
||||
throw new GuacamoleClientException("The root connection group cannot be moved.");
|
||||
|
||||
if(!(directory instanceof ConnectionGroupDirectory))
|
||||
throw new GuacamoleException("Directory not from database");
|
||||
throw new GuacamoleClientException("Directory not from database");
|
||||
|
||||
int toConnectionGroupID = ((ConnectionGroupDirectory)directory).parentID;
|
||||
Integer toConnectionGroupID = ((ConnectionGroupDirectory)directory).parentID;
|
||||
|
||||
// Get connection group
|
||||
MySQLConnectionGroup mySQLConnectionGroup =
|
||||
connectionGroupService.retrieveConnectionGroup(identifier, user_id);
|
||||
|
||||
if(mySQLConnectionGroup == null)
|
||||
throw new GuacamoleException("Connection group not found.");
|
||||
throw new GuacamoleClientException("Connection group not found.");
|
||||
|
||||
// Verify permission to update the connection
|
||||
permissionCheckService.verifyConnectionAccess(this.user_id,
|
||||
@@ -290,7 +290,7 @@ public class ConnectionGroupDirectory implements Directory<String, ConnectionGro
|
||||
Integer relativeParentID = toConnectionGroupID;
|
||||
while(relativeParentID != null) {
|
||||
if(relativeParentID == mySQLConnectionGroup.getConnectionGroupID())
|
||||
throw new GuacamoleException("Connection group cycle detected.");
|
||||
throw new GuacamoleClientException("Connection group cycle detected.");
|
||||
|
||||
MySQLConnectionGroup relativeParentGroup = connectionGroupService.
|
||||
retrieveConnectionGroup(relativeParentID, user_id);
|
||||
|
@@ -390,8 +390,8 @@ public class ConnectionGroupService {
|
||||
break;
|
||||
}
|
||||
|
||||
// Update the connection in the database
|
||||
connectionGroupDAO.updateByPrimaryKeySelective(connectionGroup);
|
||||
// Update the connection group in the database
|
||||
connectionGroupDAO.updateByPrimaryKey(connectionGroup);
|
||||
|
||||
}
|
||||
|
||||
|
@@ -416,7 +416,7 @@ public class ConnectionService {
|
||||
connection.setProtocol(mySQLConnection.getConfiguration().getProtocol());
|
||||
|
||||
// Update the connection in the database
|
||||
connectionDAO.updateByPrimaryKeySelective(connection);
|
||||
connectionDAO.updateByPrimaryKey(connection);
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user