Merge branch 'staging' into registry-355

This commit is contained in:
Artur Beljajev 2017-01-25 12:41:42 +02:00 committed by GitHub
commit 10579625de
44 changed files with 597 additions and 243 deletions

View file

@ -1,6 +1,10 @@
24.01.2017
* Disallow EPP domain:update/transfer/delete if a domain has "deleteCandidate" status
08.01.2017
* EPP XML schema "eis-1.0.xsd" replaced with "ee-1.1.xsd"
* .ddoc legal document format support dropped
22.12.2016
* Return business registry code and country for 'org' type registrants in WHOIS and Rest-WHOIS

View file

@ -84,7 +84,7 @@ gem 'deep_cloneable', '2.1.1'
gem 'digidoc_client', '0.2.1'
gem 'epp', '1.5.0', github: 'internetee/epp'
gem 'epp-xml', '1.1.0', github: 'internetee/epp-xml'
gem 'epp-xml', github: 'internetee/epp-xml', branch: 'epp-xml-6'
gem 'uuidtools', '2.1.5' # For unique IDs (used by the epp gem)
# que

View file

@ -18,9 +18,10 @@ GIT
GIT
remote: https://github.com/internetee/epp-xml.git
revision: 5dd542e67ef26d58365f30e553254d6db809277d
revision: e483de16c06856a2d0dfe29aef74ddcbc901704b
branch: epp-xml-6
specs:
epp-xml (1.1.0)
epp-xml (2.0.0)
activesupport (~> 4.1)
builder (~> 3.2)
@ -594,7 +595,7 @@ DEPENDENCIES
devise (= 3.5.4)
digidoc_client (= 0.2.1)
epp (= 1.5.0)!
epp-xml (= 1.1.0)!
epp-xml!
fabrication (= 2.13.2)
factory_girl_rails
figaro (= 1.1.1)

View file

@ -14,7 +14,7 @@ class Registrar::DomainsController < Registrar::DeppController # EPP controller
if params[:q].length == 1 && params[:q][:name_matches].present?
@domain = Domain.find_by(name: params[:q][:name_matches])
if @domain
redirect_to info_registrar_domains_path(domain_name: @domain.name) and return
redirect_to info_registrar_domains_url(domain_name: @domain.name) and return
end
end
@ -40,6 +40,20 @@ class Registrar::DomainsController < Registrar::DeppController # EPP controller
end
@domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0
respond_to do |format|
format.html
format.csv do
domain_presenters = []
@domains.find_each do |domain|
domain_presenters << ::DomainPresenter.new(domain: domain, view: view_context)
end
csv = Registrar::DomainListCSVPresenter.new(domains: domain_presenters, view: view_context).to_s
send_data(csv)
end
end
end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity

View file

