mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
Story#118912395 - EppLog saves resource
This commit is contained in:
parent
a51f536781
commit
714dd1473d
5 changed files with 21 additions and 2 deletions
|
@ -56,4 +56,8 @@ class Epp::KeyrelaysController < EppController
|
||||||
|
|
||||||
# domain
|
# domain
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def resource
|
||||||
|
@domain
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -54,4 +54,8 @@ class Epp::PollsController < EppController
|
||||||
def validate_poll
|
def validate_poll
|
||||||
requires_attribute 'poll', 'op', values: %(ack req), allow_blank: true
|
requires_attribute 'poll', 'op', values: %(ack req), allow_blank: true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def resource
|
||||||
|
@message
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -137,4 +137,9 @@ class Epp::SessionsController < EppController
|
||||||
pw = params[:parsed_frame].css('pw').first.text
|
pw = params[:parsed_frame].css('pw').first.text
|
||||||
{ username: user, password: pw }
|
{ username: user, password: pw }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def resource
|
||||||
|
@api_user
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,6 +13,7 @@ class EppController < ApplicationController
|
||||||
around_action :catch_epp_errors
|
around_action :catch_epp_errors
|
||||||
|
|
||||||
helper_method :current_user
|
helper_method :current_user
|
||||||
|
helper_method :resource
|
||||||
|
|
||||||
def validate_against_schema
|
def validate_against_schema
|
||||||
return if ['hello', 'error', 'keyrelay'].include?(params[:action])
|
return if ['hello', 'error', 'keyrelay'].include?(params[:action])
|
||||||
|
@ -369,7 +370,7 @@ class EppController < ApplicationController
|
||||||
request: trimmed_request,
|
request: trimmed_request,
|
||||||
request_command: request_command,
|
request_command: request_command,
|
||||||
request_successful: epp_errors.empty?,
|
request_successful: epp_errors.empty?,
|
||||||
request_object: params[:epp_object_type],
|
request_object: resource ? "#{params[:epp_object_type]}: #{resource.class} - #{resource.id} - #{resource.name}" : params[:epp_object_type],
|
||||||
response: @response,
|
response: @response,
|
||||||
api_user_name: @api_user.try(:username) || current_user.try(:username) || 'api-public',
|
api_user_name: @api_user.try(:username) || current_user.try(:username) || 'api-public',
|
||||||
api_user_registrar: @api_user.try(:registrar).try(:to_s) || current_user.try(:registrar).try(:to_s),
|
api_user_registrar: @api_user.try(:registrar).try(:to_s) || current_user.try(:registrar).try(:to_s),
|
||||||
|
@ -385,4 +386,9 @@ class EppController < ApplicationController
|
||||||
return if current_user.blank?
|
return if current_user.blank?
|
||||||
counter_update(current_user.registrar_code, ENV['iptables_server_ip'])
|
counter_update(current_user.registrar_code, ENV['iptables_server_ip'])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def resource
|
||||||
|
name = self.class.to_s.sub("Epp::","").sub("Controller","").underscore.singularize
|
||||||
|
instance_variable_get("@#{name}")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue