mirror of
https://github.com/internetee/registry.git
synced 2025-08-01 23:42:04 +02:00
Merge branch 'master' into 108869472-objects_archive
This commit is contained in:
commit
305333d6c9
29 changed files with 202 additions and 142 deletions
|
@ -10,21 +10,13 @@ class Admin::ContactsController < AdminController
|
|||
search_params[:registrant_domains_id_not_null] = 1
|
||||
end
|
||||
|
||||
@q = Contact.includes(:registrar).joins(:registrar).select('contacts.*, registrars.name').search(search_params)
|
||||
@contacts = @q.result(distinct: :true).page(params[:page])
|
||||
|
||||
if params[:statuses_contains]
|
||||
contacts = Contact.includes(:registrar).joins(:registrar).select('contacts.*, registrars.name').where(
|
||||
"contacts.statuses @> ?::varchar[]", "{#{params[:statuses_contains].join(',')}}"
|
||||
)
|
||||
else
|
||||
contacts = Contact.includes(:registrar).joins(:registrar).select('contacts.*, registrars.name')
|
||||
end
|
||||
contacts = Contact.includes(:registrar).joins(:registrar).select('contacts.*, registrars.name')
|
||||
contacts = contacts.filter_by_states(params[:statuses_contains].join(',')) if params[:statuses_contains]
|
||||
contacts = contacts.where("ident_country_code is null or ident_country_code=''") if params[:only_no_country_code].eql?('1')
|
||||
|
||||
|
||||
normalize_search_parameters do
|
||||
@q = contacts.includes(:registrar).joins(:registrar).select('contacts.*, registrars.name').search(search_params)
|
||||
@q = contacts.search(search_params)
|
||||
@contacts = @q.result.uniq.page(params[:page])
|
||||
end
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ class Admin::SettingsController < AdminController
|
|||
:admin_contacts_max_count,
|
||||
:tech_contacts_min_count,
|
||||
:tech_contacts_max_count,
|
||||
:orphans_contacts_in_months,
|
||||
:ds_digest_type,
|
||||
:dnskeys_min_count,
|
||||
:dnskeys_max_count,
|
||||
|
|
|
@ -56,4 +56,8 @@ class Epp::KeyrelaysController < EppController
|
|||
|
||||
# domain
|
||||
end
|
||||
|
||||
def resource
|
||||
@domain
|
||||
end
|
||||
end
|
||||
|
|
|
@ -54,4 +54,8 @@ class Epp::PollsController < EppController
|
|||
def validate_poll
|
||||
requires_attribute 'poll', 'op', values: %(ack req), allow_blank: true
|
||||
end
|
||||
|
||||
def resource
|
||||
@message
|
||||
end
|
||||
end
|
||||
|
|
|
@ -137,4 +137,9 @@ class Epp::SessionsController < EppController
|
|||
pw = params[:parsed_frame].css('pw').first.text
|
||||
{ username: user, password: pw }
|
||||
end
|
||||
|
||||
private
|
||||
def resource
|
||||
@api_user
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,8 +6,15 @@ class EppController < ApplicationController
|
|||
|
||||
before_action :generate_svtrid
|
||||
before_action :latin_only
|
||||
|
||||
before_action :validate_against_schema
|
||||
before_action :validate_request
|
||||
before_action :update_epp_session
|
||||
|
||||
around_action :catch_epp_errors
|
||||
|
||||
helper_method :current_user
|
||||
helper_method :resource
|
||||
|
||||
def validate_against_schema
|
||||
return if ['hello', 'error', 'keyrelay'].include?(params[:action])
|
||||
schema.validate(params[:nokogiri_frame]).each do |error|
|
||||
|
@ -20,10 +27,7 @@ class EppController < ApplicationController
|
|||
handle_errors and return if epp_errors.any?
|
||||
end
|
||||
|
||||
before_action :validate_request
|
||||
before_action :update_epp_session
|
||||
|
||||
around_action :catch_epp_errors
|
||||
def catch_epp_errors
|
||||
err = catch(:epp_error) do
|
||||
yield
|
||||
|
@ -34,7 +38,6 @@ class EppController < ApplicationController
|
|||
handle_errors
|
||||
end
|
||||
|
||||
helper_method :current_user
|
||||
|
||||
rescue_from StandardError do |e|
|
||||
@errors ||= []
|
||||
|
@ -367,7 +370,7 @@ class EppController < ApplicationController
|
|||
request: trimmed_request,
|
||||
request_command: request_command,
|
||||
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,
|
||||
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),
|
||||
|
@ -383,4 +386,9 @@ class EppController < ApplicationController
|
|||
return if current_user.blank?
|
||||
counter_update(current_user.registrar_code, ENV['iptables_server_ip'])
|
||||
end
|
||||
|
||||
def resource
|
||||
name = self.class.to_s.sub("Epp::","").sub("Controller","").underscore.singularize
|
||||
instance_variable_get("@#{name}")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -42,13 +42,8 @@ class Registrar::ContactsController < Registrar::DeppController # EPP controller
|
|||
@contacts = Contact.find_by(name: params[:q][:name_matches])
|
||||
end
|
||||
|
||||
if params[:statuses_contains]
|
||||
contacts = current_user.registrar.contacts.includes(:registrar).where(
|
||||
"contacts.statuses @> ?::varchar[]", "{#{params[:statuses_contains].join(',')}}"
|
||||
)
|
||||
else
|
||||
contacts = current_user.registrar.contacts.includes(:registrar)
|
||||
end
|
||||
contacts = current_user.registrar.contacts.includes(:registrar)
|
||||
contacts = contacts.filter_by_states(params[:statuses_contains]) if params[:statuses_contains]
|
||||
|
||||
normalize_search_parameters do
|
||||
@q = contacts.search(params[:q])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue