diff --git a/README.md b/README.md index efc9dfbd6..7975e3ae4 100644 --- a/README.md +++ b/README.md @@ -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]` diff --git a/lib/tasks/admin.rake b/lib/tasks/admin.rake index 93c89183e..60155feb1 100644 --- a/lib/tasks/admin.rake +++ b/lib/tasks/admin.rake @@ -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