Refactor user to admin and api user

This commit is contained in:
Martin Lensment 2015-02-13 16:17:06 +02:00
parent f3215680d5
commit 037cb57e00
34 changed files with 551 additions and 551 deletions

View file

@ -4,11 +4,11 @@ module Repp
prefix :repp
http_basic do |username, password|
@current_api_user ||= ApiUser.find_by(username: username, password: password)
@current_user ||= ApiUser.find_by(username: username, password: password)
end
helpers do
attr_reader :current_api_user
attr_reader :current_user
end
after do
@ -18,8 +18,8 @@ module Repp
request_params: request.params.except('route_info').to_json,
response: @response.to_json,
response_code: status,
api_user_name: current_api_user.try(:username),
api_user_registrar: current_api_user.try(:registrar).try(:to_s),
api_user_name: current_user.try(:username),
api_user_registrar: current_user.try(:registrar).try(:to_s),
ip: request.ip
})
end