diff --git a/lib/tasks/update_users_sso.rake b/lib/tasks/update_users_sso.rake new file mode 100644 index 00000000..7daaf958 --- /dev/null +++ b/lib/tasks/update_users_sso.rake @@ -0,0 +1,18 @@ +require 'rake' + +namespace :gwss do + # To be used for migrating user records for GW users that do not + desc "Updates user records for use with SSO" + + task :update_users_sso => :environment do + # Regex to match GW email address patterns + gw_email = /@((gwmail|email).)*gwu.edu/ + User.find_each do |user| + if gw_email.match(user.email) + user.uid = user.email + user.provider = "saml" + user.save + end + end + end +end \ No newline at end of file