From 4c65f066b4ef3a5bca9bb0ea1a4bf4f2a3fb6622 Mon Sep 17 00:00:00 2001 From: Sydney Young Date: Mon, 26 Oct 2015 21:09:44 -0400 Subject: [PATCH] Set cas_login of imported users Resolves #1272 (see PR #1331) --- lib/csv_import.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/csv_import.rb b/lib/csv_import.rb index 54d3a5a03..b6a6e13ac 100644 --- a/lib/csv_import.rb +++ b/lib/csv_import.rb @@ -84,8 +84,13 @@ def import_with_ldap(user_data) # tries to save using only the csv data. This method will return # false if the data specified in the csv is invalid on the user model. def attempt_save_with_csv_data?(user_data) - # use username if using cas, email otherwise - user_data[:username] = user_data[ENV['CAS_AUTH'] ? :username : :email] + if ENV['CAS_AUTH'] + # set the cas login + user_data[:cas_login] = user_data[:username] + else + # set the username + user_data[:username] = user_data[:email] + end user = set_or_create_user_for_import(user_data)