Improve super admin management
This commit is contained in:
parent
582b7bf889
commit
4c8c26f250
2 changed files with 26 additions and 0 deletions
11
README.md
11
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]`
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue