code: public List<ConnectionRecord> retrieveHistory(ModeledAuthenticatedUser user,
              ModeledConnection connection) throws GuacamoleException {
  
          String identifier = connection.getIdentifier();
  
          // Retrieve history only if READ permission is granted
          if (hasObjectPermission(user, identifier, ObjectPermission.Type.READ)) {
  
              // Retrieve history
              List<ConnectionRecordModel> models = connectionRecordMapper.select(identifier);
  
              // Get currently-active connections
              List<ConnectionRecord> records = new ArrayList<ConnectionRecord>(tunnelService.getActiveConnections(connection));
              Collections.reverse(records);
  
              // Add past connections from model objects
              for (ConnectionRecordModel model : models)
                  records.add(getObjectInstance(model));
  
              // Return converted history list
              return records;
  
          }
  
          // The user does not have permission to read the history
          throw new GuacamoleSecurityException("Permission denied.");
  
      }
docs: Retrieves the connection history of the given connection, including any
  active connections.
  
  @param user
  The user retrieving the connection history.
  
  @param connection
  The connection whose history is being retrieved.
  
  @return
  The connection history of the given connection, including any
  active connections.
  
  @throws GuacamoleException
  If permission to read the connection history is denied.