mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 13:41:21 +00:00
GUAC-932: Update connection location upon save.
This commit is contained in:
@@ -250,7 +250,7 @@ public class ConnectionRESTService {
|
|||||||
ConnectionGroup rootGroup = userContext.getRootConnectionGroup();
|
ConnectionGroup rootGroup = userContext.getRootConnectionGroup();
|
||||||
|
|
||||||
// Use root group if identifier is null (or the standard root identifier)
|
// Use root group if identifier is null (or the standard root identifier)
|
||||||
if (identifier == null || identifier.equals(APIConnectionGroup.ROOT_IDENTIFIER))
|
if (identifier != null && identifier.equals(APIConnectionGroup.ROOT_IDENTIFIER))
|
||||||
return rootGroup;
|
return rootGroup;
|
||||||
|
|
||||||
// Pull specified connection group otherwise
|
// Pull specified connection group otherwise
|
||||||
@@ -340,12 +340,12 @@ public class ConnectionRESTService {
|
|||||||
Directory<String, Connection> connectionDirectory =
|
Directory<String, Connection> connectionDirectory =
|
||||||
rootGroup.getConnectionDirectory();
|
rootGroup.getConnectionDirectory();
|
||||||
|
|
||||||
// Make sure the connection is there before trying to update
|
// Retrieve connection to update
|
||||||
Connection existingConnection = connectionDirectory.get(connectionID);
|
Connection existingConnection = connectionDirectory.get(connectionID);
|
||||||
if (existingConnection == null)
|
if (existingConnection == null)
|
||||||
throw new GuacamoleResourceNotFoundException("No such connection: \"" + connectionID + "\"");
|
throw new GuacamoleResourceNotFoundException("No such connection: \"" + connectionID + "\"");
|
||||||
|
|
||||||
// Retrieve connection configuration
|
// Build updated configuration
|
||||||
GuacamoleConfiguration config = new GuacamoleConfiguration();
|
GuacamoleConfiguration config = new GuacamoleConfiguration();
|
||||||
config.setProtocol(connection.getProtocol());
|
config.setProtocol(connection.getProtocol());
|
||||||
config.setParameters(connection.getParameters());
|
config.setParameters(connection.getParameters());
|
||||||
@@ -355,6 +355,10 @@ public class ConnectionRESTService {
|
|||||||
existingConnection.setName(connection.getName());
|
existingConnection.setName(connection.getName());
|
||||||
connectionDirectory.update(existingConnection);
|
connectionDirectory.update(existingConnection);
|
||||||
|
|
||||||
|
// Update connection parent
|
||||||
|
ConnectionGroup updatedParentGroup = retrieveConnectionGroup(userContext, connection.getParentIdentifier());
|
||||||
|
connectionDirectory.move(connectionID, updatedParentGroup.getConnectionDirectory());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user