mirror of
https://github.com/internetee/registry.git
synced 2025-07-03 01:33:36 +02:00
Api log contains only username + refactor #2793
This commit is contained in:
parent
682d2918ce
commit
7f44227370
8 changed files with 33 additions and 42 deletions
|
@ -120,7 +120,7 @@ class EppController < ApplicationController
|
|||
@current_user ||= ApiUser.find_by_id(epp_session[:api_user_id])
|
||||
# by default PaperTrail uses before filter and at that
|
||||
# time current_user is not yet present
|
||||
::PaperTrail.whodunnit = api_user_log_str(@current_user)
|
||||
::PaperTrail.whodunnit = user_log_str(@current_user)
|
||||
::PaperSession.session = epp_session.session_id if epp_session.session_id.present?
|
||||
@current_user
|
||||
end
|
||||
|
@ -350,6 +350,7 @@ class EppController < ApplicationController
|
|||
# rubocop: enable Style/PredicateName
|
||||
|
||||
# rubocop: disable Metrics/CyclomaticComplexity
|
||||
# rubocop: disable Metrics/PerceivedComplexity
|
||||
def write_to_epp_log
|
||||
# return nil if EPP_LOG_ENABLED
|
||||
request_command = params[:command] || params[:action] # error receives :command, other methods receive :action
|
||||
|
@ -366,12 +367,13 @@ class EppController < ApplicationController
|
|||
request_successful: epp_errors.empty?,
|
||||
request_object: params[:epp_object_type],
|
||||
response: @response,
|
||||
api_user_name: api_user_log_str(@api_user || current_user),
|
||||
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),
|
||||
ip: request.ip
|
||||
})
|
||||
end
|
||||
# rubocop: enable Metrics/CyclomaticComplexity
|
||||
# rubocop: enable Metrics/PerceivedComplexity
|
||||
|
||||
def iptables_counter_update
|
||||
return if ENV['iptables_counter_enabled'].blank? && ENV['iptables_counter_enabled'] != 'true'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue