mirror of
https://github.com/internetee/registry.git
synced 2025-05-19 02:39:37 +02:00
Refactor user to admin and api user
This commit is contained in:
parent
f3215680d5
commit
037cb57e00
34 changed files with 551 additions and 551 deletions
|
@ -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
|
||||
|
|
|
@ -5,7 +5,7 @@ module Repp
|
|||
resource :contacts do
|
||||
desc 'Return list of contact'
|
||||
get '/' do
|
||||
contacts = current_api_user.registrar.contacts.page(params[:page])
|
||||
contacts = current_user.registrar.contacts.page(params[:page])
|
||||
@response = {
|
||||
contacts: contacts,
|
||||
total_pages: contacts.total_pages
|
||||
|
|
|
@ -5,7 +5,7 @@ module Repp
|
|||
resource :domains do
|
||||
desc 'Return list of domains'
|
||||
get '/' do
|
||||
domains = current_api_user.registrar.domains.page(params[:page])
|
||||
domains = current_user.registrar.domains.page(params[:page])
|
||||
@response = {
|
||||
domains: domains,
|
||||
total_pages: domains.total_pages
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue