added abbility for added extenstions prohibited status

This commit is contained in:
olegphenomenon 2021-09-21 16:45:09 +03:00
parent f9436062a6
commit 1bb5dddd58
10 changed files with 32 additions and 25 deletions

View file

@ -8,9 +8,9 @@ module Api
before_action :authorized_to_manage_locks?
def create
p "============"
extensionsProhibited = params[:extensionsProhibited]
if @domain.apply_registry_lock
if @domain.apply_registry_lock(extensionsProhibited: extensionsProhibited.to_s.downcase == "true")
render json: serialized_domain(@domain)
else
render json: { errors: [{ base: ['Domain cannot be locked'] }] },

View file

@ -11,12 +11,16 @@ module Domain::RegistryLockable
DomainStatus::SERVER_TRANSFER_PROHIBITED].freeze
end
def apply_registry_lock
EXTENSIONS_STATUS = [DomainStatus::SERVER_EXTENSION_UPDATE_PROHIBITED].freeze
def apply_registry_lock(extensionsProhibited:)
return unless registry_lockable?
return if locked_by_registrant?
transaction do
self.statuses |= LOCK_STATUSES
self.statuses |= EXTENSIONS_STATUS if Feature.obj_and_extensions_statuses_enabled? and extensionsProhibited
self.locked_by_registrant_at = Time.zone.now
alert_registrar_lock_changes!(lock: true)
@ -44,6 +48,9 @@ module Domain::RegistryLockable
LOCK_STATUSES.each do |domain_status|
statuses.delete([domain_status])
end
statuses.delete([EXTENSIONS_STATUS]) if statuses.include? EXTENSIONS_STATUS
self.locked_by_registrant_at = nil
self.statuses = admin_store_statuses_history || []
alert_registrar_lock_changes!(lock: false)

View file

@ -17,13 +17,13 @@ class RegistrantUser < User
Country.new(alpha2_code)
end
def companies(company_register = nil)
def companies(company_register = CompanyRegister::Client.new)
return [] if ident.include?('-')
[OpenStruct.new(registration_number: '43344412', company_name: 'TestFirma'),
OpenStruct.new(registration_number: '12345678', company_name: 'SuperFirma OU')]
company_register.representation_rights(citizen_personal_code: ident,
citizen_country_code: country.alpha3)
end
def contacts(representable: true)
Contact.registrant_user_contacts(self, representable: representable)
end