@ -3,8 +3,13 @@ class Registrar::PollsController < Registrar::DeppController # EPP controller
before_action :init_epp_xml
def show
if Rails.env.test? # Stub for depp server request
@data = Object.new
def @data.css(key); []; end
else
@data = depp_current_user.request(@ex.poll)
end
end
def destroy
@data = depp_current_user.request(@ex.poll(poll: {

View file

@ -11,12 +11,16 @@ class ApiUser < User
}
end
def self.min_password_length # Must precede .validates
6
end
# TODO: should have max request limit per day?
belongs_to :registrar
has_many :certificates
validates :username, :password, :registrar, :roles, presence: true
validates :password, length: { minimum: 6 }
validates :password, length: { minimum: min_password_length }
validates :username, uniqueness: true
# TODO: probably cache, because it's requested on every EPP

View file

@ -6,7 +6,7 @@ class LegalDocument < ActiveRecord::Base
if ENV['legal_document_types'].present?
TYPES = ENV['legal_document_types'].split(',').map(&:strip)
else
TYPES = %w(pdf bdoc ddoc zip rar gz tar 7z odt doc docx).freeze
TYPES = %w(pdf bdoc zip rar gz tar 7z odt doc docx).freeze
end
attr_accessor :body
@ -64,7 +64,7 @@ class LegalDocument < ActiveRecord::Base
def self.remove_duplicates
start = Time.zone.now.to_f
puts '-----> Removing legal documents duplicates'
Rails.logger.info '-----> Removing legal documents duplicates'
count = 0
modified = Array.new
@ -80,7 +80,7 @@ class LegalDocument < ActiveRecord::Base
File.delete(new_legal.path) if File.exist?(new_legal.path)
new_legal.update(path: orig_legal.path)
count += 1
puts "File #{new_legal.path} has been removed by Domain #{new_legal.documentable_id}. Document id: #{new_legal.id}"
Rails.logger.info "File #{new_legal.path} has been removed by Domain #{new_legal.documentable_id}. Document id: #{new_legal.id}"
end
end
@ -104,11 +104,11 @@ class LegalDocument < ActiveRecord::Base
File.delete(new_legal.path) if File.exist?(new_legal.path)
new_legal.update(path: orig_legal.path)
count += 1
puts "File #{new_legal.path} has been removed by Contact #{new_legal.documentable_id}. Document id: #{new_legal.id}"
Rails.logger.info "File #{new_legal.path} has been removed by Contact #{new_legal.documentable_id}. Document id: #{new_legal.id}"
end
end
end
puts "-----> Duplicates fixed for #{count} rows in #{(Time.zone.now.to_f - start).round(2)} seconds"
Rails.logger.info "-----> Duplicates fixed for #{count} rows in #{(Time.zone.now.to_f - start).round(2)} seconds"
end
end

View file

@ -1,5 +1,5 @@
class DomainPresenter
delegate :name, :registrant_name, :registrant_id, to: :domain
delegate :name, :registrant_name, :registrant_id, :registrant_code, to: :domain
def initialize(domain:, view:)
@domain = domain

View file

@ -0,0 +1,45 @@
class Registrar::DomainListCSVPresenter
def initialize(domains:, view:)
@domains = domains
@view = view
end
def to_s
table = CSV::Table.new([header])
domains.each do |domain|
table << domain_to_row(domain: domain)
end
table.to_s
end
private
def header
columns = %w(
domain_name
registrant_name
registrant_code
expire_time
)
columns.map! { |column| view.t("registrar.domains.index.csv.#{column}") }
CSV::Row.new(columns, [], true)
end
def domain_to_row(domain:)
row = []
row[0] = domain.name
row[1] = domain.registrant_name
row[2] = domain.registrant_code
row[3] = domain.expire_date
row
CSV::Row.new([], row)
end
attr_reader :domains
attr_reader :view
end

View file

@ -80,7 +80,7 @@ xml.epp_head do
end
if can? :view_full_info, @contact, @password
xml.tag!('extension') do
xml.tag!('eis:extdata', 'xmlns:eis' => 'https://epp.tld.ee/schema/eis-1.0.xsd') do
xml.tag!('eis:extdata', 'xmlns:eis' => 'https://epp.tld.ee/schema/ee-1.1.xsd') do
xml.tag!('eis:ident', @contact.ident,
type: @contact.ident_type, cc: @contact.ident_country_code)
end

View file

@ -11,7 +11,7 @@ xml.epp_head do
xml.objURI 'urn:ietf:params:xml:ns:keyrelay-1.0'
xml.svcExtension do
xml.extURI 'urn:ietf:params:xml:ns:secDNS-1.1'
xml.extURI 'https://epp.tld.ee/schema/eis-1.0.xsd'
xml.extURI 'https://epp.tld.ee/schema/ee-1.1.xsd'
end
end

View file

@ -52,6 +52,10 @@
&nbsp;
%button.btn.btn-default.js-reset-form
= t(:clear_fields)
.row
.col-md-2
= button_tag t('.export_csv_btn'), class: 'btn btn-primary export-domains-csv-btn',
formaction: registrar_domains_path(format: 'csv')
%hr
.row

View file

@ -20,7 +20,7 @@
</contact:create>
</create>
<extension>
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/ee-1.1.xsd">
<eis:ident type="org" cc="EE">123</eis:ident>
<eis:legalDocument type="pdf">
dGVzdCBmYWlsCg==

View file

@ -11,7 +11,7 @@
</contact:delete>
</delete>
<extension>
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/ee-1.1.xsd">
<eis:legalDocument type="pdf">
dGVzdCBmYWlsCg==
</eis:legalDocument>

View file

@ -25,7 +25,7 @@
</contact:update>
</update>
<extension>
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/ee-1.1.xsd">
<eis:legalDocument type="pdf">
dGVzdCBmYWlsCg==
</eis:legalDocument>

View file

@ -31,7 +31,7 @@
<secDNS:pubKey>AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8</secDNS:pubKey>
</secDNS:keyData>
</secDNS:create>
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/ee-1.1.xsd">
<eis:legalDocument type="pdf">
dGVzdCBmYWlsCg==
</eis:legalDocument>

View file

@ -8,7 +8,7 @@
</domain:delete>
</delete>
<extension>
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/ee-1.1.xsd">
<eis:legalDocument type="pdf">
dGVzdCBmYWlsCg==
</eis:legalDocument>

View file

@ -11,7 +11,7 @@
</domain:transfer>
</transfer>
<extension>
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/ee-1.1.xsd">
<eis:legalDocument type="pdf">
dGVzdCBmYWlsCg==
</eis:legalDocument>

View file

@ -43,7 +43,7 @@
</secDNS:keyData>
</secDNS:rem>
</secDNS:update>
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/ee-1.1.xsd">
<eis:legalDocument type="pdf">
dGVzdCBmYWlsCg==
</eis:legalDocument>

View file

@ -16,7 +16,7 @@
<ext:relative>P1D</ext:relative>
</ext:expiry>
</ext:keyrelay>
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/ee-1.1.xsd">
<eis:legalDocument type="pdf">dGVzdCBmYWlsCg==</eis:legalDocument>
</eis:extdata>
<ext:clTRID>1422542244</ext:clTRID>

View file

@ -66,8 +66,8 @@ contact_org_enabled: 'false'
# iptables_server_ip: '127.0.0.1'
# Custom legal document types. Changing this requires updating EPP extension schema for allowed legalDocEnumType values.
# System default for legal document types is: pdf,bdoc,ddoc,zip,rar,gz,tar,7z,odt,doc,docx
# legal_document_types: "pdf,bdoc,ddoc,zip,rar,gz,tar,7z,odt,doc,docx"
# System default for legal document types is: pdf,bdoc,zip,rar,gz,tar,7z,odt,doc,docx
# legal_document_types: "pdf,bdoc,zip,rar,gz,tar,7z,odt,doc,docx"
#

View file

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

View file

@ -0,0 +1,10 @@
en:
registrar:
domains:
index:
export_csv_btn: Export CSV
csv:
domain_name: Domain
registrant_name: Registrant name
registrant_code: Registrant code
expire_time: Date of expiry

File diff suppressed because it is too large Load diff

View file

@ -30,7 +30,9 @@
### .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)
* [all-ee-1.2.xsd](/lib/schemas/all-ee-1.2.xsd)
* [eis-1.0.xsd](/lib/schemas/eis-1.0.xsd)
* [ee-1.1.xsd](/lib/schemas/ee-1.1.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)

View file

@ -35,7 +35,7 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode
<contact:fax> 0 Fax is not supported and must be blank or missing
<contact:email> 1 E-mail
<extension> 1
<eis:extdata> 1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd"
<eis:extdata> 1 Attribute: xmlns:eis="https://epp.tld.ee/schema/ee-1.1.xsd"
<eis:ident> 1 Contact identificator
Attribute: "type"
"org" # Business registry code
@ -44,7 +44,7 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode
Attribute: "cc"
"EE" # Country code in ISO_3166-1 aplha 2
<eis:legalDocument> 0-1 Base64 encoded document
Attribute: type="pdf/bdoc/ddoc/zip/rar/gz/tar/7z"
Attribute: type="pdf/bdoc/zip/rar/gz/tar/7z"
<clTRID> 0-1 Client transaction id
[EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-contact-with-valid-user-create-command-successfully-creates-a-contact)
@ -72,7 +72,7 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode
<contact:authInfo> 0-1 Required if registrar is not the owner of the contact.
<contact:pw> 1 Contact password. Attribute: roid="String"
<extension> 0-1
<eis:extdata> 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd"
<eis:extdata> 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/ee-1.1.xsd"
<eis:ident> 0-1 Contact identificator
Attribute: "type"
"org" # Business registry code
@ -81,7 +81,7 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode
Attribute: "cc"
"EE" # Country code in ISO_3166-1 aplha 2
<eis:legalDocument> 0-1 Base64 encoded document.
Attribute: type="pdf/bdoc/ddoc/zip/rar/gz/tar/7z"
Attribute: type="pdf/bdoc/zip/rar/gz/tar/7z"
<clTRID> 0-1 Client transaction id
@ -97,9 +97,9 @@ More info: https://en.wikipedia.org/wiki/Latin_script_in_Unicode
<contact:authInfo> 0-1 Required if registrar is not the owner of the contact.
<contact:pw> 1 Contact password. Attribute: roid="String"
<extension> 0-1
<eis:extdata> 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd"
<eis:extdata> 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/ee-1.1.xsd"
<eis:legalDocument> 0-1 Base64 encoded document.
Attribute: type="pdf/bdoc/ddoc/zip/rar/gz/tar/7z"
Attribute: type="pdf/bdoc/zip/rar/gz/tar/7z"
<clTRID> 0-1 Client transaction id
[EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-contact-with-valid-user-delete-command-deletes-contact)

View file

@ -34,9 +34,9 @@ Domain name mapping protocol short version:
<secDNS:protocol> 1 Allowed values: 3
<secDNS:alg> 1 Allowed values: 3, 5, 6, 7, 8, 10, 13, 14
<secDNS:pubKey> 1 Public key
<eis:extdata> 1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd"
<eis:extdata> 1 Attribute: xmlns:eis="https://epp.tld.ee/schema/ee-1.1.xsd"
<eis:legalDocument> 1 Base64 encoded document.
Attribute: type="pdf/bdoc/ddoc/zip/rar/gz/tar/7z"
Attribute: type="pdf/bdoc/zip/rar/gz/tar/7z"
<eis:reserved> 0-1
<eis:pw> 0-1 Required if registering a reserved domain
<clTRID> 0-1 Client transaction id
@ -83,9 +83,9 @@ Domain name mapping protocol short version:
<secDNS:protocol> 1 Allowed values: 3
<secDNS:alg> 1 Allowed values: 3, 5, 6, 7, 8, 10, 13, 14
<secDNS:pubKey> 1 Public key
<eis:extdata> 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd"
<eis:extdata> 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/ee-1.1.xsd"
<eis:legalDocument> 0-1 Base64 encoded document. Required if registrant is changing.
Attribute: type="pdf/bdoc/ddoc/zip/rar/gz/tar/7z"
Attribute: type="pdf/bdoc/zip/rar/gz/tar/7z"
<clTRID> 0-1 Client transaction id
[EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-domain-with-valid-domain-updates-domain-and-adds-objects)
@ -99,9 +99,9 @@ Domain name mapping protocol short version:
Optional attribute: verified="yes/no"
<domain:name> 1 Domain name. Can contain unicode characters.
<extension> 1
<eis:extdata> 1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd"
<eis:extdata> 1 Attribute: xmlns:eis="https://epp.tld.ee/schema/ee-1.1.xsd"
<eis:legalDocument> 1 Base64 encoded document.
Attribute: type="pdf/bdoc/ddoc/zip/rar/gz/tar/7z"
Attribute: type="pdf/bdoc/zip/rar/gz/tar/7z"
<clTRID> 0-1 Client transaction id
[EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-domain-with-valid-domain-deletes-domain)
@ -132,9 +132,9 @@ Domain name mapping protocol short version:
Must add up to 1 / 2 / 3 years. Attribute: unit="y/m/d"
Default value is 1 year.
<extension> 0-1
<eis:extdata> 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd"
<eis:extdata> 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/ee-1.1.xsd"
<eis:legalDocument> 0-1 Base64 encoded document.
Attribute: type="pdf/bdoc/ddoc/zip/rar/gz/tar/7z"
Attribute: type="pdf/bdoc/zip/rar/gz/tar/7z"
<clTRID> 0-1 Client transaction id
[EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-domain-with-valid-domain-renews-a-domain)
@ -149,9 +149,9 @@ Domain name mapping protocol short version:
<domain:authInfo> 1
<domain:pw> 1 Domain password. Attribute: roid="String"
<extension> 0-1
<eis:extdata> 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd"
<eis:extdata> 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/ee-1.1.xsd"
<eis:legalDocument> 0-1 Base64 encoded document.
Attribute: type="pdf/bdoc/ddoc/zip/rar/gz/tar/7z"
Attribute: type="pdf/bdoc/zip/rar/gz/tar/7z"
<clTRID> 0-1 Client transaction id
[EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-domain-with-valid-domain-transfers-a-domain)

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.2"
xmlns:all="https://epp.tld.ee/schema/all-ee-1.2"
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/ee-1.1"
schemaLocation="lib/schemas/ee-1.1.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.2
all schema's grouped together
</documentation>
</annotation>
</schema>

View file

@ -12,7 +12,7 @@
-->
<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"/>
<import namespace="https://epp.tld.ee/schema/ee-1.1.xsd"/>
<annotation>
<documentation>

View file

@ -15,7 +15,7 @@ Import common element types.
<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"/>
<import namespace="https://epp.tld.ee/schema/ee-1.1.xsd"/>
<annotation>
<documentation>

104
lib/schemas/ee-1.1.xsd Normal file
View file

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="UTF-8"?>
<schema
targetNamespace="https://epp.tld.ee/schema/ee-1.1.xsd"
xmlns:eis="https://epp.tld.ee/schema/ee-1.1.xsd"
xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<annotation>
<documentation>
EIS Extensible Provisioning Protocol v1.1 extension schema.
</documentation>
</annotation>
<!--
Child elements found in EPP commands.
-->
<element name="extdata" type="eis:eisExtType"/>
<!--
Child elements supporting EIS specific values.
-->
<complexType name="eisExtType">
<sequence>
<element name="ident" type="eis:identType" minOccurs="0" maxOccurs="1"/>
<element name="legalDocument" type="eis:legalDocType" minOccurs="0" maxOccurs="1"/>
<element name="reserved" type="eis:reservedType" minOccurs="0" maxOccurs="1"/>
</sequence>
</complexType>
<!--
Child elements of extdata
-->
<!--
Reserved for providing passwords for reserved domains
-->
<complexType name="reservedType">
<sequence>
<element name="pw" type="eis:pwType" minOccurs="0" maxOccurs="1"/>
</sequence>
</complexType>
<simpleType name="pwType">
<restriction base="normalizedString">
<minLength value="1"/>
<maxLength value="255"/>
</restriction>
</simpleType>
<!--
Legal document, encoded in base64
-->
<complexType name="legalDocType">
<simpleContent>
<extension base="base64Binary">
<attribute name="type" type="eis:legalDocEnumType" use="required"/>
</extension>
</simpleContent>
</complexType>
<simpleType name="legalDocEnumType">
<restriction base="token">
<enumeration value="pdf"/>
<enumeration value="bdoc"/>
<enumeration value="zip"/>
<enumeration value="rar"/>
<enumeration value="gz"/>
<enumeration value="tar"/>
<enumeration value="7z"/>
<enumeration value="odt"/>
<enumeration value="doc"/>
<enumeration value="docx"/>
</restriction>
</simpleType>
<!--
Ident with type and country code
-->
<complexType name="identType">
<simpleContent>
<extension base="normalizedString">
<attribute name="type" type="eis:identEnumType" use="required"/>
<attribute name="cc" type="eis:ccType"/>
</extension>
</simpleContent>
</complexType>
<simpleType name="identEnumType">
<restriction base="token">
<enumeration value="org"/>
<enumeration value="priv"/>
<enumeration value="birthday"/>
</restriction>
</simpleType>
<simpleType name="ccType">
<restriction base="normalizedString">
<minLength value="2"/>
<maxLength value="2"/>
</restriction>
</simpleType>
</schema>

View file

@ -1,12 +1,18 @@
FactoryGirl.define do
factory :api_user do
sequence(:username) { |n| "test#{n}" }
password 'a' * 6
password 'a' * ApiUser.min_password_length
roles ['super']
registrar
factory :api_user_epp do
roles %w(epp static_registrant)
end
factory :api_user_with_unlimited_balance do
after :build do |api_user|
api_user.registrar = create(:registrar_with_unlimited_balance)
end
end
end
end

View file

@ -9,5 +9,11 @@ FactoryGirl.define do
zip 'test'
email 'test@test.com'
country_code 'EE'
factory :registrar_with_unlimited_balance do
after :create do |registrar|
create(:account, registrar: registrar, balance: 1_000_000)
end
end
end
end

View file

@ -0,0 +1,14 @@
require 'rails_helper'
RSpec.feature 'CSV Export' do
background do
Setting.api_ip_whitelist_enabled = false
Setting.registrar_ip_whitelist_enabled = false
sign_in_to_registrar_area(user: create(:api_user_with_unlimited_balance))
end
scenario 'exports csv' do
visit registrar_domains_url
click_button t('registrar.domains.index.export_csv_btn')
end
end

View file

@ -1,6 +1,6 @@
require 'rails_helper'
describe ApiUser do
RSpec.describe ApiUser do
context 'class methods' do
before do
Fabricate(:api_user, identity_code: '')
@ -26,7 +26,7 @@ describe ApiUser do
@api_user.valid?
@api_user.errors.full_messages.should match_array([
"Password Password is missing",
"Password is too short (minimum is 6 characters)",
"Password is too short (minimum is #{ApiUser.min_password_length} characters)",
"Registrar Registrar is missing",
"Username Username is missing",
"Roles is missing"
@ -68,4 +68,10 @@ describe ApiUser do
end
end
end
describe '::min_password_length', db: false do
it 'returns minimum password length' do
expect(described_class.min_password_length).to eq(6)
end
end
end

View file

@ -153,6 +153,7 @@ RSpec.describe DomainPresenter do
name
registrant_name
registrant_id
registrant_code
)
domain_delegatable_attributes.each do |attribute_name|

View file

@ -0,0 +1,45 @@
require 'rails_helper'
RSpec.describe Registrar::DomainListCSVPresenter do
let(:domain) { instance_spy(DomainPresenter) }
let(:csv) { CSV.parse(described_class.new(domains: [domain], view: view).to_s, converters: :all) }
describe 'header' do
subject(:header) { csv.first }
it 'is present' do
columns = []
columns[0] = 'Domain'
columns[1] = 'Registrant name'
columns[2] = 'Registrant code'
columns[3] = 'Date of expiry'
columns
expect(header).to eq(columns)
end
end
describe 'row' do
subject(:row) { csv.second }
it 'has domain name' do
expect(domain).to receive(:name).and_return('test name')
expect(row[0]).to eq('test name')
end
it 'has registrant name' do
expect(domain).to receive(:registrant_name).and_return('test registrant name')
expect(row[1]).to eq('test registrant name')
end
it 'has registrant code' do
expect(domain).to receive(:registrant_code).and_return('test registrant code')
expect(row[2]).to eq('test registrant code')
end
it 'has expire date' do
expect(domain).to receive(:expire_date).and_return('expire date')
expect(row[3]).to eq('expire date')
end
end
end

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -52,7 +52,7 @@ RSpec.describe 'EPP domain:create' do
</domain:create>
</create>
<extension>
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/ee-1.1.xsd">
<eis:legalDocument type="pdf">#{Base64.encode64('a' * 5000)}</eis:legalDocument>
</eis:extdata>
</extension>
@ -95,7 +95,7 @@ RSpec.describe 'EPP domain:create' do
</domain:create>
</create>
<extension>
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/ee-1.1.xsd">
<eis:legalDocument type="pdf">#{Base64.encode64('a' * 5000)}</eis:legalDocument>
</eis:extdata>
</extension>

View file

@ -53,7 +53,7 @@ RSpec.describe 'EPP domain:create' do
</domain:create>
</create>
<extension>
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/ee-1.1.xsd">
<eis:legalDocument type="pdf">#{Base64.encode64('a' * 5000)}</eis:legalDocument>
</eis:extdata>
</extension>
@ -83,7 +83,7 @@ RSpec.describe 'EPP domain:create' do
</domain:create>
</create>
<extension>
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/ee-1.1.xsd">
<eis:legalDocument type="pdf">#{Base64.encode64('a' * 5000)}</eis:legalDocument>
</eis:extdata>
</extension>

View file

@ -0,0 +1,28 @@
require 'rails_helper'
RSpec.describe Registrar::DomainsController, db: true do
describe '#index' do
before do
sign_in_to_registrar_area
end
it 'responds with success' do
csv_presenter = instance_double(Registrar::DomainListCSVPresenter, to_s: 'csv')
expect(Registrar::DomainListCSVPresenter).to receive(:new).and_return(csv_presenter)
get registrar_domains_url(format: 'csv')
expect(response.body).to eq('csv')
end
it 'returns csv' do
get registrar_domains_url(format: 'csv')
expect(response).to have_http_status(:success)
end
end
def sign_in_to_registrar_area(user: FactoryGirl.create(:api_user))
post registrar_sessions_path, { depp_user: { tag: user.username, password: user.password } }
end
end

View file

@ -0,0 +1,9 @@
require 'rails_helper'
RSpec.describe Registrar::DomainsController do
describe 'routing' do
it 'routes to #index' do
expect(get: '/registrar/domains').to route_to('registrar/domains#index')
end
end
end

View file

@ -18,7 +18,7 @@ module Requests
<objURI>urn:ietf:params:xml:ns:keyrelay-1.0</objURI>
<svcExtension>
<extURI>urn:ietf:params:xml:ns:secDNS-1.1</extURI>
<extURI>https://epp.tld.ee/schema/eis-1.0.xsd</extURI>
<extURI>https://epp.tld.ee/schema/ee-1.1.xsd</extURI>
</svcExtension>
</svcs>
</login>