Merge pull request #299 from internetee/registry-251

Registry 251
This commit is contained in:
Timo Võhmar 2016-12-16 14:27:56 +02:00 committed by GitHub
commit afac0c571e
59 changed files with 2258 additions and 890 deletions

View file

@ -1,3 +1,8 @@
16.12.2016
* Allow contact address processing to be configurable via admin
* EPP XML schema namespace "urn:ietf:params:xml:ns:epp-1.0" replaced with "https://epp.tld.ee/schema/epp-ee-1.0.xsd"
* EPP XML schema contact-eis-1.0 replaced with contact-ee-1.1
18.11.2016
* Domain expiration emails are now sent out to admin contacts as well. Sending bug is fixed.
* Include detailed registrar's contact info in emails

View file

@ -83,9 +83,8 @@ gem 'deep_cloneable', '2.1.1'
# id + mid login
gem 'digidoc_client', '0.2.1'
# epp
gem 'epp', '1.4.2', github: 'internetee/epp'
gem 'epp-xml', '1.0.5', github: 'internetee/epp-xml' # EIS EPP XMLs
gem 'epp', '1.5.0', github: 'internetee/epp'
gem 'epp-xml', '1.1.0', github: 'internetee/epp-xml'
gem 'uuidtools', '2.1.5' # For unique IDs (used by the epp gem)
# que

View file

@ -18,17 +18,17 @@ GIT
GIT
remote: https://github.com/internetee/epp-xml.git
revision: 475f650951f2cf5015e00d48f408a2194ecc1662
revision: 5dd542e67ef26d58365f30e553254d6db809277d
specs:
epp-xml (1.0.5)
epp-xml (1.1.0)
activesupport (~> 4.1)
builder (~> 3.2)
GIT
remote: https://github.com/internetee/epp.git
revision: 505c3f2739eb1da918e54111aecfb138a822739d
revision: 1a50f2144f15a2d975337e56fb1ccaba5d956e9d
specs:
epp (1.4.2)
epp (1.5.0)
hpricot
libxml-ruby
@ -299,7 +299,7 @@ GEM
launchy (2.4.3)
addressable (~> 2.3)
libv8 (3.16.14.11)
libxml-ruby (2.8.0)
libxml-ruby (2.9.0)
liquid (3.0.6)
listen (3.0.3)
rb-fsevent (>= 0.9.3)
@ -593,8 +593,8 @@ DEPENDENCIES
deep_cloneable (= 2.1.1)
devise (= 3.5.4)
digidoc_client (= 0.2.1)
epp (= 1.4.2)!
epp-xml (= 1.0.5)!
epp (= 1.5.0)!
epp-xml (= 1.1.0)!
fabrication (= 2.13.2)
factory_girl_rails
figaro (= 1.1.1)

View file

@ -16,6 +16,11 @@ module Repp
if params[:details] == 'true'
contacts = current_user.registrar.contacts.limit(limit).offset(offset)
unless Contact.address_processing?
attributes = Contact.attribute_names - Contact.address_attribute_names
contacts = contacts.select(attributes)
end
else
contacts = current_user.registrar.contacts.limit(limit).offset(offset).pluck(:code)
end

View file

@ -78,7 +78,8 @@ class Admin::SettingsController < AdminController
:registrar_ip_whitelist_enabled,
:api_ip_whitelist_enabled,
:request_confrimation_on_registrant_change_enabled,
:request_confirmation_on_domain_deletion_enabled
:request_confirmation_on_domain_deletion_enabled,
:address_processing
]
params[:settings].each do |k, v|

View file

@ -1,6 +1,7 @@
class Epp::ContactsController < EppController
before_action :find_contact, only: [:info, :update, :delete]
before_action :find_password, only: [:info, :update, :delete]
helper_method :address_processing?
def info
authorize! :info, @contact, @password
@ -17,12 +18,22 @@ class Epp::ContactsController < EppController
def create
authorize! :create, Epp::Contact
@contact = Epp::Contact.new(params[:parsed_frame], current_user.registrar)
frame = params[:parsed_frame]
@contact = Epp::Contact.new(frame, current_user.registrar)
@contact.add_legal_file_to_new(params[:parsed_frame])
@contact.add_legal_file_to_new(frame)
@contact.generate_code
if @contact.save
render_epp_response '/epp/contacts/create'
if !address_processing? && address_given?
@response_code = 1100
@response_description = t('epp.contacts.completed_without_address')
else
@response_code = 1000
@response_description = t('epp.contacts.completed')
end
render_epp_response '/epp/contacts/save'
else
handle_errors(@contact)
end
@ -31,8 +42,18 @@ class Epp::ContactsController < EppController
def update
authorize! :update, @contact, @password
if @contact.update_attributes(params[:parsed_frame], current_user)
render_epp_response 'epp/contacts/update'
frame = params[:parsed_frame]
if @contact.update_attributes(frame, current_user)
if !address_processing? && address_given?
@response_code = 1100
@response_description = t('epp.contacts.completed_without_address')
else
@response_code = 1000
@response_description = t('epp.contacts.completed')
end
render_epp_response 'epp/contacts/save'
else
handle_errors(@contact)
end
@ -91,10 +112,23 @@ class Epp::ContactsController < EppController
def validate_create
@prefix = 'create > create >'
requires(
'postalInfo > name', 'postalInfo > addr > street', 'postalInfo > addr > city',
'postalInfo > addr > pc', 'postalInfo > addr > cc', 'voice', 'email'
)
required_attributes = [
'postalInfo > name',
'voice',
'email'
]
address_attributes = [
'postalInfo > addr > street',
'postalInfo > addr > city',
'postalInfo > addr > pc',
'postalInfo > addr > cc',
]
required_attributes.concat(address_attributes) if address_processing?
requires(*required_attributes)
ident = params[:parsed_frame].css('ident')
if ident.present? && ident.attr('type').blank?
@ -165,4 +199,12 @@ class Epp::ContactsController < EppController
msg: "#{I18n.t(:client_side_status_editing_error)}: status [status]"
}
end
def address_given?
params[:parsed_frame].css('postalInfo addr').size != 0
end
def address_processing?
Contact.address_processing?
end
end

View file

