Skip to content

Commit

Permalink
Merge pull request #138 from etalab/ops/bugfixes
Browse files Browse the repository at this point in the history
Multiple bugfixes
  • Loading branch information
skelz0r authored Apr 3, 2024
2 parents 8002a44 + 67bac8b commit e610e27
Show file tree
Hide file tree
Showing 32 changed files with 185 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Instruction::AuthorizationRequestEventsController < Instruction::Authoriza
def index
authorize [:instruction, @authorization_request], :show?

@events = @authorization_request.events.includes(%i[user entity]).order(created_at: :desc).decorate
@events = @authorization_request.events.order(created_at: :desc).decorate
end

private
Expand Down
2 changes: 1 addition & 1 deletion app/interactors/deliver_authorization_request_webhook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def webhook_payload
WebhookSerializer.new(
context.authorization_request,
context.state_machine_event || context.event_name
).serializable_hash
).to_json
end

def target_api = context.authorization_request.definition.id
Expand Down
8 changes: 6 additions & 2 deletions app/jobs/deliver_authorization_request_webhook_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class DeliverAuthorizationRequestWebhookJob < ApplicationJob

class WebhookDeliveryFailedError < StandardError; end

retry_on(WebhookDeliveryFailedError, wait: :polynomially_longer)
retry_on(WebhookDeliveryFailedError, wait: :polynomially_longer, attempts: :unlimited)

def serialize
super.merge('tries_count' => (@attempts || 1) + 1)
Expand Down Expand Up @@ -32,7 +32,7 @@ def perform(target_api, json, authorization_request_id)
private

def request(target_api, payload)
Faraday.new(webhook_url(target_api)).post('/webhook') do |req|
Faraday.new(webhook_uri(target_api).to_s).post(webhook_uri(target_api).path) do |req|
req.headers['Content-Type'] = 'application/json'
req.headers['X-Hub-Signature-256'] = "sha256=#{generate_hub_signature(target_api, payload)}"
req.body = payload.to_json
Expand Down Expand Up @@ -95,6 +95,10 @@ def generate_hub_signature(target_api, payload)
)
end

def webhook_uri(target_api)
URI(webhook_url(target_api))
end

def webhook_url(target_api)
Rails.application.credentials.webhooks.public_send(target_api)&.url
end
Expand Down
5 changes: 5 additions & 0 deletions app/models/authorization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ class Authorization < ApplicationRecord
inverse_of: :authorization,
dependent: :destroy

has_many :events,
class_name: 'AuthorizationRequestEvent',
inverse_of: :entity,
dependent: :destroy

delegate :name, to: :request

def kind
Expand Down
12 changes: 11 additions & 1 deletion app/models/authorization_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ class AuthorizationRequest < ApplicationRecord
inverse_of: :authorization_request,
dependent: :destroy

has_many :instructor_modification_requests,
class_name: 'InstructorModificationRequest',
inverse_of: :authorization_request,
dependent: :destroy

has_one :denial,
-> { order(created_at: :desc) },
class_name: 'DenialOfAuthorization',
Expand All @@ -40,11 +45,16 @@ class AuthorizationRequest < ApplicationRecord
has_many :authorizations,
class_name: 'Authorization',
inverse_of: :request,
dependent: :nullify
dependent: :destroy

has_many :messages,
dependent: :destroy

has_many :events,
class_name: 'AuthorizationRequestEvent',
inverse_of: :entity,
dependent: :destroy

def latest_authorization
authorizations.order(created_at: :desc).limit(1).first
end
Expand Down
5 changes: 5 additions & 0 deletions app/models/authorization_request_changelog.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
class AuthorizationRequestChangelog < ApplicationRecord
belongs_to :authorization_request

has_many :events,
class_name: 'AuthorizationRequestEvent',
inverse_of: :entity,
dependent: :destroy
end
5 changes: 5 additions & 0 deletions app/models/denial_of_authorization.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
class DenialOfAuthorization < ApplicationRecord
validates :reason, presence: true
belongs_to :authorization_request

