Merge pull request #6095 from tchak/improuve-user-destruction
Users that are experts should not be deletable
This commit is contained in:
commit
f6c704d44d
1 changed files with 5 additions and 1 deletions
|
@ -162,12 +162,16 @@ class User < ApplicationRecord
|
|||
instructeur_id.present?
|
||||
end
|
||||
|
||||
def expert?
|
||||
expert_id.present?
|
||||
end
|
||||
|
||||
def can_france_connect?
|
||||
!administrateur? && !instructeur?
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
def delete_and_keep_track_dossiers(administration)
|
||||
|
|
Loading…
Reference in a new issue