mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +02:00
Story: #104525314 - enable registrantChangeProhibited and enforce in Epp::Domain#update
This commit is contained in:
parent
8744f23928
commit
339885cd3d
4 changed files with 19 additions and 9 deletions
|
@ -49,14 +49,17 @@ class Epp::DomainsController < EppController
|
|||
|
||||
def update
|
||||
authorize! :update, @domain, @password
|
||||
|
||||
if @domain.update(params[:parsed_frame], current_user)
|
||||
if @domain.epp_pending_update.present?
|
||||
render_epp_response '/epp/domains/success_pending'
|
||||
begin
|
||||
if @domain.update(params[:parsed_frame], current_user)
|
||||
if @domain.epp_pending_update.present?
|
||||
render_epp_response '/epp/domains/success_pending'
|
||||
else
|
||||
render_epp_response '/epp/domains/success'
|
||||
end
|
||||
else
|
||||
render_epp_response '/epp/domains/success'
|
||||
handle_errors(@domain)
|
||||
end
|
||||
else
|
||||
rescue
|
||||
handle_errors(@domain)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,6 +16,10 @@ class Domain < ActiveRecord::Base
|
|||
has_many :tech_domain_contacts
|
||||
accepts_nested_attributes_for :tech_domain_contacts, allow_destroy: !:tech_change_prohibited?, reject_if: :tech_change_prohibited?
|
||||
|
||||
def registrant_change_prohibited?
|
||||
statuses.include? DomainStatus::SERVER_REGISTRANT_CHANGE_PROHIBITED
|
||||
end
|
||||
|
||||
|
||||
# NB! contacts, admin_contacts, tech_contacts are empty for a new record
|
||||
has_many :domain_contacts, dependent: :destroy
|
||||
|
|
|
@ -127,7 +127,7 @@ class DomainStatus < ActiveRecord::Base
|
|||
SERVER_MANUAL_INZONE,
|
||||
SERVER_RENEW_PROHIBITED,
|
||||
SERVER_TRANSFER_PROHIBITED,
|
||||
# SERVER_REGISTRANT_CHANGE_PROHIBITED,
|
||||
SERVER_REGISTRANT_CHANGE_PROHIBITED,
|
||||
SERVER_ADMIN_CHANGE_PROHIBITED,
|
||||
SERVER_TECH_CHANGE_PROHIBITED,
|
||||
SERVER_UPDATE_PROHIBITED,
|
||||
|
@ -143,7 +143,7 @@ class DomainStatus < ActiveRecord::Base
|
|||
# [''],
|
||||
['RenewProhibited', SERVER_RENEW_PROHIBITED],
|
||||
['TransferProhibited', SERVER_TRANSFER_PROHIBITED],
|
||||
# ['RegistrantChangeProhibited', SERVER_REGISTRANT_CHANGE_PROHIBITED],
|
||||
['RegistrantChangeProhibited', SERVER_REGISTRANT_CHANGE_PROHIBITED],
|
||||
['AdminChangeProhibited', SERVER_ADMIN_CHANGE_PROHIBITED],
|
||||
['TechChangeProhibited', SERVER_TECH_CHANGE_PROHIBITED],
|
||||
# [''],
|
||||
|
|
|
@ -149,6 +149,9 @@ class Epp::Domain < Domain
|
|||
|
||||
code = frame.css('registrant').first.try(:text)
|
||||
if code.present?
|
||||
if action == 'chg' && registrant_change_prohibited?
|
||||
add_epp_error('2304', nil, DomainStatus::SERVER_REGISTRANT_CHANGE_PROHIBITED, I18n.t(:object_status_prohibits_operation))
|
||||
end
|
||||
regt = Registrant.find_by(code: code)
|
||||
if regt
|
||||
at[:registrant_id] = regt.id
|
||||
|
@ -433,7 +436,7 @@ class Epp::Domain < Domain
|
|||
def update(frame, current_user, verify = true)
|
||||
return super if frame.blank?
|
||||
at = {}.with_indifferent_access
|
||||
at.deep_merge!(attrs_from(frame.css('chg'), current_user))
|
||||
at.deep_merge!(attrs_from(frame.css('chg'), current_user, 'chg'))
|
||||
at.deep_merge!(attrs_from(frame.css('rem'), current_user, 'rem'))
|
||||
|
||||
at_add = attrs_from(frame.css('add'), current_user)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue