demarches-normaliennes/lib/tasks/deployment/20210409131949_populate_bypass_email_login.rake
2021-04-13 09:43:38 +02:00

18 lines
589 B
Ruby

namespace :after_party do
desc 'Deployment task: populate_bypass_email_login'
task populate_bypass_email_login: :environment do
user_ids = Flipper::Adapters::ActiveRecord::Gate
.where(feature_key: 'instructeur_bypass_email_login_token')
.pluck(:value)
.filter { |s| s.start_with?('User:') }
.map { |s| s.gsub('User:', '') }
.map(&:to_i)
Instructeur
.where(user: { id: user_ids })
.update_all(bypass_email_login_token: true)
AfterParty::TaskRecord
.create version: AfterParty::TaskRecorder.new(__FILE__).timestamp
end
end