code: public void init(AuthenticatedUser user, LDAPConnection ldapConnection)
              throws GuacamoleException {
  
          // Query all accessible users
          userDirectory = new SimpleDirectory<>(
              userService.getUsers(ldapConnection)
          );
  
          // Query all accessible user groups
          userGroupDirectory = new SimpleDirectory<>(
              userGroupService.getUserGroups(ldapConnection)
          );
  
          // Query all accessible connections
          connectionDirectory = new SimpleDirectory<>(
              connectionService.getConnections(user, ldapConnection)
          );
  
          // Root group contains only connections
          rootGroup = new SimpleConnectionGroup(
              LDAPAuthenticationProvider.ROOT_CONNECTION_GROUP,
              LDAPAuthenticationProvider.ROOT_CONNECTION_GROUP,
              connectionDirectory.getIdentifiers(),
              Collections.<String>emptyList()
          );
  
          // Init self with basic permissions
          self = new SimpleUser(user.getIdentifier()) {
  
              @Override
              public ObjectPermissionSet getUserPermissions() throws GuacamoleException {
                  return new SimpleObjectPermissionSet(userDirectory.getIdentifiers());
              }
  
              @Override
              public ObjectPermissionSet getUserGroupPermissions() throws GuacamoleException {
                  return new SimpleObjectPermissionSet(userGroupDirectory.getIdentifiers());
              }
  
              @Override
              public ObjectPermissionSet getConnectionPermissions() throws GuacamoleException {
                  return new SimpleObjectPermissionSet(connectionDirectory.getIdentifiers());
              }
  
              @Override
              public ObjectPermissionSet getConnectionGroupPermissions() throws GuacamoleException {
                  return new SimpleObjectPermissionSet(Collections.singleton(LDAPAuthenticationProvider.ROOT_CONNECTION_GROUP));
              }
  
          };
  
      }
docs: Initializes this UserContext using the provided AuthenticatedUser and
  LDAPConnection.
  
  @param user
  The AuthenticatedUser representing the user that authenticated. This
  user may have been authenticated by a different authentication
  provider (not LDAP).
  
  @param ldapConnection
  The connection to the LDAP server to use when querying accessible
  Guacamole users and connections.
  
  @throws GuacamoleException
  If associated data stored within the LDAP directory cannot be
  queried due to an error.