Export User Information List


(eriko) #21

Is there a way to access this via the API. Since you can not access the full user list via the api I could use this for my purpose. I need to compare and clean the users on an instance based on and external list.


(Tobias Eigen) #22

@techAPJ would it be possible to add location in the user export? This would help us to identify people by country (we use SSO to populate the location field with the country of the user) so we can alert them about opportunities in their country. As explained in this topic.


(Arpit Jalan) #23

Okay, I added three more fields to user list export: location, website, views. :sunny:


(Tobias Eigen) #24

fabulous. many thanks! :sunflower:


(Tobias Eigen) #25

@techAPJ is the time spent reading recently (as visible in user cards) a number stored in the user table? If so, would you be willing to also add it to the user export?

I’m trying to MVP a way to get this:


(Arpit Jalan) #26

No, it’s not stored in a table. It is calculated at runtime.


(Tobias Eigen) #27

ah - got it. thanks! back to the drawing board, then. :seedling:


(Dmitry Suzdalev) #28

There is no option to export users in current version of discource. I am running version 2.2.0-beta3. Does this mean there are no ways to do that now, or has it moved to some other place?

UPDATE: Sorry, I found this option, was hidden, I had to scroll to see it.


(Aleksandr) #29

How to reduce link lifetime? And delete files * .gz


(Régis Hanol) #30

You can’t. It’s hardcoded to be deleted after 2 days


(Aleksandr) #31

thanks,

class UserExport < ActiveRecord::Base

  def self.remove_old_exports
    UserExport.where('created_at < ?', 2.days.ago).find_each do |user_export|
      upload_id = "#{user_export.upload_id}"
      data = Upload.where(id: upload_id).take
      file_path = "#{UserExport.base_directory}/#{data}"
if data 
      File.delete(file_path) if File.exist?(file_path)
      user_export.destroy!
end

    end
  end

  def self.base_directory
    File.join(Rails.root, "public")
  end

end