@ -18,8 +18,8 @@ class Contact < ActiveRecord::Base
accepts_nested_attributes_for :legal_documents
validates :name, :phone, :email, :ident, :ident_type,
:street, :city, :zip, :country_code, :registrar, presence: true
validates :name, :phone, :email, :ident, :ident_type, :registrar, presence: true
validates :street, :city, :zip, :country_code, presence: true, if: 'self.class.address_processing?'
# Phone nr validation is very minimam in order to support legacy requirements
validates :phone, format: /\+[0-9]{1,3}\.[0-9]{1,14}?/
@ -37,7 +37,8 @@ class Contact < ActiveRecord::Base
validate :val_ident_type
validate :val_ident_valid_format?
validate :validate_html
validate :val_country_code
validate :validate_country_code
validate :validate_ident_country_code
after_initialize do
self.status_notes = {} if status_notes.nil?
@ -45,7 +46,6 @@ class Contact < ActiveRecord::Base
end
before_validation :to_upcase_country_code
before_validation :prefix_code
before_validation :strip_email
before_create :generate_auth_info
@ -257,6 +257,20 @@ class Contact < ActiveRecord::Base
def emails
pluck(:email)
end
def address_processing?
Setting.address_processing
end
def address_attribute_names
%w(
city
street
zip
country_code
state
)
end
end
def roid
@ -352,7 +366,7 @@ class Contact < ActiveRecord::Base
end
# rubocop:disable Metrics/CyclomaticComplexity
def prefix_code
def generate_code
return nil unless new_record?
return nil if registrar.blank?
code = self[:code]
@ -370,13 +384,6 @@ class Contact < ActiveRecord::Base
end
# rubocop:enable Metrics/CyclomaticComplexity
# used only for contact transfer
def generate_new_code!
return nil if registrar.blank?
registrar.reload # for contact transfer
self[:code] = "#{registrar.code}:#{SecureRandom.hex(4)}".upcase
end
def country
Country.new(country_code)
end
@ -411,9 +418,13 @@ class Contact < ActiveRecord::Base
self.country_code = country_code.upcase if country_code
end
def val_country_code
def validate_country_code
return unless country_code
errors.add(:country_code, :invalid) unless Country.new(country_code)
end
def validate_ident_country_code
errors.add(:ident, :invalid_country_code) unless Country.new(ident_country_code)
errors.add(:ident, :invalid_country_code) unless Country.new(country_code)
end
def related_domain_descriptions
@ -567,4 +578,9 @@ class Contact < ActiveRecord::Base
log
end
def remove_address
self.class.address_attribute_names.each do |attr_name|
self[attr_name.to_sym] = nil
end
end
end

View file

@ -30,11 +30,15 @@ class Epp::Contact < Contact
at[:email] = f.css('email').text if f.css('email').present?
at[:fax] = f.css('fax').text if f.css('fax').present?
at[:phone] = f.css('voice').text if f.css('voice').present?
if address_processing?
at[:city] = f.css('postalInfo addr city').text if f.css('postalInfo addr city').present?
at[:zip] = f.css('postalInfo addr pc').text if f.css('postalInfo addr pc').present?
at[:street] = f.css('postalInfo addr street').text if f.css('postalInfo addr street').present?
at[:state] = f.css('postalInfo addr sp').text if f.css('postalInfo addr sp').present?
at[:country_code] = f.css('postalInfo addr cc').text if f.css('postalInfo addr cc').present?
end
at[:auth_info] = f.css('authInfo pw').text if f.css('authInfo pw').present?
@ -125,6 +129,7 @@ class Epp::Contact < Contact
[:ident, :invalid_EE_identity_format_update],
[:ident, :invalid_birthday_format],
[:ident, :invalid_country_code],
[:country_code, :invalid],
[:ident_type, :missing],
[:code, :invalid],
[:code, :too_long_contact_code]

View file

@ -646,8 +646,9 @@ class Epp::Domain < Domain
oc.code = nil
oc.registrar_id = registrar_id
oc.copy_from_id = c.id
oc.prefix_code
oc.generate_code
oc.domain_transfer = true
oc.remove_address unless Contact.address_processing?
oc.save!(validate: false)
oc
end

View file

@ -57,6 +57,7 @@
= render 'setting_row', var: :registrar_ip_whitelist_enabled
= render 'setting_row', var: :request_confrimation_on_registrant_change_enabled
= render 'setting_row', var: :request_confirmation_on_domain_deletion_enabled
= render 'setting_row', var: :address_processing
.panel.panel-default
.panel-heading.clearfix

View file

@ -5,7 +5,7 @@ xml.epp_head do
end
xml.resData do
xml.tag!('contact:chkData', 'xmlns:contact' => 'https://epp.tld.ee/schema/contact-eis-1.0.xsd') do
xml.tag!('contact:chkData', 'xmlns:contact' => 'https://epp.tld.ee/schema/contact-ee-1.1.xsd') do
@results.each do |result|
xml.tag!('contact:cd') do
xml.tag! "contact:id", result[:code], avail: result[:avail]

View file

@ -5,7 +5,7 @@ xml.epp_head do
end
xml.resData do
xml.tag!('contact:infData', 'xmlns:contact' => 'https://epp.tld.ee/schema/contact-eis-1.0.xsd') do
xml.tag!('contact:infData', 'xmlns:contact' => 'https://epp.tld.ee/schema/contact-ee-1.1.xsd') do
xml.tag!('contact:id', @contact.code)
xml.tag!('contact:roid', @contact.roid)
@ -17,6 +17,8 @@ xml.epp_head do
xml.tag!('contact:name', @contact.name)
if can? :view_full_info, @contact, @password
xml.tag!('contact:org', @contact.org_name) if @contact.org_name.present?
if address_processing?
xml.tag!('contact:addr') do
xml.tag!('contact:street', @contact.street)
xml.tag!('contact:city', @contact.city)
@ -24,8 +26,12 @@ xml.epp_head do
xml.tag!('contact:pc', @contact.zip)
xml.tag!('contact:cc', @contact.country_code)
end
end
else
xml.tag!('contact:org', 'No access')
if address_processing?
xml.tag!('contact:addr') do
xml.tag!('contact:street', 'No access')
xml.tag!('contact:city', 'No access')
@ -34,6 +40,8 @@ xml.epp_head do
xml.tag!('contact:cc', 'No access')
end
end
end
end
if can? :view_full_info, @contact, @password

View file

@ -1,11 +1,11 @@
xml.epp_head do
xml.response do
xml.result('code' => '1000') do
xml.msg 'Command completed successfully'
xml.result('code' => @response_code) do
xml.msg @response_description
end
xml.resData do
xml.tag!('contact:creData', 'xmlns:contact' => 'https://epp.tld.ee/schema/contact-eis-1.0.xsd') do
xml.tag!('contact:creData', 'xmlns:contact' => 'https://epp.tld.ee/schema/contact-ee-1.1.xsd') do
xml.tag!('contact:id', @contact.code)
xml.tag!('contact:crDate', @contact.created_at.try(:iso8601))
end

View file

@ -1,16 +0,0 @@
xml.epp_head do
xml.response do
xml.result('code' => '1000') do
xml.msg 'Command completed successfully'
end
xml.resData do
xml.tag!('contact:creData', 'xmlns:contact' => 'https://epp.tld.ee/schema/contact-eis-1.0.xsd') do
xml.tag!('contact:id', @contact.code)
xml.tag!('contact:crDate', @contact.created_at.try(:iso8601))
end
end
render('epp/shared/trID', builder: xml)
end
end

View file

