request and response have the same domain schema

This commit is contained in:
Oleg Hasjanov 2021-06-22 12:59:56 +03:00
parent 230fb301a7
commit 6f431232f4
7 changed files with 28 additions and 8 deletions

View file

@ -4,6 +4,7 @@ module Epp
before_action :find_domain, only: %i[info renew update transfer delete]
before_action :find_password, only: %i[info update transfer delete]
before_action :set_paper_trail_whodunnit
before_action :parse_schemas_prefix_and_version
def info
authorize! :info, @domain
@ -243,5 +244,14 @@ module Epp
end
true
end
def parse_schemas_prefix_and_version
return unless params[:frame]
xml = params[:frame].gsub!(/(?<=>)(.*?)(?=<)/, &:strip).to_s
res = xml.match(/xmlns:domain=\"https:\/\/epp.tld.ee\/schema\/(?<prefix>\w+-\w+)-(?<version>\w.\w).xsd/)
@schema_version = res[:version]
@schema_prefix = res[:prefix]
end
end
end