Improve super admin management

This commit is contained in:
Mathieu Magnin 2018-01-03 11:45:19 +01:00
parent 582b7bf889
commit 4c8c26f250
2 changed files with 26 additions and 0 deletions

View file

@ -129,3 +129,14 @@ Pour exécuter les tests de l'application, plusieurs possibilités :
bundle binstub railties --force
rake rails:update:bin
## Tâches Super Admin
- ajouter un compte super admin :
`bundle exec rake admin:create_admin[email-du-compte-github@exemple.com]`
- lister les comptes super admin :
`bundle exec rake admin:list`
- supprimer un compte super admin :
`bundle exec rake admin:delete_admin[email-du-compte-github@exemple.com]`

View file

@ -9,4 +9,19 @@ namespace :admin do
puts "An error occured : #{a.errors.full_messages}"
end
end
task list: :environment do
puts "All Administrations :"
Administration.all.pluck(:email).each do |a|
puts a
end
end
task :delete_admin, [:email] => :environment do |t, args|
email = args[:email]
puts "Deleting Administration for #{email}"
a = Administration.find_by(email: email)
a.destroy
puts "#{a.email} deleted"
end
end