mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-08 06:01:22 +00:00
Ticket #362: Cleaned up a bit more.
This commit is contained in:
@@ -97,7 +97,7 @@ public class ConnectionRESTService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(parentConnectionGroup == null)
|
if(parentConnectionGroup == null)
|
||||||
throw new GuacamoleClientException("No ConnectionGroup found with the provided parentID.");
|
throw new HTTPException(Status.NOT_FOUND, "No Connection found with the provided parentID.");
|
||||||
|
|
||||||
Directory<String, Connection> connectionDirectory =
|
Directory<String, Connection> connectionDirectory =
|
||||||
parentConnectionGroup.getConnectionDirectory();
|
parentConnectionGroup.getConnectionDirectory();
|
||||||
@@ -112,9 +112,9 @@ public class ConnectionRESTService {
|
|||||||
|
|
||||||
return connectionService.convertConnectionList(connections);
|
return connectionService.convertConnectionList(connections);
|
||||||
} catch(GuacamoleSecurityException e) {
|
} catch(GuacamoleSecurityException e) {
|
||||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||||
} catch(GuacamoleClientException e) {
|
} catch(GuacamoleClientException e) {
|
||||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||||
} catch(GuacamoleException e) {
|
} catch(GuacamoleException e) {
|
||||||
logger.error("Unexpected GuacamoleException caught while listing connections.", e);
|
logger.error("Unexpected GuacamoleException caught while listing connections.", e);
|
||||||
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
||||||
@@ -145,13 +145,13 @@ public class ConnectionRESTService {
|
|||||||
Connection connection = connectionDirectory.get(connectionID);
|
Connection connection = connectionDirectory.get(connectionID);
|
||||||
|
|
||||||
if(connection == null)
|
if(connection == null)
|
||||||
throw new GuacamoleClientException("No Connection found with the provided ID.");
|
throw new HTTPException(Status.NOT_FOUND, "No Connection found with the provided parentID.");
|
||||||
|
|
||||||
return new APIConnection(connection);
|
return new APIConnection(connection);
|
||||||
} catch(GuacamoleSecurityException e) {
|
} catch(GuacamoleSecurityException e) {
|
||||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||||
} catch(GuacamoleClientException e) {
|
} catch(GuacamoleClientException e) {
|
||||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||||
} catch(GuacamoleException e) {
|
} catch(GuacamoleException e) {
|
||||||
logger.error("Unexpected GuacamoleException caught while getting connection.", e);
|
logger.error("Unexpected GuacamoleException caught while getting connection.", e);
|
||||||
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
||||||
@@ -178,14 +178,14 @@ public class ConnectionRESTService {
|
|||||||
|
|
||||||
// Make sure the connection is there before trying to delete
|
// Make sure the connection is there before trying to delete
|
||||||
if(connectionDirectory.get(connectionID) == null)
|
if(connectionDirectory.get(connectionID) == null)
|
||||||
throw new GuacamoleClientException("No Connection found with the provided ID.");
|
throw new HTTPException(Status.NOT_FOUND, "No Connection found with the provided ID.");
|
||||||
|
|
||||||
// Delete the connection
|
// Delete the connection
|
||||||
connectionDirectory.remove(connectionID);
|
connectionDirectory.remove(connectionID);
|
||||||
} catch(GuacamoleSecurityException e) {
|
} catch(GuacamoleSecurityException e) {
|
||||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||||
} catch(GuacamoleClientException e) {
|
} catch(GuacamoleClientException e) {
|
||||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||||
} catch(GuacamoleException e) {
|
} catch(GuacamoleException e) {
|
||||||
logger.error("Unexpected GuacamoleException caught while deleting connection.", e);
|
logger.error("Unexpected GuacamoleException caught while deleting connection.", e);
|
||||||
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
||||||
@@ -225,7 +225,7 @@ public class ConnectionRESTService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(parentConnectionGroup == null)
|
if(parentConnectionGroup == null)
|
||||||
throw new GuacamoleClientException("No ConnectionGroup found with the provided parentID.");
|
throw new HTTPException(Status.NOT_FOUND, "No Connection found with the provided parentID.");
|
||||||
|
|
||||||
Directory<String, Connection> connectionDirectory =
|
Directory<String, Connection> connectionDirectory =
|
||||||
parentConnectionGroup.getConnectionDirectory();
|
parentConnectionGroup.getConnectionDirectory();
|
||||||
@@ -236,9 +236,9 @@ public class ConnectionRESTService {
|
|||||||
// Return the new connection identifier
|
// Return the new connection identifier
|
||||||
return connection.getIdentifier();
|
return connection.getIdentifier();
|
||||||
} catch(GuacamoleSecurityException e) {
|
} catch(GuacamoleSecurityException e) {
|
||||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||||
} catch(GuacamoleClientException e) {
|
} catch(GuacamoleClientException e) {
|
||||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||||
} catch(GuacamoleException e) {
|
} catch(GuacamoleException e) {
|
||||||
logger.error("Unexpected GuacamoleException caught while creating connection.", e);
|
logger.error("Unexpected GuacamoleException caught while creating connection.", e);
|
||||||
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
||||||
@@ -270,14 +270,14 @@ public class ConnectionRESTService {
|
|||||||
|
|
||||||
// Make sure the connection is there before trying to update
|
// Make sure the connection is there before trying to update
|
||||||
if(connectionDirectory.get(connectionID) == null)
|
if(connectionDirectory.get(connectionID) == null)
|
||||||
throw new GuacamoleClientException("No Connection with the provided ID.");
|
throw new HTTPException(Status.NOT_FOUND, "No Connection found with the provided ID.");
|
||||||
|
|
||||||
// Update the connection
|
// Update the connection
|
||||||
connectionDirectory.update(new APIConnectionWrapper(connection));
|
connectionDirectory.update(new APIConnectionWrapper(connection));
|
||||||
} catch(GuacamoleSecurityException e) {
|
} catch(GuacamoleSecurityException e) {
|
||||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||||
} catch(GuacamoleClientException e) {
|
} catch(GuacamoleClientException e) {
|
||||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||||
} catch(GuacamoleException e) {
|
} catch(GuacamoleException e) {
|
||||||
logger.error("Unexpected GuacamoleException caught updating connection.", e);
|
logger.error("Unexpected GuacamoleException caught updating connection.", e);
|
||||||
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
||||||
@@ -310,14 +310,14 @@ public class ConnectionRESTService {
|
|||||||
ConnectionGroup parentConnectionGroup = connectionGroupDirectory.get(parentID);
|
ConnectionGroup parentConnectionGroup = connectionGroupDirectory.get(parentID);
|
||||||
|
|
||||||
if(parentConnectionGroup == null)
|
if(parentConnectionGroup == null)
|
||||||
throw new GuacamoleClientException("No ConnectionGroup found with the provided parentID.");
|
throw new HTTPException(Status.NOT_FOUND, "No Connection found with the provided parentID.");
|
||||||
|
|
||||||
// Move the connection
|
// Move the connection
|
||||||
connectionDirectory.move(connectionID, parentConnectionGroup.getConnectionDirectory());
|
connectionDirectory.move(connectionID, parentConnectionGroup.getConnectionDirectory());
|
||||||
} catch(GuacamoleSecurityException e) {
|
} catch(GuacamoleSecurityException e) {
|
||||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||||
} catch(GuacamoleClientException e) {
|
} catch(GuacamoleClientException e) {
|
||||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||||
} catch(GuacamoleException e) {
|
} catch(GuacamoleException e) {
|
||||||
logger.error("Unexpected GuacamoleException caught moving connection.", e);
|
logger.error("Unexpected GuacamoleException caught moving connection.", e);
|
||||||
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
||||||
|
@@ -96,7 +96,7 @@ public class ConnectionGroupRESTService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(parentConnectionGroup == null)
|
if(parentConnectionGroup == null)
|
||||||
throw new GuacamoleClientException("No ConnectionGroup found with the provided parentID.");
|
throw new HTTPException(Status.NOT_FOUND, "No ConnectionGroup found with the provided parentID.");
|
||||||
|
|
||||||
Directory<String, ConnectionGroup> connectionGroupDirectory =
|
Directory<String, ConnectionGroup> connectionGroupDirectory =
|
||||||
parentConnectionGroup.getConnectionGroupDirectory();
|
parentConnectionGroup.getConnectionGroupDirectory();
|
||||||
@@ -111,9 +111,9 @@ public class ConnectionGroupRESTService {
|
|||||||
|
|
||||||
return connectionGroupService.convertConnectionGroupList(connectionGroups);
|
return connectionGroupService.convertConnectionGroupList(connectionGroups);
|
||||||
} catch(GuacamoleSecurityException e) {
|
} catch(GuacamoleSecurityException e) {
|
||||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||||
} catch(GuacamoleClientException e) {
|
} catch(GuacamoleClientException e) {
|
||||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||||
} catch(GuacamoleException e) {
|
} catch(GuacamoleException e) {
|
||||||
logger.error("Unexpected GuacamoleException caught while listing connection groups.", e);
|
logger.error("Unexpected GuacamoleException caught while listing connection groups.", e);
|
||||||
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
||||||
@@ -144,13 +144,13 @@ public class ConnectionGroupRESTService {
|
|||||||
ConnectionGroup connectionGroup = connectionGroupDirectory.get(connectionGroupID);
|
ConnectionGroup connectionGroup = connectionGroupDirectory.get(connectionGroupID);
|
||||||
|
|
||||||
if(connectionGroup == null)
|
if(connectionGroup == null)
|
||||||
throw new GuacamoleClientException("No ConnectionGroup found with the provided ID.");
|
throw new HTTPException(Status.NOT_FOUND, "No ConnectionGroup found with the provided ID.");
|
||||||
|
|
||||||
return new APIConnectionGroup(connectionGroup);
|
return new APIConnectionGroup(connectionGroup);
|
||||||
} catch(GuacamoleSecurityException e) {
|
} catch(GuacamoleSecurityException e) {
|
||||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||||
} catch(GuacamoleClientException e) {
|
} catch(GuacamoleClientException e) {
|
||||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||||
} catch(GuacamoleException e) {
|
} catch(GuacamoleException e) {
|
||||||
logger.error("Unexpected GuacamoleException caught while getting connection group.", e);
|
logger.error("Unexpected GuacamoleException caught while getting connection group.", e);
|
||||||
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
||||||
@@ -177,14 +177,14 @@ public class ConnectionGroupRESTService {
|
|||||||
|
|
||||||
// Make sure the connection is there before trying to delete
|
// Make sure the connection is there before trying to delete
|
||||||
if(connectionGroupDirectory.get(connectionGroupID) == null)
|
if(connectionGroupDirectory.get(connectionGroupID) == null)
|
||||||
throw new GuacamoleClientException("No Connection found with the provided ID.");
|
throw new HTTPException(Status.NOT_FOUND, "No ConnectionGroup found with the provided ID.");
|
||||||
|
|
||||||
// Delete the connection group
|
// Delete the connection group
|
||||||
connectionGroupDirectory.remove(connectionGroupID);
|
connectionGroupDirectory.remove(connectionGroupID);
|
||||||
} catch(GuacamoleSecurityException e) {
|
} catch(GuacamoleSecurityException e) {
|
||||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||||
} catch(GuacamoleClientException e) {
|
} catch(GuacamoleClientException e) {
|
||||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||||
} catch(GuacamoleException e) {
|
} catch(GuacamoleException e) {
|
||||||
logger.error("Unexpected GuacamoleException caught while deleting connection group.", e);
|
logger.error("Unexpected GuacamoleException caught while deleting connection group.", e);
|
||||||
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
||||||
@@ -224,7 +224,7 @@ public class ConnectionGroupRESTService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(parentConnectionGroup == null)
|
if(parentConnectionGroup == null)
|
||||||
throw new GuacamoleClientException("No ConnectionGroup found with the provided parentID.");
|
throw new HTTPException(Status.NOT_FOUND, "No ConnectionGroup found with the provided parentID.");
|
||||||
|
|
||||||
Directory<String, ConnectionGroup> connectionGroupDirectory =
|
Directory<String, ConnectionGroup> connectionGroupDirectory =
|
||||||
parentConnectionGroup.getConnectionGroupDirectory();
|
parentConnectionGroup.getConnectionGroupDirectory();
|
||||||
@@ -235,9 +235,9 @@ public class ConnectionGroupRESTService {
|
|||||||
// Return the new connection group identifier
|
// Return the new connection group identifier
|
||||||
return connectionGroup.getIdentifier();
|
return connectionGroup.getIdentifier();
|
||||||
} catch(GuacamoleSecurityException e) {
|
} catch(GuacamoleSecurityException e) {
|
||||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||||
} catch(GuacamoleClientException e) {
|
} catch(GuacamoleClientException e) {
|
||||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||||
} catch(GuacamoleException e) {
|
} catch(GuacamoleException e) {
|
||||||
logger.error("Unexpected GuacamoleException caught while creating connection.", e);
|
logger.error("Unexpected GuacamoleException caught while creating connection.", e);
|
||||||
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
||||||
@@ -269,14 +269,14 @@ public class ConnectionGroupRESTService {
|
|||||||
|
|
||||||
// Make sure the connection group is there before trying to update
|
// Make sure the connection group is there before trying to update
|
||||||
if(connectionGroupDirectory.get(connectionGroupID) == null)
|
if(connectionGroupDirectory.get(connectionGroupID) == null)
|
||||||
throw new GuacamoleClientException("No ConnectionGroup with the provided ID.");
|
throw new HTTPException(Status.NOT_FOUND, "No ConnectionGroup found with the provided ID.");
|
||||||
|
|
||||||
// Update the connection group
|
// Update the connection group
|
||||||
connectionGroupDirectory.update(new APIConnectionGroupWrapper(connectionGroup));
|
connectionGroupDirectory.update(new APIConnectionGroupWrapper(connectionGroup));
|
||||||
} catch(GuacamoleSecurityException e) {
|
} catch(GuacamoleSecurityException e) {
|
||||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||||
} catch(GuacamoleClientException e) {
|
} catch(GuacamoleClientException e) {
|
||||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||||
} catch(GuacamoleException e) {
|
} catch(GuacamoleException e) {
|
||||||
logger.error("Unexpected GuacamoleException caught updating connection.", e);
|
logger.error("Unexpected GuacamoleException caught updating connection.", e);
|
||||||
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
||||||
@@ -308,15 +308,15 @@ public class ConnectionGroupRESTService {
|
|||||||
Directory<String, ConnectionGroup> newConnectionGroupDirectory = rootGroup.getConnectionGroupDirectory();
|
Directory<String, ConnectionGroup> newConnectionGroupDirectory = rootGroup.getConnectionGroupDirectory();
|
||||||
ConnectionGroup parentConnectionGroup = newConnectionGroupDirectory.get(parentID);
|
ConnectionGroup parentConnectionGroup = newConnectionGroupDirectory.get(parentID);
|
||||||
|
|
||||||
if(newConnectionGroupDirectory == null)
|
if(parentConnectionGroup == null)
|
||||||
throw new GuacamoleClientException("No ConnectionGroup found with the provided parentID.");
|
throw new HTTPException(Status.NOT_FOUND, "No ConnectionGroup found with the provided parentID.");
|
||||||
|
|
||||||
// Move the connection
|
// Move the connection
|
||||||
connectionGroupDirectory.move(connectionGroupID, parentConnectionGroup.getConnectionGroupDirectory());
|
connectionGroupDirectory.move(connectionGroupID, parentConnectionGroup.getConnectionGroupDirectory());
|
||||||
} catch(GuacamoleSecurityException e) {
|
} catch(GuacamoleSecurityException e) {
|
||||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||||
} catch(GuacamoleClientException e) {
|
} catch(GuacamoleClientException e) {
|
||||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||||
} catch(GuacamoleException e) {
|
} catch(GuacamoleException e) {
|
||||||
logger.error("Unexpected GuacamoleException caught moving connection.", e);
|
logger.error("Unexpected GuacamoleException caught moving connection.", e);
|
||||||
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
||||||
|
@@ -89,9 +89,9 @@ public class PermissionRESTService {
|
|||||||
return permissionService.convertPermissionList(user.getPermissions());
|
return permissionService.convertPermissionList(user.getPermissions());
|
||||||
|
|
||||||
} catch(GuacamoleSecurityException e) {
|
} catch(GuacamoleSecurityException e) {
|
||||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||||
} catch(GuacamoleClientException e) {
|
} catch(GuacamoleClientException e) {
|
||||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||||
} catch(GuacamoleException e) {
|
} catch(GuacamoleException e) {
|
||||||
logger.error("Unexpected GuacamoleException caught while listing permissions.", e);
|
logger.error("Unexpected GuacamoleException caught while listing permissions.", e);
|
||||||
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
||||||
@@ -122,9 +122,9 @@ public class PermissionRESTService {
|
|||||||
// Add the new permission
|
// Add the new permission
|
||||||
user.addPermission(permission.toPermission());
|
user.addPermission(permission.toPermission());
|
||||||
} catch(GuacamoleSecurityException e) {
|
} catch(GuacamoleSecurityException e) {
|
||||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||||
} catch(GuacamoleClientException e) {
|
} catch(GuacamoleClientException e) {
|
||||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||||
} catch(GuacamoleException e) {
|
} catch(GuacamoleException e) {
|
||||||
logger.error("Unexpected GuacamoleException caught adding permission.", e);
|
logger.error("Unexpected GuacamoleException caught adding permission.", e);
|
||||||
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
||||||
@@ -155,9 +155,9 @@ public class PermissionRESTService {
|
|||||||
// Remove the permission
|
// Remove the permission
|
||||||
user.removePermission(permission.toPermission());
|
user.removePermission(permission.toPermission());
|
||||||
} catch(GuacamoleSecurityException e) {
|
} catch(GuacamoleSecurityException e) {
|
||||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||||
} catch(GuacamoleClientException e) {
|
} catch(GuacamoleClientException e) {
|
||||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||||
} catch(GuacamoleException e) {
|
} catch(GuacamoleException e) {
|
||||||
logger.error("Unexpected GuacamoleException caught adding permission.", e);
|
logger.error("Unexpected GuacamoleException caught adding permission.", e);
|
||||||
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
||||||
|
@@ -86,9 +86,9 @@ public class UserRESTService {
|
|||||||
// Convert and return the user directory listing
|
// Convert and return the user directory listing
|
||||||
return userService.convertUserList(userDirectory);
|
return userService.convertUserList(userDirectory);
|
||||||
} catch(GuacamoleSecurityException e) {
|
} catch(GuacamoleSecurityException e) {
|
||||||
throw new HTTPException(Response.Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
throw new HTTPException(Response.Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||||
} catch(GuacamoleClientException e) {
|
} catch(GuacamoleClientException e) {
|
||||||
throw new HTTPException(Response.Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
throw new HTTPException(Response.Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||||
} catch(GuacamoleException e) {
|
} catch(GuacamoleException e) {
|
||||||
logger.error("Unexpected GuacamoleException caught while listing permissions.", e);
|
logger.error("Unexpected GuacamoleException caught while listing permissions.", e);
|
||||||
throw new HTTPException(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
throw new HTTPException(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
||||||
@@ -119,9 +119,9 @@ public class UserRESTService {
|
|||||||
// Return the user
|
// Return the user
|
||||||
return new APIUser(user);
|
return new APIUser(user);
|
||||||
} catch(GuacamoleSecurityException e) {
|
} catch(GuacamoleSecurityException e) {
|
||||||
throw new HTTPException(Response.Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
throw new HTTPException(Response.Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||||
} catch(GuacamoleClientException e) {
|
} catch(GuacamoleClientException e) {
|
||||||
throw new HTTPException(Response.Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
throw new HTTPException(Response.Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||||
} catch(GuacamoleException e) {
|
} catch(GuacamoleException e) {
|
||||||
logger.error("Unexpected GuacamoleException caught while listing permissions.", e);
|
logger.error("Unexpected GuacamoleException caught while listing permissions.", e);
|
||||||
throw new HTTPException(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
throw new HTTPException(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
||||||
@@ -147,9 +147,9 @@ public class UserRESTService {
|
|||||||
|
|
||||||
return user.getUsername();
|
return user.getUsername();
|
||||||
} catch(GuacamoleSecurityException e) {
|
} catch(GuacamoleSecurityException e) {
|
||||||
throw new HTTPException(Response.Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
throw new HTTPException(Response.Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||||
} catch(GuacamoleClientException e) {
|
} catch(GuacamoleClientException e) {
|
||||||
throw new HTTPException(Response.Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
throw new HTTPException(Response.Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||||
} catch(GuacamoleException e) {
|
} catch(GuacamoleException e) {
|
||||||
logger.error("Unexpected GuacamoleException caught while listing permissions.", e);
|
logger.error("Unexpected GuacamoleException caught while listing permissions.", e);
|
||||||
throw new HTTPException(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
throw new HTTPException(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
||||||
@@ -187,9 +187,9 @@ public class UserRESTService {
|
|||||||
*/
|
*/
|
||||||
userDirectory.update(new APIUserWrapper(user, existingUser.getPermissions()));
|
userDirectory.update(new APIUserWrapper(user, existingUser.getPermissions()));
|
||||||
} catch(GuacamoleSecurityException e) {
|
} catch(GuacamoleSecurityException e) {
|
||||||
throw new HTTPException(Response.Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
throw new HTTPException(Response.Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||||
} catch(GuacamoleClientException e) {
|
} catch(GuacamoleClientException e) {
|
||||||
throw new HTTPException(Response.Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
throw new HTTPException(Response.Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||||
} catch(GuacamoleException e) {
|
} catch(GuacamoleException e) {
|
||||||
logger.error("Unexpected GuacamoleException caught while listing permissions.", e);
|
logger.error("Unexpected GuacamoleException caught while listing permissions.", e);
|
||||||
throw new HTTPException(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
throw new HTTPException(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
||||||
@@ -220,9 +220,9 @@ public class UserRESTService {
|
|||||||
// Delete the user
|
// Delete the user
|
||||||
userDirectory.remove(userID);
|
userDirectory.remove(userID);
|
||||||
} catch(GuacamoleSecurityException e) {
|
} catch(GuacamoleSecurityException e) {
|
||||||
throw new HTTPException(Response.Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
throw new HTTPException(Response.Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||||
} catch(GuacamoleClientException e) {
|
} catch(GuacamoleClientException e) {
|
||||||
throw new HTTPException(Response.Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
throw new HTTPException(Response.Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||||
} catch(GuacamoleException e) {
|
} catch(GuacamoleException e) {
|
||||||
logger.error("Unexpected GuacamoleException caught while listing permissions.", e);
|
logger.error("Unexpected GuacamoleException caught while listing permissions.", e);
|
||||||
throw new HTTPException(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
throw new HTTPException(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");
|
||||||
|
Reference in New Issue
Block a user