refactor(user): administration -> super_admin
delete_and_keep_track_dossier_also_delete_user is only called by super admin
This commit is contained in:
parent
6a7621b731
commit
9ed42b316f
1 changed files with 3 additions and 3 deletions
|
@ -186,7 +186,7 @@ class User < ApplicationRecord
|
|||
!administrateur? && !instructeur? && !expert?
|
||||
end
|
||||
|
||||
def delete_and_keep_track_dossiers_also_delete_user(administration)
|
||||
def delete_and_keep_track_dossiers_also_delete_user(super_admin)
|
||||
if !can_be_deleted?
|
||||
raise "Cannot delete this user because they are also instructeur, expert or administrateur"
|
||||
end
|
||||
|
@ -195,13 +195,13 @@ class User < ApplicationRecord
|
|||
# delete invites
|
||||
Invite.where(dossier: dossiers).destroy_all
|
||||
|
||||
delete_and_keep_track_dossiers(administration)
|
||||
delete_and_keep_track_dossiers(super_admin)
|
||||
|
||||
destroy!
|
||||
end
|
||||
end
|
||||
|
||||
def delete_and_keep_track_dossiers(administration)
|
||||
def delete_and_keep_track_dossiers(super_admin)
|
||||
transaction do
|
||||
# delete dossiers brouillon
|
||||
dossiers.state_brouillon.each do |dossier|
|
||||
|
|
Loading…
Add table
Reference in a new issue