clean: log current_user in api v1
This commit is contained in:
parent
c0ca9f156e
commit
7a6658700e
2 changed files with 15 additions and 8 deletions
|
@ -48,14 +48,18 @@ class API::V1::DossiersController < APIController
|
||||||
administrateur = find_administrateur_for_token(@procedure)
|
administrateur = find_administrateur_for_token(@procedure)
|
||||||
if administrateur.nil?
|
if administrateur.nil?
|
||||||
render json: {}, status: :unauthorized
|
render json: {}, status: :unauthorized
|
||||||
|
else
|
||||||
|
# allow BaseController append_info_to_payload
|
||||||
|
# to log info on current_user
|
||||||
|
@current_user = administrateur.user
|
||||||
|
|
||||||
|
order = ORDER_DIRECTIONS.fetch(params[:order], :asc)
|
||||||
|
@dossiers = @procedure
|
||||||
|
.dossiers
|
||||||
|
.visible_by_administration
|
||||||
|
.order_by_created_at(order)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
order = ORDER_DIRECTIONS.fetch(params[:order], :asc)
|
|
||||||
@dossiers = @procedure
|
|
||||||
.dossiers
|
|
||||||
.visible_by_administration
|
|
||||||
.order_by_created_at(order)
|
|
||||||
|
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
render json: {}, status: :not_found
|
render json: {}, status: :not_found
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,8 +13,11 @@ class API::V1::ProceduresController < APIController
|
||||||
administrateur = find_administrateur_for_token(@procedure)
|
administrateur = find_administrateur_for_token(@procedure)
|
||||||
if administrateur.nil?
|
if administrateur.nil?
|
||||||
render json: {}, status: :unauthorized
|
render json: {}, status: :unauthorized
|
||||||
|
else
|
||||||
|
# allow BaseController append_info_to_payload
|
||||||
|
# to log info on current_user
|
||||||
|
@current_user = administrateur.user
|
||||||
end
|
end
|
||||||
|
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
render json: {}, status: :not_found
|
render json: {}, status: :not_found
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue