Ticket #263: Make sure that no group cycles can be created, and change it so you can move items to ROOT.

This commit is contained in:
James Muehlner
2013-08-15 10:33:31 -07:00
parent e55131c3c5
commit 1ba07bc03b
4 changed files with 11 additions and 11 deletions

View File

@@ -295,16 +295,16 @@ public class ConnectionDirectory implements Directory<String, Connection>{
throws GuacamoleException {
if(!(directory instanceof ConnectionDirectory))
throw new GuacamoleException("Directory not from database");
throw new GuacamoleClientException("Directory not from database");
int toConnectionGroupID = ((ConnectionDirectory)directory).parentID;
Integer toConnectionGroupID = ((ConnectionDirectory)directory).parentID;
// Get connection
MySQLConnection mySQLConnection =
connectionService.retrieveConnection(identifier, user_id);
if(mySQLConnection == null)
throw new GuacamoleException("Connection not found.");
throw new GuacamoleClientException("Connection not found.");
// Verify permission to update the connection
permissionCheckService.verifyConnectionAccess(this.user_id,

View File

@@ -244,19 +244,19 @@ public class ConnectionGroupDirectory implements Directory<String, ConnectionGro
throws GuacamoleException {
if(MySQLConstants.CONNECTION_GROUP_ROOT_IDENTIFIER.equals(identifier))
throw new GuacamoleException("The root connection group cannot be moved.");
throw new GuacamoleClientException("The root connection group cannot be moved.");
if(!(directory instanceof ConnectionGroupDirectory))
throw new GuacamoleException("Directory not from database");
throw new GuacamoleClientException("Directory not from database");
int toConnectionGroupID = ((ConnectionGroupDirectory)directory).parentID;
Integer toConnectionGroupID = ((ConnectionGroupDirectory)directory).parentID;
// Get connection group
MySQLConnectionGroup mySQLConnectionGroup =
connectionGroupService.retrieveConnectionGroup(identifier, user_id);
if(mySQLConnectionGroup == null)
throw new GuacamoleException("Connection group not found.");
throw new GuacamoleClientException("Connection group not found.");
// Verify permission to update the connection
permissionCheckService.verifyConnectionAccess(this.user_id,
@@ -290,7 +290,7 @@ public class ConnectionGroupDirectory implements Directory<String, ConnectionGro
Integer relativeParentID = toConnectionGroupID;
while(relativeParentID != null) {
if(relativeParentID == mySQLConnectionGroup.getConnectionGroupID())
throw new GuacamoleException("Connection group cycle detected.");
throw new GuacamoleClientException("Connection group cycle detected.");
MySQLConnectionGroup relativeParentGroup = connectionGroupService.
retrieveConnectionGroup(relativeParentID, user_id);

View File

@@ -390,8 +390,8 @@ public class ConnectionGroupService {
break;
}
// Update the connection in the database
connectionGroupDAO.updateByPrimaryKeySelective(connectionGroup);
// Update the connection group in the database
connectionGroupDAO.updateByPrimaryKey(connectionGroup);
}

View File

@@ -416,7 +416,7 @@ public class ConnectionService {
connection.setProtocol(mySQLConnection.getConfiguration().getProtocol());
// Update the connection in the database
connectionDAO.updateByPrimaryKeySelective(connection);
connectionDAO.updateByPrimaryKey(connection);
}