@ -1,6 +1,6 @@
xml.instruct!(:xml, standalone: 'no')
xml.epp(
'xmlns' => 'urn:ietf:params:xml:ns:epp-1.0',
'xmlns' => 'https://epp.tld.ee/schema/epp-ee-1.0.xsd',
'xmlns:secDNS' => 'urn:ietf:params:xml:ns:secDNS-1.1',
'xmlns:domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd',
'xmlns:keyrelay' => 'urn:ietf:params:xml:ns:keyrelay-1.0'

View file

@ -6,7 +6,7 @@ xml.epp_head do
xml.version '1.0'
xml.lang 'en'
xml.objURI 'https://epp.tld.ee/schema/domain-eis-1.0.xsd'
xml.objURI 'https://epp.tld.ee/schema/contact-eis-1.0.xsd'
xml.objURI 'https://epp.tld.ee/schema/contact-ee-1.1.xsd'
xml.objURI 'urn:ietf:params:xml:ns:host-1.0'
xml.objURI 'urn:ietf:params:xml:ns:keyrelay-1.0'
xml.svcExtension do

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<check>
<contact:check
xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd">
xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd">
<contact:id>sh8013</contact:id>
</contact:check>
</check>

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<check>
<contact:check
xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd">
xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd">
<contact:id>sh8013</contact:id>
<contact:id>sh13</contact:id>
<contact:id>vsdfvq</contact:id>

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<create>
<contact:create xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd">
<contact:create xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd">
<contact:postalInfo>
<contact:name>Sillius Soddus</contact:name>
<contact:addr>

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<delete>
<contact:delete
xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd">
xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd">
<contact:id>sh8013</contact:id>
<contact:authInfo>
<contact:pw>wrong-one</contact:pw>

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<info>
<contact:info xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd">
<contact:info xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd">
<contact:id>sh8013</contact:id>
<contact:authInfo>
<contact:pw>Aas34fq</contact:pw>

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<update>
<contact:update xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd">
<contact:update xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd">
<contact:id>sh8013</contact:id>
<contact:chg>
<contact:postalInfo>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<check>
<domain:check

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<create>
<domain:create

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<delete>
<domain:delete

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<info>
<domain:info

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<renew>
<domain:renew

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<transfer op="request">
<domain:transfer

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<update>
<domain:update

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1" xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd" xmlns:ext="urn:ietf:params:xml:ns:keyrelay-1.0">
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd" xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1" xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd" xmlns:ext="urn:ietf:params:xml:ns:keyrelay-1.0">
<command>
<ext:keyrelay>
<ext:name>example6.ee</ext:name>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<poll op="req"/>
<clTRID>ABC-12345</clTRID>

View file

@ -26,6 +26,7 @@ if con.present? && con.table_exists?('settings')
Setting.transfer_wait_time = 0
Setting.save_default(:request_confrimation_on_registrant_change_enabled, true)
Setting.save_default(:request_confirmation_on_domain_deletion_enabled, true)
Setting.save_default(:address_processing, true)
Setting.save_default(:client_side_status_editing_enabled, false)

View file

@ -1 +1 @@
EPP_ALL_SCHEMA = Nokogiri::XML::Schema(File.read("lib/schemas/all-ee-1.0.xsd"))
EPP_ALL_SCHEMA = Nokogiri::XML::Schema(File.read('lib/schemas/all-ee-1.1.xsd'))

View file

@ -0,0 +1,8 @@
en:
activerecord:
errors:
models:
contact:
attributes:
country_code:
invalid: Country code is not valid, should be in ISO_3166-1 alpha 2 format

View file

@ -0,0 +1,5 @@
en:
epp:
contacts:
completed: Command completed successfully
completed_without_address: Command completed successfully; Postal address data discarded

File diff suppressed because it is too large Load diff

View file

@ -29,9 +29,12 @@
### .ee-specific
* [all-ee-1.0.xsd](/lib/schemas/all-ee-1.0.xsd)
* [all-ee-1.1.xsd](/lib/schemas/all-ee-1.1.xsd)
* [eis-1.0.xsd](/lib/schemas/eis-1.0.xsd)
* [epp-ee-1.0.xsd](/lib/schemas/epp-ee-1.0.xsd)
* [domain-eis-1.0.xsd](/lib/schemas/domain-eis-1.0.xsd)
* [contact-eis-1.0.xsd](/lib/schemas/contact-eis-1.0.xsd)
* [eis-1.0.xsd](/lib/schemas/eis-1.0.xsd)
* [contact-ee-1.1.xsd](/lib/schemas/contact-ee-1.1.xsd)
More info about The Extensible Provisioning Protocol (EPP):
http://en.wikipedia.org/wiki/Extensible_Provisioning_Protocol

View file

@ -17,7 +17,7 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode
Field name Min-max Field description
----------------------- ------- -----------------
<create> 1
<contact:create> 1 Attribute: xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd"
<contact:create> 1 Attribute: xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd"
<contact:id> 0-1 Contact id, optional,
string: ASCII letters, numbers, ':', '-' characters, no spaces,
max 100 characters,
@ -53,7 +53,7 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode
Field name Min-max Field description
----------------------- ------- -----------------
<update> 1
<contact:update> 1 Attribute: xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd"
<contact:update> 1 Attribute: xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd"
<contact:id> 1 Contact id, required
<contact:chg> 1 Change container
<contact:postalInfo> 1 Postal information container
@ -90,7 +90,7 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode
Field name Min-max Field description
----------------------- ------- -----------------
<delete> 1
<contact:delete> 1 Attribute: xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd"
<contact:delete> 1 Attribute: xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd"
<contact:id> 1 Contact id
<contact:authInfo> 0-1 Required if registrar is not the owner of the contact.
<contact:pw> 1 Contact password. Attribute: roid="String"
@ -108,7 +108,7 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode
Field name Min-max Field description
----------------------- ------- -----------------
<check> 1
<contact:check> 1 Attribute: xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd"
<contact:check> 1 Attribute: xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd"
<contact:id> 1-n Contact id
<clTRID> 0-1 Client transaction id
@ -120,7 +120,7 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode
Field name Min-max Field description
----------------------- ------- -----------------
<info> 1
<contact:info> 1 Attribute: xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd"
<contact:info> 1 Attribute: xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd"
<contact:id> 1-n Contact id
<contact:authInfo> 0-1 Required if registrar is not the owner of the contact.
<contact:pw> 1 Contact password. Attribute: roid="String"

View file

@ -4,7 +4,7 @@ Here are functions like login, logout, hello, poll
### Hello request
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<hello/>
</epp>

View file

@ -1,7 +1,7 @@
class EppConstraint
OBJECT_TYPES = {
domain: { domain: 'https://epp.tld.ee/schema/domain-eis-1.0.xsd' },
contact: { contact: 'https://epp.tld.ee/schema/contact-eis-1.0.xsd' }
contact: { contact: 'https://epp.tld.ee/schema/contact-ee-1.1.xsd' }
}
def initialize(type)

View file

@ -4,9 +4,9 @@ class Builder::XmlMarkup
def epp_head
self.instruct!
epp(
'xmlns' => 'urn:ietf:params:xml:ns:epp-1.0',
'xmlns' => 'https://epp.tld.ee/schema/epp-ee-1.0.xsd',
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
'xsi:schemaLocation' => 'urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd'
'xsi:schemaLocation' => 'lib/schemas/epp-ee-1.0.xsd'
) do
yield
end

View file

@ -18,7 +18,7 @@
-->
<import namespace="urn:ietf:params:xml:ns:eppcom-1.0"
schemaLocation="lib/schemas/eppcom-1.0.xsd"/>
<import namespace="urn:ietf:params:xml:ns:epp-1.0"
<import namespace="https://epp.tld.ee/schema/epp-ee-1.0.xsd"
schemaLocation="lib/schemas/epp-1.0.xsd"/>
<!-- EPP protocol extension: DNSSEC -->
<import namespace="urn:ietf:params:xml:ns:secDNS-1.1"

View file

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This schema imports other schemas used for Estonian ccTLD
.ee EPP queries and responses.
-->
<schema targetNamespace="https://epp.tld.ee/schema/all-ee-1.0"
xmlns:all="https://epp.tld.ee/schema/all-ee-1.0"
xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<!--
Import all schemas related to .ee EPP protocol.
Anytime the version of any imported schema is raised, the version of
'all' schema is also raised.
eppcom and epp schemas never change the version. This would result
in incompatibility with EPP standard.
-->
<import namespace="urn:ietf:params:xml:ns:eppcom-1.0"
schemaLocation="lib/schemas/eppcom-1.0.xsd"/>
<import namespace="https://epp.tld.ee/schema/epp-ee-1.0.xsd"
schemaLocation="lib/schemas/epp-ee-1.0.xsd"/>
<!-- EPP protocol extension: DNSSEC -->
<import namespace="urn:ietf:params:xml:ns:secDNS-1.1"
schemaLocation="lib/schemas/secDNS-1.1.xsd"/>
<!-- EPP protocol extension: DNSSEC keyrelay -->
<import namespace="urn:ietf:params:xml:ns:keyrelay-1.0"
schemaLocation="lib/schemas/keyrelay-1.0.xsd"/>
<import namespace="urn:ietf:params:xml:ns:host-1.0"
schemaLocation="lib/schemas/host-1.0.xsd"/>
<!-- EPP protocol extension: .ee specific -->
<import namespace="https://epp.tld.ee/schema/eis-1.0"
schemaLocation="lib/schemas/eis-1.0.xsd"/>
<import namespace="https://epp.tld.ee/schema/contact-ee-1.1"
schemaLocation="lib/schemas/contact-ee-1.1.xsd"/>
<import namespace="https://epp.tld.ee/schema/domain-eis-1.0"
schemaLocation="lib/schemas/domain-eis-1.0.xsd"/>
<annotation>
<documentation>
Extensible Provisioning Protocol v1.0
all schema's grouped together
</documentation>
</annotation>
</schema>

View file

@ -2,7 +2,7 @@
<schema targetNamespace="urn:ietf:params:xml:ns:contact-1.0"
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0"
xmlns:epp="urn:ietf:params:xml:ns:epp-1.0"
xmlns:epp="https://epp.tld.ee/schema/epp-ee-1.0.xsd"
xmlns:eppcom="urn:ietf:params:xml:ns:eppcom-1.0"
xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
@ -11,7 +11,7 @@
Import common element types.
-->
<import namespace="urn:ietf:params:xml:ns:eppcom-1.0"/>
<import namespace="urn:ietf:params:xml:ns:epp-1.0"/>
<import namespace="https://epp.tld.ee/schema/epp-ee-1.0.xsd"/>
<annotation>
<documentation>

View file

@ -0,0 +1,366 @@
<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="https://epp.tld.ee/schema/contact-ee-1.1.xsd"
xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd"
xmlns:epp="https://epp.tld.ee/schema/epp-ee-1.0.xsd"
xmlns:eppcom="urn:ietf:params:xml:ns:eppcom-1.0"
xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<!--
Import common element types.
-->
<import namespace="urn:ietf:params:xml:ns:eppcom-1.0"/>
<import namespace="https://epp.tld.ee/schema/epp-ee-1.0.xsd"/>
<import namespace="https://epp.tld.ee/schema/eis-1.0.xsd"/>
<annotation>
<documentation>
Extensible Provisioning Protocol v1.1
contact provisioning schema.
</documentation>
</annotation>
<!--
Child elements found in EPP commands.
-->
<element name="check" type="contact:mIDType"/>
<element name="create" type="contact:createType"/>
<element name="delete" type="contact:authIDType"/>
<element name="info" type="contact:authIDType"/>
<element name="transfer" type="contact:authIDType"/>
<element name="update" type="contact:updateType"/>
<!--
Utility types.
-->
<simpleType name="ccType">
<restriction base="token">
<length value="2"/>
</restriction>
</simpleType>
<complexType name="e164Type">
<simpleContent>
<extension base="contact:e164StringType">
<attribute name="x" type="token"/>
</extension>
</simpleContent>
</complexType>
<simpleType name="e164StringType">
<restriction base="token">
<!--<pattern value="(\+[0-9]{1,3}\.[0-9]{1,14})?"/> -->
<maxLength value="17"/>
</restriction>
</simpleType>
<simpleType name="pcType">
<restriction base="token">
<maxLength value="16"/>
</restriction>
</simpleType>
<simpleType name="postalLineType">
<restriction base="normalizedString">
<minLength value="1"/>
<maxLength value="255"/>
</restriction>
</simpleType>
<simpleType name="optPostalLineType">
<restriction base="normalizedString">
<maxLength value="255"/>
</restriction>
</simpleType>
<!--
Child elements of the <create> command.
-->
<complexType name="createType">
<sequence>
<element name="id" type="eppcom:clIDType" minOccurs="0"/>
<element name="postalInfo" type="contact:postalInfoType"
maxOccurs="2"/>
<element name="voice" type="contact:e164Type"
minOccurs="0"/>
<element name="fax" type="contact:e164Type"
minOccurs="0"/>
<element name="email" type="eppcom:minTokenType"/>
<element name="authInfo" type="contact:authInfoType" minOccurs="0"/>
</sequence>
</complexType>
<complexType name="postalInfoType">
<sequence>
<element name="name" type="contact:postalLineType"/>
<element name="org" type="contact:optPostalLineType"
minOccurs="0"/>
<element name="addr" type="contact:addrType" minOccurs="0"/>
</sequence>
<attribute name="type" type="contact:postalInfoEnumType"/>
</complexType>
<simpleType name="postalInfoEnumType">
<restriction base="token">
<enumeration value="loc"/>
<enumeration value="int"/>
</restriction>
</simpleType>
<complexType name="addrType">
<sequence>
<element name="street" type="contact:optPostalLineType"
minOccurs="0" maxOccurs="3"/>
<element name="city" type="contact:postalLineType"/>
<element name="sp" type="contact:optPostalLineType"
minOccurs="0"/>
<element name="pc" type="contact:pcType"
minOccurs="0"/>
<element name="cc" type="contact:ccType"/>
</sequence>
</complexType>
<complexType name="authInfoType">
<choice>
<element name="pw" type="eppcom:pwAuthInfoType"/>
<element name="ext" type="eppcom:extAuthInfoType"/>
</choice>
</complexType>
<complexType name="intLocType">
<attribute name="type" type="contact:postalInfoEnumType"
use="required"/>
</complexType>
<!--
Child element of commands that require only an identifier.
-->
<complexType name="sIDType">
<sequence>
<element name="id" type="eppcom:clIDType"/>
</sequence>
</complexType>
<!--
Child element of commands that accept multiple identifiers.
-->
<complexType name="mIDType">
<sequence>
<element name="id" type="eppcom:clIDType"
maxOccurs="unbounded"/>
</sequence>
</complexType>
<!--
Child elements of the <info> and <transfer> commands.
-->
<complexType name="authIDType">
<sequence>
<element name="id" type="eppcom:clIDType"/>
<element name="authInfo" type="contact:authInfoType"
minOccurs="0"/>
</sequence>
</complexType>
<!--
Child elements of the <update> command.
-->
<complexType name="updateType">
<sequence>
<element name="id" type="eppcom:clIDType"/>
<element name="add" type="contact:addRemType"
minOccurs="0"/>
<element name="rem" type="contact:addRemType"
minOccurs="0"/>
<element name="chg" type="contact:chgType"
minOccurs="0"/>
</sequence>
</complexType>
<!--
Data elements that can be added or removed.
-->
<complexType name="addRemType">
<sequence>
<element name="status" type="contact:statusType"
maxOccurs="7"/>
</sequence>
</complexType>
<!--
Data elements that can be changed.
-->
<complexType name="chgType">
<sequence>
<element name="postalInfo" type="contact:chgPostalInfoType"
minOccurs="0" maxOccurs="2"/>
<element name="voice" type="contact:e164Type"
minOccurs="0"/>
<element name="fax" type="contact:e164Type"
minOccurs="0"/>
<element name="email" type="eppcom:minTokenType"
minOccurs="0"/>
<element name="authInfo" type="contact:authInfoType"
minOccurs="0"/>
</sequence>
</complexType>
<complexType name="chgPostalInfoType">
<sequence>
<element name="name" type="contact:postalLineType"
minOccurs="0"/>
<element name="org" type="contact:optPostalLineType"
minOccurs="0"/>
<element name="addr" type="contact:addrType"
minOccurs="0"/>
</sequence>
<attribute name="type" type="contact:postalInfoEnumType"/>
</complexType>
<!--
Child response elements.
-->
<element name="chkData" type="contact:chkDataType"/>
<element name="creData" type="contact:creDataType"/>
<element name="infData" type="contact:infDataType"/>
<element name="panData" type="contact:panDataType"/>
<element name="trnData" type="contact:trnDataType"/>
<!--
<check> response elements.
-->
<complexType name="chkDataType">
<sequence>
<element name="cd" type="contact:checkType"
maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="checkType">
<sequence>
<element name="id" type="contact:checkIDType"/>
<element name="reason" type="eppcom:reasonType"
minOccurs="0"/>
</sequence>
</complexType>
<complexType name="checkIDType">
<simpleContent>
<extension base="eppcom:clIDType">
<attribute name="avail" type="boolean"
use="required"/>
</extension>
</simpleContent>
</complexType>
<!--
<create> response elements.
-->
<complexType name="creDataType">
<sequence>
<element name="id" type="eppcom:clIDType"/>
<element name="crDate" type="dateTime"/>
</sequence>
</complexType>
<!--
<info> response elements.
-->
<complexType name="infDataType">
<sequence>
<element name="id" type="eppcom:clIDType"/>
<element name="roid" type="eppcom:roidType"/>
<element name="status" type="contact:statusType"
maxOccurs="7"/>
<element name="postalInfo" type="contact:postalInfoType"
maxOccurs="2"/>
<element name="voice" type="contact:e164Type"
minOccurs="0"/>
<element name="fax" type="contact:e164Type"
minOccurs="0"/>
<element name="email" type="eppcom:minTokenType"/>
<element name="clID" type="eppcom:clIDType"/>
<element name="crID" type="eppcom:clIDType"/>
<element name="crDate" type="dateTime"/>
<element name="upID" type="eppcom:clIDType"
minOccurs="0"/>
<element name="upDate" type="dateTime"
minOccurs="0"/>
<element name="trDate" type="dateTime"
minOccurs="0"/>
<element name="authInfo" type="contact:authInfoType"
minOccurs="0"/>
</sequence>
</complexType>
<!--
Status is a combination of attributes and an optional human-readable
message that may be expressed in languages other than English.
-->
<complexType name="statusType">
<simpleContent>
<extension base="normalizedString">
<attribute name="s" type="contact:statusValueType"
use="required"/>
<attribute name="lang" type="language"
default="en"/>
</extension>
</simpleContent>
</complexType>
<simpleType name="statusValueType">
<restriction base="token">
<enumeration value="clientDeleteProhibited"/>
<enumeration value="clientTransferProhibited"/>
<enumeration value="clientUpdateProhibited"/>
<enumeration value="linked"/>
<enumeration value="ok"/>
<enumeration value="pendingCreate"/>
<enumeration value="pendingDelete"/>
<enumeration value="pendingTransfer"/>
<enumeration value="pendingUpdate"/>
<enumeration value="serverDeleteProhibited"/>
<enumeration value="serverTransferProhibited"/>
<enumeration value="serverUpdateProhibited"/>
</restriction>
</simpleType>
<!--
Pending action notification response elements.
-->
<complexType name="panDataType">
<sequence>
<element name="id" type="contact:paCLIDType"/>
<element name="paTRID" type="epp:trIDType"/>
<element name="paDate" type="dateTime"/>
</sequence>
</complexType>
<complexType name="paCLIDType">
<simpleContent>
<extension base="eppcom:clIDType">
<attribute name="paResult" type="boolean"
use="required"/>
</extension>
</simpleContent>
</complexType>
<!--
<transfer> response elements.
-->
<complexType name="trnDataType">
<sequence>
<element name="id" type="eppcom:clIDType"/>
<element name="trStatus" type="eppcom:trStatusType"/>
<element name="reID" type="eppcom:clIDType"/>
<element name="reDate" type="dateTime"/>
<element name="acID" type="eppcom:clIDType"/>
<element name="acDate" type="dateTime"/>
</sequence>
</complexType>
<!--
End of schema.
-->
</schema>

View file

@ -2,7 +2,7 @@
<schema targetNamespace="https://epp.tld.ee/schema/contact-eis-1.0.xsd"
xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd"
xmlns:epp="urn:ietf:params:xml:ns:epp-1.0"
xmlns:epp="https://epp.tld.ee/schema/epp-ee-1.0.xsd"
xmlns:eppcom="urn:ietf:params:xml:ns:eppcom-1.0"
xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
@ -11,7 +11,7 @@
Import common element types.
-->
<import namespace="urn:ietf:params:xml:ns:eppcom-1.0"/>
<import namespace="urn:ietf:params:xml:ns:epp-1.0"/>
<import namespace="https://epp.tld.ee/schema/epp-ee-1.0.xsd"/>
<import namespace="https://epp.tld.ee/schema/eis-1.0.xsd"/>
<annotation>

View file

@ -3,7 +3,7 @@
<schema targetNamespace="urn:ietf:params:xml:ns:domain-1.0"
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"
xmlns:host="urn:ietf:params:xml:ns:host-1.0"
xmlns:epp="urn:ietf:params:xml:ns:epp-1.0"
xmlns:epp="https://epp.tld.ee/schema/epp-ee-1.0.xsd"
xmlns:eppcom="urn:ietf:params:xml:ns:eppcom-1.0"
xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
@ -12,7 +12,7 @@
Import common element types.
-->
<import namespace="urn:ietf:params:xml:ns:eppcom-1.0"/>
<import namespace="urn:ietf:params:xml:ns:epp-1.0"/>
<import namespace="https://epp.tld.ee/schema/epp-ee-1.0.xsd"/>
<import namespace="urn:ietf:params:xml:ns:host-1.0"/>
<annotation>

View file

@ -3,7 +3,7 @@
<schema targetNamespace="https://epp.tld.ee/schema/domain-eis-1.0.xsd"
xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd"
xmlns:host="urn:ietf:params:xml:ns:host-1.0"
xmlns:epp="urn:ietf:params:xml:ns:epp-1.0"
xmlns:epp="https://epp.tld.ee/schema/epp-ee-1.0.xsd"
xmlns:eppcom="urn:ietf:params:xml:ns:eppcom-1.0"
xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
@ -12,7 +12,7 @@
Import common element types.
-->
<import namespace="urn:ietf:params:xml:ns:eppcom-1.0"/>
<import namespace="urn:ietf:params:xml:ns:epp-1.0"/>
<import namespace="https://epp.tld.ee/schema/epp-ee-1.0.xsd"/>
<import namespace="urn:ietf:params:xml:ns:host-1.0"/>
<import namespace="urn:ietf:params:xml:ns:secDNS-1.1"/>
<import namespace="https://epp.tld.ee/schema/eis-1.0.xsd"/>

447
lib/schemas/epp-ee-1.0.xsd Normal file
View file

@ -0,0 +1,447 @@
<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="https://epp.tld.ee/schema/epp-ee-1.0.xsd"
xmlns:epp="https://epp.tld.ee/schema/epp-ee-1.0.xsd"
xmlns:eppcom="urn:ietf:params:xml:ns:eppcom-1.0"
xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<!--
Import common element types.
-->
<import namespace="urn:ietf:params:xml:ns:eppcom-1.0"/>
<annotation>
<documentation>
Extensible Provisioning Protocol v1.0 schema.
</documentation>
</annotation>
<!--
Every EPP XML instance must begin with this element.
-->
<element name="epp" type="epp:eppType"/>
<!--
An EPP XML instance must contain a greeting, hello, command,
response, or extension.
-->
<complexType name="eppType">
<choice>
<element name="greeting" type="epp:greetingType"/>
<element name="hello"/>
<element name="command" type="epp:commandType"/>
<element name="response" type="epp:responseType"/>
<element name="extension" type="epp:extAnyType"/>
</choice>
</complexType>
<!--
A greeting is sent by a server in response to a client connection
or <hello>.
-->
<complexType name="greetingType">
<sequence>
<element name="svID" type="epp:sIDType"/>
<element name="svDate" type="dateTime"/>
<element name="svcMenu" type="epp:svcMenuType"/>
<element name="dcp" type="epp:dcpType"/>
</sequence>
</complexType>
<!--
Server IDs are strings with minimum and maximum length restrictions.
-->
<simpleType name="sIDType">
<restriction base="normalizedString">
<minLength value="3"/>
<maxLength value="64"/>
</restriction>
</simpleType>
<!--
A server greeting identifies available object services.
-->
<complexType name="svcMenuType">
<sequence>
<element name="version" type="epp:versionType"
maxOccurs="unbounded"/>
<element name="lang" type="language"
maxOccurs="unbounded"/>
<element name="objURI" type="anyURI"
maxOccurs="unbounded"/>
<element name="svcExtension" type="epp:extURIType"
minOccurs="0"/>
</sequence>
</complexType>
<!--
Data Collection Policy types.
-->
<complexType name="dcpType">
<sequence>
<element name="access" type="epp:dcpAccessType"/>
<element name="statement" type="epp:dcpStatementType"
maxOccurs="unbounded"/>
<element name="expiry" type="epp:dcpExpiryType"
minOccurs="0"/>
</sequence>
</complexType>
<complexType name="dcpAccessType">
<choice>
<element name="all"/>
<element name="none"/>
<element name="null"/>
<element name="other"/>
<element name="personal"/>
<element name="personalAndOther"/>
</choice>
</complexType>
<complexType name="dcpStatementType">
<sequence>
<element name="purpose" type="epp:dcpPurposeType"/>
<element name="recipient" type="epp:dcpRecipientType"/>
<element name="retention" type="epp:dcpRetentionType"/>
</sequence>
</complexType>
<complexType name="dcpPurposeType">
<sequence>
<element name="admin"
minOccurs="0"/>
<element name="contact"
minOccurs="0"/>
<element name="other"
minOccurs="0"/>
<element name="prov"
minOccurs="0"/>
</sequence>
</complexType>
<complexType name="dcpRecipientType">
<sequence>
<element name="other"
minOccurs="0"/>
<element name="ours" type="epp:dcpOursType"
minOccurs="0" maxOccurs="unbounded"/>
<element name="public"
minOccurs="0"/>
<element name="same"
minOccurs="0"/>
<element name="unrelated"
minOccurs="0"/>
</sequence>
</complexType>
<complexType name="dcpOursType">
<sequence>
<element name="recDesc" type="epp:dcpRecDescType"
minOccurs="0"/>
</sequence>
</complexType>
<simpleType name="dcpRecDescType">
<restriction base="token">
<minLength value="1"/>
<maxLength value="255"/>
</restriction>
</simpleType>
<complexType name="dcpRetentionType">
<choice>
<element name="business"/>
<element name="indefinite"/>
<element name="legal"/>
<element name="none"/>
<element name="stated"/>
</choice>
</complexType>
<complexType name="dcpExpiryType">
<choice>
<element name="absolute" type="dateTime"/>
<element name="relative" type="duration"/>
</choice>
</complexType>
<!--
Extension framework types.
-->
<complexType name="extAnyType">
<sequence>
<any namespace="##other"
maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="extURIType">
<sequence>
<element name="extURI" type="anyURI"
maxOccurs="unbounded"/>
</sequence>
</complexType>
<!--
An EPP version number is a dotted pair of decimal numbers.
-->
<simpleType name="versionType">
<restriction base="token">
<pattern value="[1-9]+\.[0-9]+"/>
<enumeration value="1.0"/>
</restriction>
</simpleType>
<!--
Command types.
-->
<complexType name="commandType">
<sequence>
<choice>
<element name="check" type="epp:readWriteType"/>
<element name="create" type="epp:readWriteType"/>
<element name="delete" type="epp:readWriteType"/>
<element name="info" type="epp:readWriteType"/>
<element name="login" type="epp:loginType"/>
<element name="logout"/>
<element name="poll" type="epp:pollType"/>
<element name="renew" type="epp:readWriteType"/>
<element name="transfer" type="epp:transferType"/>
<element name="update" type="epp:readWriteType"/>
</choice>
<element name="extension" type="epp:extAnyType"
minOccurs="0"/>
<element name="clTRID" type="epp:trIDStringType"
minOccurs="0"/>
</sequence>
</complexType>
<!--
The <login> command.
-->
<complexType name="loginType">
<sequence>
<element name="clID" type="eppcom:clIDType"/>
<element name="pw" type="epp:pwType"/>
<element name="newPW" type="epp:pwType"
minOccurs="0"/>
<element name="options" type="epp:credsOptionsType"/>
<element name="svcs" type="epp:loginSvcType"/>
</sequence>
</complexType>
<complexType name="credsOptionsType">
<sequence>
<element name="version" type="epp:versionType"/>
<element name="lang" type="language"/>
</sequence>
</complexType>
<simpleType name="pwType">
<restriction base="token">
<minLength value="6"/>
<maxLength value="16"/>
</restriction>
</simpleType>
<complexType name="loginSvcType">
<sequence>
<element name="objURI" type="anyURI"
maxOccurs="unbounded"/>
<element name="svcExtension" type="epp:extURIType"
minOccurs="0"/>
</sequence>
</complexType>
<!--
The <poll> command.
-->
<complexType name="pollType">
<attribute name="op" type="epp:pollOpType"
use="required"/>
<attribute name="msgID" type="token"/>
</complexType>
<simpleType name="pollOpType">
<restriction base="token">
<enumeration value="ack"/>
<enumeration value="req"/>
</restriction>
</simpleType>
<!--
The <transfer> command. This is object-specific, and uses attributes
to identify the requested operation.
-->
<complexType name="transferType">
<sequence>
<any namespace="##other"/>
</sequence>
<attribute name="op" type="epp:transferOpType"
use="required"/>
</complexType>
<simpleType name="transferOpType">
<restriction base="token">
<enumeration value="approve"/>
<enumeration value="cancel"/>
<enumeration value="query"/>
<enumeration value="reject"/>
<enumeration value="request"/>
</restriction>
</simpleType>
<!--
All other object-centric commands. EPP doesn't specify the syntax or
semantics of object-centric command elements. The elements MUST be
described in detail in another schema specific to the object.
-->
<complexType name="readWriteType">
<sequence>
<any namespace="##other"/>
</sequence>
</complexType>
<complexType name="trIDType">
<sequence>
<element name="clTRID" type="epp:trIDStringType"
minOccurs="0"/>
<element name="svTRID" type="epp:trIDStringType"/>
</sequence>
</complexType>
<simpleType name="trIDStringType">
<restriction base="token">
<minLength value="3"/>
<maxLength value="64"/>
</restriction>
</simpleType>
<!--
Response types.
-->
<complexType name="responseType">
<sequence>
<element name="result" type="epp:resultType"
maxOccurs="unbounded"/>
<element name="msgQ" type="epp:msgQType"
minOccurs="0"/>
<element name="resData" type="epp:extAnyType"
minOccurs="0"/>
<element name="extension" type="epp:extAnyType"
minOccurs="0"/>
<element name="trID" type="epp:trIDType"/>
</sequence>
</complexType>
<complexType name="resultType">
<sequence>
<element name="msg" type="epp:msgType"/>
<choice minOccurs="0" maxOccurs="unbounded">
<element name="value" type="epp:errValueType"/>
<element name="extValue" type="epp:extErrValueType"/>
</choice>
</sequence>
<attribute name="code" type="epp:resultCodeType"
use="required"/>
</complexType>
<complexType name="errValueType" mixed="true">
<sequence>
<any namespace="##any" processContents="skip"/>
</sequence>
<anyAttribute namespace="##any" processContents="skip"/>
</complexType>
<complexType name="extErrValueType">
<sequence>
<element name="value" type="epp:errValueType"/>
<element name="reason" type="epp:msgType"/>
</sequence>
</complexType>
<complexType name="msgQType">
<sequence>
<element name="qDate" type="dateTime"
minOccurs="0"/>
<element name="msg" type="epp:mixedMsgType"
minOccurs="0"/>
</sequence>
<attribute name="count" type="unsignedLong"
use="required"/>
<attribute name="id" type="eppcom:minTokenType"
use="required"/>
</complexType>
<complexType name="mixedMsgType" mixed="true">
<sequence>
<any processContents="skip"
minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="lang" type="language"
default="en"/>
</complexType>
<!--
Human-readable text may be expressed in languages other than English.
-->
<complexType name="msgType">
<simpleContent>
<extension base="normalizedString">
<attribute name="lang" type="language"
default="en"/>
</extension>
</simpleContent>
</complexType>
<!--
EPP result codes.
-->
<simpleType name="resultCodeType">
<restriction base="unsignedShort">
<enumeration value="1000"/>
<enumeration value="1001"/>
<enumeration value="1100"/>
<enumeration value="1300"/>
<enumeration value="1301"/>
<enumeration value="1500"/>
<enumeration value="2000"/>
<enumeration value="2001"/>
<enumeration value="2002"/>
<enumeration value="2003"/>
<enumeration value="2004"/>
<enumeration value="2005"/>
<enumeration value="2100"/>
<enumeration value="2101"/>
<enumeration value="2102"/>
<enumeration value="2103"/>
<enumeration value="2104"/>
<enumeration value="2105"/>
<enumeration value="2106"/>
<enumeration value="2200"/>
<enumeration value="2201"/>
<enumeration value="2202"/>
<enumeration value="2300"/>
<enumeration value="2301"/>
<enumeration value="2302"/>
<enumeration value="2303"/>
<enumeration value="2304"/>
<enumeration value="2305"/>
<enumeration value="2306"/>
<enumeration value="2307"/>
<enumeration value="2308"/>
<enumeration value="2400"/>
<enumeration value="2500"/>
<enumeration value="2501"/>
<enumeration value="2502"/>
</restriction>
</simpleType>
<!--
End of schema.
-->
</schema>

View file

@ -2,7 +2,7 @@
<schema targetNamespace="urn:ietf:params:xml:ns:host-1.0"
xmlns:host="urn:ietf:params:xml:ns:host-1.0"
xmlns:epp="urn:ietf:params:xml:ns:epp-1.0"
xmlns:epp="https://epp.tld.ee/schema/epp-ee-1.0.xsd"
xmlns:eppcom="urn:ietf:params:xml:ns:eppcom-1.0"
xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
@ -10,7 +10,7 @@
Import common element types.
-->
<import namespace="urn:ietf:params:xml:ns:eppcom-1.0"/>
<import namespace="urn:ietf:params:xml:ns:epp-1.0"/>
<import namespace="https://epp.tld.ee/schema/epp-ee-1.0.xsd"/>
<annotation>
<documentation>

View file

@ -2,7 +2,7 @@
<schema targetNamespace="urn:ietf:params:xml:ns:keyrelay-1.0"
xmlns:keyrelay="urn:ietf:params:xml:ns:keyrelay-1.0"
xmlns:epp="urn:ietf:params:xml:ns:epp-1.0"
xmlns:epp="https://epp.tld.ee/schema/epp-ee-1.0.xsd"
xmlns:eppcom="urn:ietf:params:xml:ns:eppcom-1.0"
xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1"
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"
@ -16,7 +16,7 @@
</documentation>
</annotation>
<import namespace="urn:ietf:params:xml:ns:epp-1.0"/>
<import namespace="https://epp.tld.ee/schema/epp-ee-1.0.xsd"/>
<import namespace="urn:ietf:params:xml:ns:eppcom-1.0"/>
<import namespace="urn:ietf:params:xml:ns:secDNS-1.1"/>
<import namespace="urn:ietf:params:xml:ns:domain-1.0"/>

View file

@ -0,0 +1,50 @@
require 'rails_helper'
RSpec.describe Repp::ContactV1, db: true do
let(:user) { FactoryGirl.create(:api_user, registrar: registrar) }
let(:registrar) { FactoryGirl.create(:registrar) }
describe '/contacts' do
let(:returned_attributes) { HashWithIndifferentAccess.new(JSON.parse(response.body)['contacts'].first).keys }
subject(:address_included) { Contact.address_attribute_names.any? { |attr| returned_attributes.include?(attr.to_s) } }
before do
Grape::Endpoint.before_each do |endpoint|
allow(endpoint).to receive(:current_user).and_return(user)
end
registrar.contacts << FactoryGirl.create(:contact)
end
it 'responds with success' do
get '/repp/v1/contacts', { limit: 1, details: true }, { 'HTTP_AUTHORIZATION' => http_auth_key }
expect(response).to have_http_status(:success)
end
context 'when address processing is enabled' do
before do
expect(Contact).to receive(:address_processing?).and_return(true)
get '/repp/v1/contacts', { limit: 1, details: true }, { 'HTTP_AUTHORIZATION' => http_auth_key }
end
it 'returns contact address' do
expect(address_included).to be_truthy
end
end
context 'when address processing is disabled' do
before do
expect(Contact).to receive(:address_processing?).and_return(false)
get '/repp/v1/contacts', { limit: 1, details: true }, { 'HTTP_AUTHORIZATION' => http_auth_key }
end
it 'does not return contact address' do
expect(address_included).to be_falsy
end
end
end
def http_auth_key
ActionController::HttpAuthentication::Basic.encode_credentials(user.username, user.password)
end
end

View file

@ -4,5 +4,9 @@ FactoryGirl.define do
password 'a' * 6
roles ['super']
registrar
factory :api_user_epp do
roles %w(epp static_registrant)
end
end
end

View file

@ -39,4 +39,10 @@ RSpec.describe AdminUser do
expect(described_class.min_password_length).to eq(8)
end
end
describe '#min_password_length' do
it 'returns minimum password length' do
expect(described_class.min_password_length).to eq(8)
end
end
end

View file

@ -164,7 +164,10 @@ RSpec.describe Contact do
it 'should have code' do
registrar = Fabricate.create(:registrar, code: 'registrarcode')
contact = Fabricate.create(:contact, registrar: registrar, code: 'contactcode')
contact = Fabricate.build(:contact, registrar: registrar, code: 'contactcode')
contact.generate_code
contact.save!
expect(contact.code).to eq('REGISTRARCODE:CONTACTCODE')
end
@ -252,16 +255,6 @@ RSpec.describe Contact do
end
context 'after create' do
it 'should not generate a new code when code is present' do
@contact = Fabricate.build(:contact,
registrar: Fabricate(:registrar, code: 'FIXED'),
code: 'FIXED:new-code',
auth_info: 'qwe321')
@contact.code.should == 'FIXED:new-code' # still new record
@contact.save.should == true
@contact.code.should == 'FIXED:NEW-CODE'
end
it 'should not allow to use same code' do
registrar = Fabricate.create(:registrar, code: 'FIXED')
@ -299,12 +292,15 @@ RSpec.describe Contact do
end
it 'should generate code if empty code is given' do
@contact = Fabricate(:contact, code: '')
@contact = Fabricate.build(:contact, code: '')
@contact.generate_code
@contact.save!
@contact.code.should_not == ''
end
it 'should not ignore empty spaces as code and generate new one' do
@contact = Fabricate.build(:contact, code: ' ', registrar: Fabricate(:registrar, code: 'FIXED'))
@contact.generate_code
@contact.valid?.should == true
@contact.code.should =~ /FIXED:..../
end
@ -316,6 +312,7 @@ RSpec.describe Contact do
registrar: Fabricate(:registrar, code: 'FIXED'),
code: '123asd',
auth_info: 'qwe321')
@contact.generate_code
@contact.save
@contact.code.should == 'FIXED:123ASD'
@auth_info = @contact.auth_info
@ -383,4 +380,87 @@ RSpec.describe Contact, db: false do
expect(described_class.emails).to eq('emails')
end
end
describe '::address_processing?' do
before do
Setting.address_processing = 'test'
end
it 'returns setting value' do
expect(described_class.address_processing?).to eq('test')
end
end
describe '::address_attribute_names', db: false do
it 'returns address attributes' do
attributes = %w(
city
street
zip
country_code
state
)
expect(described_class.address_attribute_names).to eq(attributes)
end
end
describe 'address validation', db: false do
let(:contact) { described_class.new }
subject(:errors) { contact.errors }
required_attributes = %i(street city zip country_code)
context 'when address processing is enabled' do
before do
allow(described_class).to receive(:address_processing?).and_return(true)
end
required_attributes.each do |attr_name|
it "rejects absent #{attr_name}" do
contact.send("#{attr_name}=", nil)
contact.validate
expect(errors).to have_key(attr_name)
end
end
end
context 'when address processing is disabled' do
before do
allow(described_class).to receive(:address_processing?).and_return(false)
end
required_attributes.each do |attr_name|
it "accepts absent #{attr_name}" do
contact.send("#{attr_name}=", nil)
contact.validate
expect(errors).to_not have_key(attr_name)
end
end
end
end
describe 'country code validation' do
let(:contact) { described_class.new(country_code: 'test') }
it 'rejects invalid' do
contact.country_code = 'invalid'
contact.validate
expect(contact.errors).to have_key(:country_code)
end
end
describe '#remove_address' do
let(:contact) { described_class.new(city: 'test',
street: 'test',
zip: 'test',
country_code: 'test',
state: 'test')
}
subject(:address_removed) { contact.attributes.slice(*described_class.address_attribute_names).compact.empty? }
it 'removes address attributes' do
contact.remove_address
expect(address_removed).to be_truthy
end
end
end

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,57 @@
require 'rails_helper'
RSpec.describe 'EPP contact:update' do
let(:request_xml) { '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<info>
<contact:info xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd">
<contact:id>test</contact:id>
</contact:info>
</info>
</command>
</epp>'
}
subject(:response_xml) { Nokogiri::XML(response.body) }
subject(:response_code) { response_xml.xpath('//xmlns:result').first['code'] }
subject(:address_count) { response_xml
.xpath('//contact:addr', contact: 'https://epp.tld.ee/schema/contact-ee-1.1.xsd')
.count }
before do
sign_in_to_epp_area
FactoryGirl.create(:contact, code: 'TEST')
end
context 'when address processing is enabled' do
before do
allow(Contact).to receive(:address_processing?).and_return(true)
end
it 'returns epp code of 1000' do
post '/epp/command/info', frame: request_xml
expect(response_code).to eq('1000')
end
it 'returns address' do
post '/epp/command/info', frame: request_xml
expect(address_count).to_not be_zero
end
end
context 'when address processing is disabled' do
before do
allow(Contact).to receive(:address_processing?).and_return(false)
end
it 'returns epp code of 1000' do
post '/epp/command/info', frame: request_xml
expect(response_code).to eq('1000')
end
it 'does not return address' do
post '/epp/command/info', frame: request_xml
expect(address_count).to be_zero
end
end
end

File diff suppressed because one or more lines are too long

View file

@ -1,8 +1,8 @@
module Requests
module SessionHelpers
def sign_in_to_epp_area(user: FactoryGirl.create(:api_user))
def sign_in_to_epp_area(user: FactoryGirl.create(:api_user_epp))
login_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>
<epp xmlns=\"urn:ietf:params:xml:ns:epp-1.0\">
<epp xmlns=\"https://epp.tld.ee/schema/epp-ee-1.0.xsd\">
<command>
<login>
<clID>#{user.username}</clID>
@ -13,7 +13,7 @@ module Requests
</options>
<svcs>
<objURI>https://epp.tld.ee/schema/domain-eis-1.0.xsd</objURI>
<objURI>https://epp.tld.ee/schema/contact-eis-1.0.xsd</objURI>
<objURI>https://epp.tld.ee/schema/contact-ee-1.1.xsd</objURI>
<objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
<objURI>urn:ietf:params:xml:ns:keyrelay-1.0</objURI>
<svcExtension>