mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
Ticket #362: The cleaning never ends.
This commit is contained in:
@@ -102,15 +102,8 @@ public class ConnectionRESTService {
|
||||
Directory<String, Connection> connectionDirectory =
|
||||
parentConnectionGroup.getConnectionDirectory();
|
||||
|
||||
// Get the list of connection names
|
||||
List<Connection> connections = new ArrayList<Connection>();
|
||||
Iterable<String> identifiers = connectionDirectory.getIdentifiers();
|
||||
|
||||
// Get the connection for each name
|
||||
for(String identifier : identifiers)
|
||||
connections.add(connectionDirectory.get(identifier));
|
||||
|
||||
return connectionService.convertConnectionList(connections);
|
||||
// Return the converted connection directory
|
||||
return connectionService.convertConnectionList(connectionDirectory);
|
||||
} catch(GuacamoleSecurityException e) {
|
||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
} catch(GuacamoleClientException e) {
|
||||
|
@@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.glyptodon.guacamole.GuacamoleException;
|
||||
import org.glyptodon.guacamole.net.auth.Connection;
|
||||
import org.glyptodon.guacamole.net.auth.Directory;
|
||||
|
||||
/*
|
||||
* Guacamole - Clientless Remote Desktop
|
||||
@@ -37,14 +38,14 @@ public class ConnectionService {
|
||||
* @param connections The Connection to convert for REST endpoint use.
|
||||
* @return A List of APIConnection objects for use with the REST endpoint.
|
||||
* @throws GuacamoleException If an error occurs while converting the
|
||||
* connections.
|
||||
* connection directory.
|
||||
*/
|
||||
public List<APIConnection> convertConnectionList(Iterable<? extends Connection> connections)
|
||||
public List<APIConnection> convertConnectionList(Directory<String, Connection> connectionDirectory)
|
||||
throws GuacamoleException {
|
||||
List<APIConnection> restConnections = new ArrayList<APIConnection>();
|
||||
|
||||
for(Connection connection : connections) {
|
||||
restConnections.add(new APIConnection(connection));
|
||||
for(String connectionID : connectionDirectory.getIdentifiers()) {
|
||||
restConnections.add(new APIConnection(connectionDirectory.get(connectionID)));
|
||||
}
|
||||
|
||||
return restConnections;
|
||||
|
@@ -101,15 +101,8 @@ public class ConnectionGroupRESTService {
|
||||
Directory<String, ConnectionGroup> connectionGroupDirectory =
|
||||
parentConnectionGroup.getConnectionGroupDirectory();
|
||||
|
||||
// Get the list of connection group names
|
||||
List<ConnectionGroup> connectionGroups = new ArrayList<ConnectionGroup>();
|
||||
Iterable<String> identifiers = connectionGroupDirectory.getIdentifiers();
|
||||
|
||||
// Get the connection group for each name
|
||||
for(String identifier : identifiers)
|
||||
connectionGroups.add(connectionGroupDirectory.get(identifier));
|
||||
|
||||
return connectionGroupService.convertConnectionGroupList(connectionGroups);
|
||||
// return the converted connection group list
|
||||
return connectionGroupService.convertConnectionGroupList(connectionGroupDirectory);
|
||||
} catch(GuacamoleSecurityException e) {
|
||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
} catch(GuacamoleClientException e) {
|
||||
@@ -146,6 +139,7 @@ public class ConnectionGroupRESTService {
|
||||
if(connectionGroup == null)
|
||||
throw new HTTPException(Status.NOT_FOUND, "No ConnectionGroup found with the provided ID.");
|
||||
|
||||
// Return the connectiion group
|
||||
return new APIConnectionGroup(connectionGroup);
|
||||
} catch(GuacamoleSecurityException e) {
|
||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
@@ -311,7 +305,7 @@ public class ConnectionGroupRESTService {
|
||||
if(parentConnectionGroup == null)
|
||||
throw new HTTPException(Status.NOT_FOUND, "No ConnectionGroup found with the provided parentID.");
|
||||
|
||||
// Move the connection
|
||||
// Move the connection group
|
||||
connectionGroupDirectory.move(connectionGroupID, parentConnectionGroup.getConnectionGroupDirectory());
|
||||
} catch(GuacamoleSecurityException e) {
|
||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
|
@@ -2,7 +2,9 @@ package org.glyptodon.guacamole.net.basic.rest.connectiongroup;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.glyptodon.guacamole.GuacamoleException;
|
||||
import org.glyptodon.guacamole.net.auth.ConnectionGroup;
|
||||
import org.glyptodon.guacamole.net.auth.Directory;
|
||||
|
||||
/*
|
||||
* Guacamole - Clientless Remote Desktop
|
||||
@@ -35,13 +37,15 @@ public class ConnectionGroupService {
|
||||
*
|
||||
* @param connectionGroups The ConnectionGroup to convert for REST endpoint use.
|
||||
* @return A List of APIConnectionGroup objects for use with the REST endpoint.
|
||||
* @throws GuacamoleException If an error occurs while converting the
|
||||
* connection group directory.
|
||||
*/
|
||||
public List<APIConnectionGroup> convertConnectionGroupList(
|
||||
Iterable<? extends ConnectionGroup> connectionGroups) {
|
||||
Directory<String, ConnectionGroup> connectionGroupDirectory) throws GuacamoleException {
|
||||
List<APIConnectionGroup> restConnectionGroups = new ArrayList<APIConnectionGroup>();
|
||||
|
||||
for(ConnectionGroup connectionGroup : connectionGroups) {
|
||||
restConnectionGroups.add(new APIConnectionGroup(connectionGroup));
|
||||
for(String connectionGroupID : connectionGroupDirectory.getIdentifiers()) {
|
||||
restConnectionGroups.add(new APIConnectionGroup(connectionGroupDirectory.get(connectionGroupID)));
|
||||
}
|
||||
|
||||
return restConnectionGroups;
|
||||
|
@@ -4,7 +4,6 @@ import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.glyptodon.guacamole.GuacamoleException;
|
||||
import org.glyptodon.guacamole.net.auth.permission.Permission;
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user