Merge pull request #1167 from sgmap/improve_admin_tasks

Improve super admin management
This commit is contained in:
Mathieu Magnin 2018-01-03 14:31:15 +01:00 committed by GitHub
commit f983fc3ea3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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