diff --git a/app/controllers/api/v1/dossiers_controller.rb b/app/controllers/api/v1/dossiers_controller.rb index b275f41b2..a446570da 100644 --- a/app/controllers/api/v1/dossiers_controller.rb +++ b/app/controllers/api/v1/dossiers_controller.rb @@ -13,7 +13,7 @@ class API::V1::DossiersController < APIController error code: 404, desc: "Procédure inconnue" def index - procedure = current_administrateur.procedures.find(params[:procedure_id]) + procedure = administrateur.procedures.find(params[:procedure_id]) dossiers = procedure.dossiers.state_not_brouillon.page(params[:page]).per(per_page) render json: { dossiers: dossiers.map{ |dossier| DossiersSerializer.new(dossier) }, pagination: pagination(dossiers) }, status: 200 @@ -28,7 +28,7 @@ class API::V1::DossiersController < APIController error code: 404, desc: "Procédure ou dossier inconnu" def show - procedure = current_administrateur.procedures.find(params[:procedure_id]) + procedure = administrateur.procedures.find(params[:procedure_id]) dossier = procedure.dossiers.find(params[:id]) respond_to do |format| diff --git a/app/controllers/api/v1/procedures_controller.rb b/app/controllers/api/v1/procedures_controller.rb index f983b9d21..54cf5c94c 100644 --- a/app/controllers/api/v1/procedures_controller.rb +++ b/app/controllers/api/v1/procedures_controller.rb @@ -9,7 +9,7 @@ class API::V1::ProceduresController < APIController error code: 404, desc: "Procédure inconnue" def show - procedure = current_administrateur.procedures.find(params[:id]).decorate + procedure = administrateur.procedures.find(params[:id]).decorate render json: { procedure: ProcedureSerializer.new(procedure).as_json } rescue ActiveRecord::RecordNotFound => e diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index d1ab966a5..e387c3b69 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -19,10 +19,10 @@ class APIController < ApplicationController protected def valid_token? - current_administrateur.present? + administrateur.present? end - def current_administrateur + def administrateur @administrateur ||= (authenticate_with_bearer_token || authenticate_with_param_token) end