Skip to content

Commit

Permalink
fixed rubocop offenses
Browse files Browse the repository at this point in the history
  • Loading branch information
SilentFlameCR committed Nov 27, 2023
1 parent c8ab72b commit 919b4a9
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions lib/tasks/user.rake
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,25 @@ namespace :user do

desc 'Set user role to Administrator'
task :set_admin_role, %i[email] => :environment do |_task, args|
email = args[:email]

if email.blank?
info 'Please provide an email address of the user you wish to set to Administrator role.'
else
user = User.find_by(email: email, provider: 'greenlight')
if user
role = Role.find_by(name: 'Administrator', provider: 'greenlight')
if role
user.role = role
user.save!
success "User role set to Administrator for email: #{email}"
else
info "Role 'Administrator' not found for provider 'greenlight'"
end
email = args[:email]

if email.blank?
info 'Please provide an email address of the user you wish to set to Administrator role.'
else
user = User.find_by(email:, provider: 'greenlight')
if user
role = Role.find_by(name: 'Administrator', provider: 'greenlight')
if role
user.role = role
user.save!
success "User role set to Administrator for email: #{email}"
else
info "User with email: #{email} not found"
info "Role 'Administrator' not found for provider 'greenlight'"
end
else
info "User with email: #{email} not found"
end
end
end

private
Expand Down

0 comments on commit 919b4a9

Please sign in to comment.