a procedure has an encrypted api_particulier_token
Co-authored-by: François VANTOMME <akarzim@gmail.com>
This commit is contained in:
parent
66c35fdffe
commit
b29bae4707
4 changed files with 28 additions and 8 deletions
|
@ -18,6 +18,7 @@
|
|||
# duree_conservation_dossiers_dans_ds :integer
|
||||
# duree_conservation_dossiers_hors_ds :integer
|
||||
# durees_conservation_required :boolean default(TRUE)
|
||||
# encrypted_api_particulier_token :string
|
||||
# euro_flag :boolean default(FALSE)
|
||||
# experts_require_administrateur_invitation :boolean default(FALSE)
|
||||
# for_individual :boolean default(FALSE)
|
||||
|
@ -47,6 +48,7 @@
|
|||
|
||||
class Procedure < ApplicationRecord
|
||||
include ProcedureStatsConcern
|
||||
include EncryptableConcern
|
||||
|
||||
include Discard::Model
|
||||
self.discard_column = :hidden_at
|
||||
|
@ -56,6 +58,9 @@ class Procedure < ApplicationRecord
|
|||
MAX_DUREE_CONSERVATION_EXPORT = 3.hours
|
||||
|
||||
MIN_WEIGHT = 350000
|
||||
|
||||
attr_encrypted :api_particulier_token
|
||||
|
||||
has_many :revisions, -> { order(:id) }, class_name: 'ProcedureRevision', inverse_of: :procedure
|
||||
belongs_to :draft_revision, class_name: 'ProcedureRevision', optional: false
|
||||
belongs_to :published_revision, class_name: 'ProcedureRevision', optional: true
|
||||
|
@ -262,6 +267,7 @@ class Procedure < ApplicationRecord
|
|||
if: -> { new_record? || created_at > Date.new(2020, 11, 13) }
|
||||
|
||||
validates :api_entreprise_token, jwt_token: true, allow_blank: true
|
||||
validates :api_particulier_token, format: { with: /\A[A-Za-z0-9\-_=.]{15,}\z/, message: "n'est pas un jeton valide" }, allow_blank: true
|
||||
|
||||
before_save :update_juridique_required
|
||||
after_initialize :ensure_path_exists
|
||||
|
@ -440,6 +446,7 @@ class Procedure < ApplicationRecord
|
|||
if is_different_admin
|
||||
procedure.administrateurs = [admin]
|
||||
procedure.api_entreprise_token = nil
|
||||
procedure.encrypted_api_particulier_token = nil
|
||||
else
|
||||
procedure.administrateurs = administrateurs
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue