mirror of
https://github.com/internetee/registry.git
synced 2025-06-09 22:24:47 +02:00
Merge remote-tracking branch 'origin/master' into repp-domains
This commit is contained in:
commit
43e5b74668
29 changed files with 357 additions and 49 deletions
|
@ -3,6 +3,7 @@ module Repp
|
|||
module V1
|
||||
class DomainsController < BaseController # rubocop:disable Metrics/ClassLength
|
||||
before_action :set_authorized_domain, only: %i[transfer_info destroy]
|
||||
before_action :validate_registrar_authorization, only: %i[transfer_info destroy]
|
||||
before_action :forward_registrar_id, only: %i[create destroy]
|
||||
before_action :set_domain, only: %i[show update]
|
||||
|
||||
|
@ -182,11 +183,7 @@ module Repp
|
|||
|
||||
def set_authorized_domain
|
||||
@epp_errors ||= []
|
||||
h = {}
|
||||
h[transfer_info_params[:id].match?(/\A[0-9]+\z/) ? :id : :name] = transfer_info_params[:id]
|
||||
@domain = Epp::Domain.find_by!(h)
|
||||
|
||||
validate_registrar_authorization
|
||||
@domain = domain_from_url_hash
|
||||
end
|
||||
|
||||
def validate_registrar_authorization
|
||||
|
@ -197,6 +194,13 @@ module Repp
|
|||
handle_errors
|
||||
end
|
||||
|
||||
def domain_from_url_hash
|
||||
entry = transfer_info_params[:id]
|
||||
return Domain.find(entry) if entry.match?(/\A[0-9]+\z/)
|
||||
|
||||
Domain.find_by!('name = ? OR name_puny = ?', entry, entry)
|
||||
end
|
||||
|
||||
def limit
|
||||
index_params[:limit] || 200
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue