Ticket #263: Fixed a couple of bugs after testing.

This commit is contained in:
James Muehlner
2013-08-09 00:12:14 -07:00
parent e7ec3399c6
commit c4e3ff1122
4 changed files with 21 additions and 9 deletions

View File

@@ -48,6 +48,7 @@ import net.sourceforge.guacamole.net.auth.AuthenticationProvider;
import net.sourceforge.guacamole.net.auth.Credentials;
import net.sourceforge.guacamole.net.auth.UserContext;
import net.sourceforge.guacamole.net.auth.mysql.dao.ConnectionGroupMapper;
import net.sourceforge.guacamole.net.auth.mysql.dao.ConnectionGroupPermissionMapper;
import net.sourceforge.guacamole.net.auth.mysql.dao.ConnectionHistoryMapper;
import net.sourceforge.guacamole.net.auth.mysql.dao.ConnectionMapper;
import net.sourceforge.guacamole.net.auth.mysql.dao.ConnectionParameterMapper;
@@ -159,6 +160,7 @@ public class MySQLAuthenticationProvider implements AuthenticationProvider {
addMapperClass(ConnectionHistoryMapper.class);
addMapperClass(ConnectionMapper.class);
addMapperClass(ConnectionGroupMapper.class);
addMapperClass(ConnectionGroupPermissionMapper.class);
addMapperClass(ConnectionParameterMapper.class);
addMapperClass(ConnectionPermissionMapper.class);
addMapperClass(SystemPermissionMapper.class);

View File

@@ -150,11 +150,12 @@ public class MySQLConnectionGroup extends AbstractConnectionGroup {
* @param userID The IID of the user who queried this connection.
*/
public void init(Integer connectionGroupID, Integer parentID, String name,
String identifier, String type, int userID) {
String identifier, ConnectionGroup.Type type, int userID) {
this.connectionGroupID = connectionGroupID;
this.parentID = parentID;
setName(name);
setIdentifier(identifier);
setType(type);
this.userID = userID;
connectionDirectory = connectionDirectoryProvider.get();

View File

@@ -65,11 +65,10 @@ public class MySQLUserContext implements UserContext {
private UserDirectory userDirectory;
/**
* User directory restricted by the permissions of the user associated
* with this context.
* The root connection group.
*/
@Inject
private MySQLConnectionGroup mySQLConnectionGroup;
private MySQLConnectionGroup rootConnectionGroup;
/**
* Service for accessing users.
@@ -85,9 +84,10 @@ public class MySQLUserContext implements UserContext {
public void init(int user_id) {
this.user_id = user_id;
userDirectory.init(user_id);
mySQLConnectionGroup.init(null, null, MySQLConstants.CONNECTION_GROUP_ROOT_IDENTIFIER,
rootConnectionGroup.init(null, null,
MySQLConstants.CONNECTION_GROUP_ROOT_IDENTIFIER,
MySQLConstants.CONNECTION_GROUP_ORGANIZATIONAL, user_id);
MySQLConstants.CONNECTION_GROUP_ROOT_IDENTIFIER,
ConnectionGroup.Type.ORGANIZATIONAL, user_id);
}
@Override
@@ -102,7 +102,7 @@ public class MySQLUserContext implements UserContext {
@Override
public ConnectionGroup getConnectionGroup() throws GuacamoleException {
return mySQLConnectionGroup;
return rootConnectionGroup;
}
}

View File

@@ -283,12 +283,21 @@ public class ConnectionGroupService {
// Create new MySQLConnection from retrieved data
MySQLConnectionGroup mySQLConnectionGroup = mysqlConnectionGroupProvider.get();
String mySqlType = connectionGroup.getType();
net.sourceforge.guacamole.net.auth.ConnectionGroup.Type authType;
if(mySqlType.equals(MySQLConstants.CONNECTION_GROUP_ORGANIZATIONAL))
authType = net.sourceforge.guacamole.net.auth.ConnectionGroup.Type.ORGANIZATIONAL;
else
authType = net.sourceforge.guacamole.net.auth.ConnectionGroup.Type.BALANCING;
mySQLConnectionGroup.init(
connectionGroup.getConnection_group_id(),
connectionGroup.getParent_id(),
connectionGroup.getConnection_group_name(),
Integer.toString(connectionGroup.getConnection_group_id()),
connectionGroup.getType(),
authType,
userID
);