Fix redirection routes for gestionnaires and users with double devise profile

This commit is contained in:
Xavier J 2016-12-05 16:17:24 +01:00
parent bdd51ce02b
commit cc532f74f9
2 changed files with 13 additions and 6 deletions

View file

@ -3,8 +3,9 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
def index
super
procedure = dossiers_list_facade.gestionnaire_procedures_name_and_id_list.first
redirect_to backoffice_dossiers_procedure_path(id: procedure[:id])
procedure = current_gestionnaire.procedure_filter || dossiers_list_facade.gestionnaire_procedures_name_and_id_list.first[:id]
redirect_to backoffice_dossiers_procedure_path(id: procedure)
end
def show

View file

@ -1,11 +1,17 @@
class RootController < ApplicationController
def index
if user_signed_in?
redirect_to users_dossiers_path
route = Rails.application.routes.recognize_path(request.referrer)
elsif gestionnaire_signed_in?
redirect_to backoffice_dossiers_path
unless route[:controller].match('users').nil?
return redirect_to users_dossiers_path
end
if gestionnaire_signed_in?
redirect_to backoffice_dossiers_procedure_path(id: current_gestionnaire.procedure_filter)
elsif user_signed_in?
redirect_to users_dossiers_path
elsif administrateur_signed_in?
redirect_to admin_procedures_path