mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 00:53:21 +00:00 
			
		
		
		
	Ticket #362: Cleaned up a bit more.
This commit is contained in:
		| @@ -97,7 +97,7 @@ public class ConnectionRESTService { | ||||
|             } | ||||
|              | ||||
|             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 =  | ||||
|                     parentConnectionGroup.getConnectionDirectory(); | ||||
| @@ -112,9 +112,9 @@ public class ConnectionRESTService { | ||||
|              | ||||
|             return connectionService.convertConnectionList(connections); | ||||
|         } 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) { | ||||
|                 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) { | ||||
|             logger.error("Unexpected GuacamoleException caught while listing connections.", e); | ||||
|             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); | ||||
|              | ||||
|             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); | ||||
|         } 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) { | ||||
|                 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) { | ||||
|             logger.error("Unexpected GuacamoleException caught while getting connection.", e); | ||||
|             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 | ||||
|             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 | ||||
|             connectionDirectory.remove(connectionID); | ||||
|         } 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) { | ||||
|                 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) { | ||||
|             logger.error("Unexpected GuacamoleException caught while deleting connection.", e); | ||||
|             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) | ||||
|                 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 =  | ||||
|                     parentConnectionGroup.getConnectionDirectory(); | ||||
| @@ -236,9 +236,9 @@ public class ConnectionRESTService { | ||||
|             // Return the new connection identifier | ||||
|             return connection.getIdentifier(); | ||||
|         } 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) { | ||||
|                 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) { | ||||
|             logger.error("Unexpected GuacamoleException caught while creating connection.", e); | ||||
|             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 | ||||
|             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 | ||||
|             connectionDirectory.update(new APIConnectionWrapper(connection)); | ||||
|         } 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) { | ||||
|                 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) { | ||||
|             logger.error("Unexpected GuacamoleException caught updating connection.", e); | ||||
|             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); | ||||
|              | ||||
|             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 | ||||
|             connectionDirectory.move(connectionID, parentConnectionGroup.getConnectionDirectory()); | ||||
|         } 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) { | ||||
|                 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) { | ||||
|             logger.error("Unexpected GuacamoleException caught moving connection.", e); | ||||
|             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) | ||||
|                 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 =  | ||||
|                     parentConnectionGroup.getConnectionGroupDirectory(); | ||||
| @@ -111,9 +111,9 @@ public class ConnectionGroupRESTService { | ||||
|              | ||||
|             return connectionGroupService.convertConnectionGroupList(connectionGroups); | ||||
|         } 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) { | ||||
|                 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) { | ||||
|             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."); | ||||
| @@ -144,13 +144,13 @@ public class ConnectionGroupRESTService { | ||||
|             ConnectionGroup connectionGroup = connectionGroupDirectory.get(connectionGroupID); | ||||
|              | ||||
|             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); | ||||
|         } 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) { | ||||
|                 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) { | ||||
|             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."); | ||||
| @@ -177,14 +177,14 @@ public class ConnectionGroupRESTService { | ||||
|              | ||||
|             // Make sure the connection is there before trying to delete | ||||
|             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 | ||||
|             connectionGroupDirectory.remove(connectionGroupID); | ||||
|         } 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) { | ||||
|                 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) { | ||||
|             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."); | ||||
| @@ -224,7 +224,7 @@ public class ConnectionGroupRESTService { | ||||
|             } | ||||
|              | ||||
|             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 =  | ||||
|                     parentConnectionGroup.getConnectionGroupDirectory(); | ||||
| @@ -235,9 +235,9 @@ public class ConnectionGroupRESTService { | ||||
|             // Return the new connection group identifier | ||||
|             return connectionGroup.getIdentifier(); | ||||
|         } 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) { | ||||
|                 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) { | ||||
|             logger.error("Unexpected GuacamoleException caught while creating connection.", e); | ||||
|             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 | ||||
|             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 | ||||
|             connectionGroupDirectory.update(new APIConnectionGroupWrapper(connectionGroup)); | ||||
|         } 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) { | ||||
|                 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) { | ||||
|             logger.error("Unexpected GuacamoleException caught updating connection.", e); | ||||
|             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(); | ||||
|             ConnectionGroup parentConnectionGroup = newConnectionGroupDirectory.get(parentID); | ||||
|              | ||||
|             if(newConnectionGroupDirectory == null) | ||||
|                 throw new GuacamoleClientException("No ConnectionGroup found with the provided parentID."); | ||||
|             if(parentConnectionGroup == null) | ||||
|                 throw new HTTPException(Status.NOT_FOUND, "No ConnectionGroup found with the provided parentID."); | ||||
|              | ||||
|             // Move the connection | ||||
|             connectionGroupDirectory.move(connectionGroupID, parentConnectionGroup.getConnectionGroupDirectory()); | ||||
|         } 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) { | ||||
|                 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) { | ||||
|             logger.error("Unexpected GuacamoleException caught moving connection.", e); | ||||
|             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()); | ||||
|              | ||||
|         } 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) { | ||||
|                 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) { | ||||
|             logger.error("Unexpected GuacamoleException caught while listing permissions.", e); | ||||
|             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 | ||||
|             user.addPermission(permission.toPermission()); | ||||
|         } 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) { | ||||
|                 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) { | ||||
|             logger.error("Unexpected GuacamoleException caught adding permission.", e); | ||||
|             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 | ||||
|             user.removePermission(permission.toPermission()); | ||||
|         } 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) { | ||||
|                 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) { | ||||
|             logger.error("Unexpected GuacamoleException caught adding permission.", e); | ||||
|             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 | ||||
|             return userService.convertUserList(userDirectory); | ||||
|         } 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) { | ||||
|                 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) { | ||||
|             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."); | ||||
| @@ -119,9 +119,9 @@ public class UserRESTService { | ||||
|             // Return the user | ||||
|             return new APIUser(user); | ||||
|         } 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) { | ||||
|                 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) { | ||||
|             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."); | ||||
| @@ -147,9 +147,9 @@ public class UserRESTService { | ||||
|              | ||||
|             return user.getUsername(); | ||||
|         } 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) { | ||||
|                 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) { | ||||
|             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."); | ||||
| @@ -187,9 +187,9 @@ public class UserRESTService { | ||||
|              */ | ||||
|             userDirectory.update(new APIUserWrapper(user, existingUser.getPermissions())); | ||||
|         } 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) { | ||||
|                 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) { | ||||
|             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."); | ||||
| @@ -220,9 +220,9 @@ public class UserRESTService { | ||||
|             // Delete the user | ||||
|             userDirectory.remove(userID); | ||||
|         } 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) { | ||||
|                 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) { | ||||
|             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."); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user