mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
113524121-check_minimum_size
This commit is contained in:
parent
bd4477f962
commit
b6742c0c09
2 changed files with 24 additions and 1 deletions
|
@ -1,16 +1,26 @@
|
|||
class Epp::Contact < Contact
|
||||
include EppErrors
|
||||
|
||||
attr_accessor :legal_doc
|
||||
|
||||
# disable STI, there is type column present
|
||||
self.inheritance_column = :sti_disabled
|
||||
|
||||
before_validation :manage_permissions
|
||||
before_validation :check_legal_doc_size
|
||||
|
||||
def manage_permissions
|
||||
return unless update_prohibited? || delete_prohibited?
|
||||
add_epp_error('2304', nil, nil, I18n.t(:object_status_prohibits_operation))
|
||||
false
|
||||
end
|
||||
|
||||
def check_legal_doc_size
|
||||
if @legal_doc
|
||||
return false if @legal_doc.size < 100.kilobytes
|
||||
end
|
||||
end
|
||||
|
||||
class << self
|
||||
# support legacy search
|
||||
def find_by_epp_code(code)
|
||||
|
@ -39,6 +49,7 @@ class Epp::Contact < Contact
|
|||
legal_frame = f.css('legalDocument').first
|
||||
if legal_frame.present?
|
||||
at[:legal_documents_attributes] = legal_document_attrs(legal_frame)
|
||||
@legal_doc = legal_document_attrs(legal_frame)
|
||||
end
|
||||
at.merge!(ident_attrs(f.css('ident').first)) if new_record
|
||||
at
|
||||
|
@ -153,6 +164,7 @@ class Epp::Contact < Contact
|
|||
|
||||
legal_frame = frame.css('legalDocument').first
|
||||
at[:legal_documents_attributes] = self.class.legal_document_attrs(legal_frame)
|
||||
@legal_doc = at[:legal_documents_attributes]
|
||||
self.deliver_emails = true # turn on email delivery for epp
|
||||
|
||||
|
||||
|
|
|
@ -3,9 +3,11 @@ class Epp::Domain < Domain
|
|||
include EppErrors
|
||||
|
||||
# TODO: remove this spagetti once data in production is correct.
|
||||
attr_accessor :is_renewal, :is_transfer
|
||||
attr_accessor :is_renewal, :is_transfer, :legal_doc
|
||||
|
||||
before_validation :manage_permissions
|
||||
before_validation :check_legal_doc_size
|
||||
|
||||
def manage_permissions
|
||||
return if is_admin # this bad hack for 109086524, refactor later
|
||||
return true if is_transfer || is_renewal
|
||||
|
@ -14,6 +16,12 @@ class Epp::Domain < Domain
|
|||
false
|
||||
end
|
||||
|
||||
def check_legal_doc_size
|
||||
if @legal_doc
|
||||
return false if @legal_doc.size < 100.kilobytes
|
||||
end
|
||||
end
|
||||
|
||||
after_validation :validate_contacts
|
||||
def validate_contacts
|
||||
return true if is_renewal || is_transfer
|
||||
|
@ -195,6 +203,7 @@ class Epp::Domain < Domain
|
|||
|
||||
at[:dnskeys_attributes] = dnskeys_attrs(dnskey_frame, action)
|
||||
at[:legal_documents_attributes] = legal_document_from(frame)
|
||||
@legal_doc = at[:legal_documents_attributes]
|
||||
at
|
||||
end
|
||||
# rubocop: enable Metrics/PerceivedComplexity
|
||||
|
@ -476,6 +485,7 @@ class Epp::Domain < Domain
|
|||
|
||||
if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame))
|
||||
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted?
|
||||
@legal_doc = doc
|
||||
end
|
||||
|
||||
at_add = attrs_from(frame.css('add'), current_user, 'add')
|
||||
|
@ -545,6 +555,7 @@ class Epp::Domain < Domain
|
|||
|
||||
if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame))
|
||||
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted?
|
||||
@legal_doc = doc
|
||||
end
|
||||
|
||||
if Setting.request_confirmation_on_domain_deletion_enabled &&
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue