Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

Commit

Permalink
GUACAMOLE-38: Fix issues with root identifier and directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
necouchman committed Jun 1, 2018
1 parent 555b26a commit 7df88cd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
Expand Up @@ -36,11 +36,6 @@
*/ */
public class QuickConnectDirectory extends SimpleDirectory<Connection> { public class QuickConnectDirectory extends SimpleDirectory<Connection> {


/**
* The unique identifier of the root connection group.
*/
private static final String ROOT_IDENTIFIER = "ROOT";

/** /**
* The connections to store. * The connections to store.
*/ */
Expand Down Expand Up @@ -113,7 +108,7 @@ public String create(GuacamoleConfiguration config) throws GuacamoleException {


// Create a new connection and set the parent identifier. // Create a new connection and set the parent identifier.
Connection connection = new SimpleConnection(name, connectionId, config); Connection connection = new SimpleConnection(name, connectionId, config);
connection.setParentIdentifier(ROOT_IDENTIFIER); connection.setParentIdentifier(QuickConnectUserContext.ROOT_IDENTIFIER);


// Place the object in this directory. // Place the object in this directory.
add(connection); add(connection);
Expand Down
Expand Up @@ -37,6 +37,11 @@
*/ */
public class QuickConnectUserContext extends AbstractUserContext { public class QuickConnectUserContext extends AbstractUserContext {


/**
* The unique identifier of the root connection group.
*/
public static final String ROOT_IDENTIFIER = DEFAULT_ROOT_CONNECTION_GROUP;

/** /**
* The AuthenticationProvider that created this UserContext. * The AuthenticationProvider that created this UserContext.
*/ */
Expand Down Expand Up @@ -71,25 +76,25 @@ public class QuickConnectUserContext extends AbstractUserContext {
* The name of the user logging in and using this class. * The name of the user logging in and using this class.
*/ */
public QuickConnectUserContext(AuthenticationProvider authProvider, public QuickConnectUserContext(AuthenticationProvider authProvider,
String username) { String username) throws GuacamoleException {


// Initialize the rootGroup to a basic connection group with a // Initialize the rootGroup to a basic connection group with a
// single root identifier. // single root identifier.
this.rootGroup = new QuickConnectionGroup( this.rootGroup = new QuickConnectionGroup(
DEFAULT_ROOT_CONNECTION_GROUP, ROOT_IDENTIFIER,
DEFAULT_ROOT_CONNECTION_GROUP ROOT_IDENTIFIER
); );


// Initialize the connection directory
this.connectionDirectory = new QuickConnectDirectory(this.rootGroup);

// Initialize the user to a SimpleUser with the provided username, // Initialize the user to a SimpleUser with the provided username,
// no connections, and the single root group. // no connections, and the single root group.
this.self = new SimpleUser(username, this.self = new SimpleUser(username,
Collections.<String>emptyList(), connectionDirectory.getIdentifiers(),
Collections.singleton(DEFAULT_ROOT_CONNECTION_GROUP) Collections.singleton(ROOT_IDENTIFIER)
); );


// Initialize the connection directory
this.connectionDirectory = new QuickConnectDirectory(this.rootGroup);

// Set the authProvider to the calling authProvider object. // Set the authProvider to the calling authProvider object.
this.authProvider = authProvider; this.authProvider = authProvider;


Expand Down

0 comments on commit 7df88cd

Please sign in to comment.