introduce virus scans
This commit is contained in:
parent
f8a2598647
commit
b3956bc072
3 changed files with 10 additions and 5 deletions
|
@ -1,5 +1,6 @@
|
||||||
class Dossier < ApplicationRecord
|
class Dossier < ApplicationRecord
|
||||||
include DossierFilteringConcern
|
include DossierFilteringConcern
|
||||||
|
include VirusScanConcern
|
||||||
|
|
||||||
enum state: {
|
enum state: {
|
||||||
brouillon: 'brouillon',
|
brouillon: 'brouillon',
|
||||||
|
@ -98,6 +99,9 @@ class Dossier < ApplicationRecord
|
||||||
after_save :send_web_hook
|
after_save :send_web_hook
|
||||||
after_create :send_draft_notification_email
|
after_create :send_draft_notification_email
|
||||||
|
|
||||||
|
after_commit :create_dossier_virus_scan
|
||||||
|
after_initialize { add_virus_scan_on(self.justificatif_motivation) }
|
||||||
|
|
||||||
validates :user, presence: true
|
validates :user, presence: true
|
||||||
|
|
||||||
def update_search_terms
|
def update_search_terms
|
||||||
|
@ -413,4 +417,8 @@ class Dossier < ApplicationRecord
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def create_dossier_virus_scan
|
||||||
|
create_virus_scan(self.justificatif_motivation)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
- if dossier.present?
|
- if dossier.present?
|
||||||
- justificatif = dossier.justificatif_motivation
|
- justificatif = dossier.justificatif_motivation
|
||||||
- if dossier.justificatif_motivation.attached?
|
- if dossier.justificatif_motivation.attached? and dossier.virus_scan.safe?
|
||||||
.action
|
.action
|
||||||
= link_to (justificatif), target: '_blank', class: 'button primary' do
|
= link_to (justificatif), target: '_blank', class: 'button primary' do
|
||||||
%span.icon.download
|
%span.icon.download
|
||||||
|
|
|
@ -4,11 +4,8 @@
|
||||||
%th.libelle Déposé le :
|
%th.libelle Déposé le :
|
||||||
%td= l(dossier.en_construction_at, format: '%d %B %Y')
|
%td= l(dossier.en_construction_at, format: '%d %B %Y')
|
||||||
- if dossier.justificatif_motivation.attached?
|
- if dossier.justificatif_motivation.attached?
|
||||||
- justificatif = dossier.justificatif_motivation
|
|
||||||
%tr
|
%tr
|
||||||
%th.libelle Justificatif :
|
%th.libelle Justificatif :
|
||||||
%td
|
%td
|
||||||
.action
|
.action
|
||||||
= link_to url_for(justificatif), target: '_blank', class: 'button primary' do
|
= render partial: 'shared/piece_jointe/pj_link', locals: { object: dossier, pj: dossier.justificatif_motivation }
|
||||||
%span.icon.download
|
|
||||||
Télécharger le justificatif
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue