Merge pull request #2763 from techAPJ/patch-3

Add group names to user export csv
This commit is contained in:
Jeff Atwood 2014-09-06 12:26:00 -07:00
commit d4b8974fd5
1 changed files with 11 additions and 0 deletions

View File

@ -25,7 +25,9 @@ module Jobs
user_data.each do |user| user_data.each do |user|
user_array = Array.new user_array = Array.new
group_names = get_group_names(user).join(';')
user_array.push(user['id']).push(user['name']).push(user['username']).push(user['email']) user_array.push(user['id']).push(user['name']).push(user['username']).push(user['email'])
user_array.push(group_names) if group_names != ''
data.push(user_array) data.push(user_array)
end end
end end
@ -40,6 +42,15 @@ module Jobs
private private
def get_group_names(user)
group_names = []
groups = user.custom_groups
groups.each do |group|
group_names.push(group.name)
end
return group_names
end
def set_file_path def set_file_path
@file_name = "export_#{SecureRandom.hex(4)}.csv" @file_name = "export_#{SecureRandom.hex(4)}.csv"
# ensure directory exists # ensure directory exists