[Fix #1644] In API, current_administrateur -> administrateur

This commit is contained in:
gregoirenovel 2018-03-15 18:07:20 +01:00
parent d2d4015f0d
commit 19a2398593
3 changed files with 5 additions and 5 deletions

View file

@ -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|

View file

@ -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

View file

@ -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