code: def get(context, request, username=None):
      
      user_ids = []
  
      # Don't allow anonymous users to query a user other than themselves
      if api.is_anonymous():
          username = "current"
  
      # query all users if no username was given
      if username is None:
          user_ids = api.get_member_ids()
      elif username == "current":
          current_user = api.get_current_user()
          user_ids = [current_user.getId()]
      else:
          user_ids = [username]
  
      # Prepare batch
      size = req.get_batch_size()
      start = req.get_batch_start()
      batch = api.make_batch(user_ids, size, start)
  
      # get the user info for the user ids in the current batch
      users = map(get_user_info, batch.get_batch())
  
      return {
          "pagesize": batch.get_pagesize(),
          "next": batch.make_next_url(),
          "previous": batch.make_prev_url(),
          "page": batch.get_pagenumber(),
          "pages": batch.get_numpages(),
          "count": batch.get_sequence_length(),
          "items": users,
      }
docs: Plone users route