diff --git a/app/controllers/users/carte_controller.rb b/app/controllers/users/carte_controller.rb index 258299254..032883703 100644 --- a/app/controllers/users/carte_controller.rb +++ b/app/controllers/users/carte_controller.rb @@ -59,7 +59,7 @@ class Users::CarteController < UsersController def self.route_authorization { - states: [:brouillon, :en_construction], + states: [Dossier.states.fetch(:brouillon), Dossier.states.fetch(:en_construction)], api_carto: true } end diff --git a/app/controllers/users/dossiers_controller.rb b/app/controllers/users/dossiers_controller.rb index e62ef80b0..28d85cf8f 100644 --- a/app/controllers/users/dossiers_controller.rb +++ b/app/controllers/users/dossiers_controller.rb @@ -149,7 +149,7 @@ class Users::DossiersController < UsersController def self.route_authorization { - states: [:brouillon] + states: [Dossier.states.fetch(:brouillon)] } end diff --git a/app/controllers/users/recapitulatif_controller.rb b/app/controllers/users/recapitulatif_controller.rb index b8b7fb03a..d0657b72e 100644 --- a/app/controllers/users/recapitulatif_controller.rb +++ b/app/controllers/users/recapitulatif_controller.rb @@ -18,7 +18,13 @@ class Users::RecapitulatifController < UsersController def self.route_authorization { - states: [:en_construction, :en_instruction, :sans_suite, :accepte, :refuse] + states: [ + Dossier.states.fetch(:en_construction), + Dossier.states.fetch(:en_instruction), + Dossier.states.fetch(:sans_suite), + Dossier.states.fetch(:accepte), + Dossier.states.fetch(:refuse) + ] } end diff --git a/app/services/user_routes_authorization_service.rb b/app/services/user_routes_authorization_service.rb index a60c5b415..9fc85c97b 100644 --- a/app/services/user_routes_authorization_service.rb +++ b/app/services/user_routes_authorization_service.rb @@ -2,7 +2,7 @@ class UserRoutesAuthorizationService def self.authorized_route?(controller, dossier) auth = controller.route_authorization - auth[:states].include?(dossier.state.to_sym) && + auth[:states].include?(dossier.state) && (auth[:api_carto].nil? ? true : auth[:api_carto] == dossier.procedure.use_api_carto) end end