has_many :events,
class_name: 'AuthorizationRequestEvent',
inverse_of: :entity,
dependent: :destroy
end
5 changes: 5 additions & 0 deletions app/models/instructor_modification_request.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
class InstructorModificationRequest < ApplicationRecord
validates :reason, presence: true
belongs_to :authorization_request

has_many :events,
class_name: 'AuthorizationRequestEvent',
inverse_of: :entity,
dependent: :destroy
end
5 changes: 5 additions & 0 deletions app/models/message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ class Message < ApplicationRecord
class_name: 'User',
optional: true

has_many :events,
class_name: 'AuthorizationRequestEvent',
inverse_of: :entity,
dependent: :destroy

belongs_to :authorization_request

scope :unread, -> { where(read_at: nil) }
Expand Down
4 changes: 4 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ def instructor?(authorization_request_type = nil)
end
end

def admin?
roles.include?('admin')
end

def authorization_definition_roles_as(kind)
roles.select { |role| role.end_with?(":#{kind}") }.map do |role|
AuthorizationDefinition.find(role.split(':').first)
Expand Down
1 change: 1 addition & 0 deletions app/queries/authorization_request_events_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def initialize(authorization_request)
# rubocop:disable Metrics/AbcSize
def perform
AuthorizationRequestEvent
.includes(%i[user entity])
.where(
sql_query,
authorization_request.id,
Expand Down
28 changes: 24 additions & 4 deletions app/serializers/webhook_authorization_request_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ class WebhookAuthorizationRequestSerializer < ApplicationSerializer
:status,
:siret,
:scopes,
:team_members,
:previous_authorization_request_id,
:copied_from_authorization_request_id

has_many(:contacts, serializer: ContactSerializer)
has_many(:events, serializer: WebhookEventSerializer) do
object.events.map(&:decorate)
end
Expand All @@ -18,9 +18,29 @@ class WebhookAuthorizationRequestSerializer < ApplicationSerializer
object.scopes.to_h { |scope| [scope.to_sym, true] }
end

def demarche = object.form.name
def status = object.state
def siret = object.organization.siret
def intitule = object.data['intitule']
def description = object.data['description']
def demarche = object.form.id
def status = object.state
def siret = object.organization.siret

def team_members
object.contacts.map { |contact|
ContactSerializer.new(contact).serializable_hash
} << applicant_as_team_member
end

def applicant_as_team_member
{
id: nil,
type: 'demandeur',
email: object.applicant.email,
given_name: object.applicant.given_name,
family_name: object.applicant.family_name,
phone_number: object.applicant.phone_number,
job: object.applicant.job_title,
}
end

def previous_authorization_request_id = nil
def copied_from_authorization_request_id = nil
Expand Down
6 changes: 4 additions & 2 deletions app/serializers/webhook_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ def to_json(*_args)
private

def model_type
authorization_request.class.name.underscore
"enrollment/#{authorization_request.type.underscore.split('/').last}"
end

def now
@now ||= Time.zone.now
end

def authorization_request_serialized
WebhookAuthorizationRequestSerializer.new(authorization_request).serializable_hash
WebhookAuthorizationRequestSerializer.new(authorization_request).serializable_hash(
include: ['events.user']
)
end
end
2 changes: 1 addition & 1 deletion app/serializers/webhook_user_with_profile_serializer.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class WebhookUserWithProfileSerializer < ApplicationSerializer
attributes :id, :uid, :email, :given_name, :family_name, :phone_number, :job_title

def uid = nil
def uid = object.external_id
end
2 changes: 1 addition & 1 deletion app/views/mailer/shared/applicant/_header.text.erb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= t('.text', entity_name:) %>
<%= [t('.text'), entity_name].compact.join(" ") %>,
10 changes: 5 additions & 5 deletions config/authorization_request_forms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ shared:
destinataire_donnees_caractere_personnel: "Services marchés d’organismes publics et collectivités locales"
duree_conservation_donnees_caractere_personnel: 36
contact_metier_type: 'organization'
contact_metier_email: "p.gue@e-attestations.com"
contact_metier_email: "<%= Rails.application.credentials.api_entreprise_e_attestation_contact_metier_email || 'metier-e-attestation@yopmail.com' %>"
contact_metier_phone_number: "0158060016"
contact_technique_type: 'organization'
contact_technique_email: "tech@e-attestations.com"
contact_technique_email: "<%= Rails.application.credentials.api_entreprise_e_attestation_contact_technique_email || 'tech-e-attestation@yopmail.com' %>"
contact_technique_phone_number: "0158060010"
scopes:
- unites_legales_etablissements_insee
Expand Down Expand Up @@ -225,10 +225,10 @@ shared:
destinataire_donnees_caractere_personnel: "Maître d’ouvrage, acheteurs publics dans le cadre de leurs contrôles de la régularité fiscale et sociale des entreprises"
duree_conservation_donnees_caractere_personnel: 36
contact_metier_type: 'organization'
contact_metier_email: "<%= Rails.application.credentials.api_entreprise_achat_solution_contact_metier_email || 'metier@achat-solution.com' %>"
contact_metier_email: "<%= Rails.application.credentials.api_entreprise_achat_solution_contact_metier_email || 'metier-achat-solution@yopmail.com' %>"
contact_metier_phone_number: "<%= Rails.application.credentials.api_entreprise_achat_solution_contact_metier_phone_number || '0836656565' %>"
contact_technique_type: 'organization'
contact_technique_email: "<%= Rails.application.credentials.api_entreprise_achat_solution_contact_technique_email || 'metier@achat-solution.com' %>"
contact_technique_email: "<%= Rails.application.credentials.api_entreprise_achat_solution_contact_technique_email || 'metier-achat-solution@yopmail.com' %>"
contact_technique_phone_number: "<%= Rails.application.credentials.api_entreprise_achat_solution_contact_technique_phone_number || '0836656565' %>"
scopes:
- unites_legales_etablissements_insee
Expand Down Expand Up @@ -305,7 +305,7 @@ La plateforme, mise en place pour permettre le dépôt de ces aides publiques et
contact_technique_email: '[email protected]'
contact_technique_phone_number: '0175440934'
contact_metier_type: 'organization'
contact_metier_email: "<%= Rails.application.credentials.api_entreprise_atexo_contact_metier_email || 'produit@atexo.com' %>"
contact_metier_email: "<%= Rails.application.credentials.api_entreprise_atexo_contact_metier_email || 'produit-atexo@yopmail.com' %>"
contact_metier_phone_number: '0153430678'
scopes:
- unites_legales_etablissements_insee
Expand Down
2 changes: 1 addition & 1 deletion config/credentials/production.yml.enc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
UGK9Y/kPNvyArcvaTMg/WP1vgGvJOXtAmBvi7h3y+3GYutCFNTTca3AaBhjB1bgaw8xHe6Qhu9PSNxRL8/LwjlQ8zwmLSOr38NBso9jSc1Wt4oaLzkEuS6lleLpczbTlqsQ1Uswunx2RzSP8vRD1U3Wr9x9GC+oZVWP5MV+TU16aszwftMoFyjT7F67L+i3Za4M4mAHBwwpk9A8ZhI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I9Mzw==
2 changes: 1 addition & 1 deletion config/environments/sandbox.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
# config.cache_store = :mem_cache_store

# Use a real queuing backend for Active Job (and separate queues per environment).
# config.active_job.queue_adapter = :resque
config.active_job.queue_adapter = :good_job
# config.active_job.queue_name_prefix = "data_pass_production"

config.action_mailer.delivery_method = :mailjet
Expand Down
2 changes: 1 addition & 1 deletion config/environments/staging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
# config.cache_store = :mem_cache_store

# Use a real queuing backend for Active Job (and separate queues per environment).
# config.active_job.queue_adapter = :resque
config.active_job.queue_adapter = :good_job
# config.active_job.queue_name_prefix = "data_pass_production"

config.action_mailer.delivery_method = :mailjet
Expand Down
3 changes: 3 additions & 0 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
Bullet.enable = true
Bullet.bullet_logger = true
Bullet.raise = true # raise an error if n+1 query occurs

Bullet.add_safelist type: :unused_eager_loading, class_name: 'AuthorizationRequestEvent', association: :entity
Bullet.add_safelist type: :unused_eager_loading, class_name: 'AuthorizationRequestEvent', association: :user
end

# Settings specified here will take precedence over those in config/application.rb.
Expand Down
9 changes: 9 additions & 0 deletions config/initializers/good_job.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ActiveSupport.on_load(:good_job_application_controller) do
include Authentication

allow_unauthenticated_access

before_action do
raise ActionController::RoutingError.new('Not Found') unless current_user&.admin?
end
end
2 changes: 1 addition & 1 deletion config/initializers/sentry.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Sentry.init do |config|
config.dsn = Rails.application.credentials.sentry_dsn
config.breadcrumbs_logger = [:sentry_logger, :active_support_logger, :http_logger]
config.enabled_environments = %w[sandbox production]
config.enabled_environments = %w[sandbox staging production]

config.traces_sample_rate = 1.0
end
2 changes: 1 addition & 1 deletion config/locales/mailer.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fr:
email: [email protected]
applicant:
header:
text: <%= ["Bonjour", entity_name].compact.join(" ") %>,
text: 'Bonjour'
footer:
text: L'équipe %{authorization_definition_name}
instruction:
Expand Down
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,6 @@
resources :messages, only: %w[index create], path: 'messages'
end
end

mount GoodJob::Engine => '/workers'
end
1 change: 0 additions & 1 deletion features/instruction/historique_habilitation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Fonctionnalité: Instruction: historique habilitation
Sachant que je suis un instructeur "API Entreprise"
Et que je me connecte

@DisableBullet
Scénario: Je vois les événements
Quand je me rends sur une demande d'habilitation "API Entreprise" à modérer
Et je clique sur "Valider"
Expand Down
3 changes: 0 additions & 3 deletions features/instruction/modérer_une_habilitation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ Fonctionnalité: Instruction: modération
Et il n'y a pas de champ éditable

@AvecCourriels
@DisableBullet
Scénario: Je valide une demande d'habilitation
Quand je me rends sur une demande d'habilitation "API Entreprise" à modérer
Et je clique sur "Valider"
Expand All @@ -27,7 +26,6 @@ Fonctionnalité: Instruction: modération
Et il y a un message de succès contenant "a été validé"

@AvecCourriels
@DisableBullet
Scénario: Je refuse une demande d'habilitation avec un message valide
Quand je me rends sur une demande d'habilitation "API Entreprise" à modérer
Et je clique sur "Refuser"
Expand All @@ -45,7 +43,6 @@ Fonctionnalité: Instruction: modération
Alors il y a au moins une erreur sur un champ

@AvecCourriels
@DisableBullet
Scénario: Je demande des modifications sur une demande d'habilitation avec un message valide
Quand je me rends sur une demande d'habilitation "API Entreprise" à modérer
Et je clique sur "Demander des modifications"
Expand Down
7 changes: 4 additions & 3 deletions features/step_definitions/authorization_requests_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,12 @@
authorization_request = AuthorizationRequest.first

webhook_job = ActiveJob::Base.queue_adapter.enqueued_jobs.find do |job|
job['job_class'] == 'DeliverAuthorizationRequestWebhookJob' &&
job.dig('arguments', 1, 'event', 'value') == event_name
next unless job['job_class'] == 'DeliverAuthorizationRequestWebhookJob'

JSON.parse(job['arguments'][1])['event'] == event_name
end

webhook_job_arg = [authorization_request.definition.id, an_instance_of(Hash), authorization_request.id]
webhook_job_arg = [authorization_request.definition.id, an_instance_of(String), authorization_request.id]

expect(webhook_job).not_to be_nil

Expand Down
Loading

0 comments on commit e610e27

Please sign in to comment.