mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +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();
|
||||
|
||||
// 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;
|
||||
|
||||
// Pull specified connection group otherwise
|
||||
@@ -340,12 +340,12 @@ public class ConnectionRESTService {
|
||||
Directory<String, Connection> connectionDirectory =
|
||||
rootGroup.getConnectionDirectory();
|
||||
|
||||
// Make sure the connection is there before trying to update
|
||||
// Retrieve connection to update
|
||||
Connection existingConnection = connectionDirectory.get(connectionID);
|
||||
if (existingConnection == null)
|
||||
throw new GuacamoleResourceNotFoundException("No such connection: \"" + connectionID + "\"");
|
||||
|
||||
// Retrieve connection configuration
|
||||
// Build updated configuration
|
||||
GuacamoleConfiguration config = new GuacamoleConfiguration();
|
||||
config.setProtocol(connection.getProtocol());
|
||||
config.setParameters(connection.getParameters());
|
||||
@@ -355,6 +355,10 @@ public class ConnectionRESTService {
|
||||
existingConnection.setName(connection.getName());
|
||||
connectionDirectory.update(existingConnection);
|
||||
|
||||
// Update connection parent
|
||||
ConnectionGroup updatedParentGroup = retrieveConnectionGroup(userContext, connection.getParentIdentifier());
|
||||
connectionDirectory.move(connectionID, updatedParentGroup.getConnectionDirectory());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user