code: private void addConnectionGroupDescendants(Collection<ConnectionGroup> parents,
              List<ObjectPermission.Type> permissions)
          throws GuacamoleException {
  
          // If no parents, nothing to do
          if (parents.isEmpty())
              return;
  
          Collection<String> childConnectionIdentifiers = new ArrayList<String>();
          Collection<String> childConnectionGroupIdentifiers = new ArrayList<String>();
          
          // Build lists of identifiers for retrieval
          for (ConnectionGroup parent : parents) {
              childConnectionIdentifiers.addAll(parent.getConnectionIdentifiers());
              childConnectionGroupIdentifiers.addAll(parent.getConnectionGroupIdentifiers());
          }
  
          // Filter identifiers based on permissions, if requested
          if (permissions != null && !permissions.isEmpty())
              childConnectionIdentifiers = connectionPermissions.getAccessibleObjects(
                      permissions, childConnectionIdentifiers);
          
          // Retrieve child connections
          if (!childConnectionIdentifiers.isEmpty()) {
              Collection<Connection> childConnections = connectionDirectory.getAll(childConnectionIdentifiers);
              addConnections(childConnections);
              addConnectionDescendants(childConnections, permissions);
          }
  
          // Retrieve child connection groups
          if (!childConnectionGroupIdentifiers.isEmpty()) {
              Collection<ConnectionGroup> childConnectionGroups = connectionGroupDirectory.getAll(childConnectionGroupIdentifiers);
              addConnectionGroups(childConnectionGroups);
              addConnectionGroupDescendants(childConnectionGroups, permissions);
          }
  
      }
docs: Adds all descendants of the given parent groups to their corresponding
  parents already stored under root.
  
  @param parents
  The parents whose descendants should be added to the tree.
  
  @param permissions
  If specified and non-empty, limit added connections to only
  connections for which the current user has any of the given
  permissions. Otherwise, all visible connections are added.
  Connection groups are unaffected by this parameter.
  
  @throws GuacamoleException
  If an error occurs while retrieving the descendants.