Prevent expert users to be deleted
This commit is contained in:
parent
3104b4bf17
commit
ea484b879e
1 changed files with 5 additions and 1 deletions
|
@ -162,12 +162,16 @@ class User < ApplicationRecord
|
||||||
instructeur_id.present?
|
instructeur_id.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def expert?
|
||||||
|
expert_id.present?
|
||||||
|
end
|
||||||
|
|
||||||
def can_france_connect?
|
def can_france_connect?
|
||||||
!administrateur? && !instructeur?
|
!administrateur? && !instructeur?
|
||||||
end
|
end
|
||||||
|
|
||||||
def can_be_deleted?
|
def can_be_deleted?
|
||||||
administrateur.nil? && instructeur.nil? && dossiers.with_discarded.state_instruction_commencee.empty?
|
!administrateur? && !instructeur? && !expert? && dossiers.with_discarded.state_instruction_commencee.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete_and_keep_track_dossiers(administration)
|
def delete_and_keep_track_dossiers(administration)
|
||||||
|
|
Loading…
Add table
Reference in a new issue