Revert "Revert "4127 fix superadmin supprime compte usager""
This reverts commit 751f24f7bb
.
This commit is contained in:
parent
a82cf22b71
commit
cee4c5b8fb
13 changed files with 150 additions and 22 deletions
|
@ -17,9 +17,9 @@ class Instructeur < ApplicationRecord
|
|||
has_many :previously_followed_dossiers, -> { distinct }, through: :previous_follows, source: :dossier
|
||||
has_many :avis
|
||||
has_many :dossiers_from_avis, through: :avis, source: :dossier
|
||||
has_many :trusted_device_tokens
|
||||
has_many :trusted_device_tokens, dependent: :destroy
|
||||
|
||||
has_one :user
|
||||
has_one :user, dependent: :nullify
|
||||
|
||||
default_scope { eager_load(:user) }
|
||||
|
||||
|
@ -176,6 +176,10 @@ class Instructeur < ApplicationRecord
|
|||
trusted_device_token&.token_young?
|
||||
end
|
||||
|
||||
def can_be_deleted?
|
||||
user.administrateur.nil? && procedures.all? { |p| p.defaut_groupe_instructeur.instructeurs.count > 1 }
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def annotations_hash(demande, annotations_privees, avis, messagerie)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue