code: public List<ConnectionRecord> retrieveHistory(ModeledAuthenticatedUser user,
              Collection<ActivityRecordSearchTerm> requiredContents,
              List<ActivityRecordSortPredicate> sortPredicates, int limit)
              throws GuacamoleException {
  
          List<ConnectionRecordModel> searchResults;
  
          // Bypass permission checks if the user is a system admin
          if (user.getUser().isAdministrator())
              searchResults = connectionRecordMapper.search(requiredContents,
                      sortPredicates, limit);
  
          // Otherwise only return explicitly readable history records
          else
              searchResults = connectionRecordMapper.searchReadable(
                      user.getUser().getModel(), requiredContents, sortPredicates,
                      limit, user.getEffectiveUserGroups());
  
          return getObjectInstances(searchResults);
  
      }
docs: Retrieves the connection history records matching the given criteria.
  Retrieves up to <code>limit</code> connection history records matching
  the given terms and sorted by the given predicates. Only history records
  associated with data that the given user can read are returned.
  
  @param user
  The user retrieving the connection history.
  
  @param requiredContents
  The search terms that must be contained somewhere within each of the
  returned records.
  
  @param sortPredicates
  A list of predicates to sort the returned records by, in order of
  priority.
  
  @param limit
  The maximum number of records that should be returned.
  
  @return
  The connection history of the given connection, including any
  active connections.
  
  @throws GuacamoleException
  If permission to read the connection history is denied.