3 # usage: list-inactive-users.rb [n-days-old-to-ignore]
7 abort 'Error: Ruby >= 1.9.3 required.' if RUBY_VERSION < '1.9.3'
9 threshold = ARGV.shift.to_i rescue 7
12 arv = Arvados.new(api_version: 'v1')
15 arv.user.list(where: {is_active: false})[:items].each do |user|
16 if Time.now - Time.parse(user[:created_at]) < threshold*86400
19 puts "Inactive users who first logged in <#{threshold} days ago:"
22 puts "#{user[:modified_at]} #{user[:uuid]} #{user[:full_name]} <#{user[:email]}>"