mirror of
https://github.com/internetee/registry.git
synced 2025-07-06 11:13:27 +02:00
Merge pull request #50 from internetee/109086524-admin-pending-force-update
109086524 admin pending force update
This commit is contained in:
commit
cefd98e8dd
5 changed files with 34 additions and 22 deletions
|
@ -5,9 +5,7 @@ class Admin::PendingDeletesController < AdminController
|
||||||
def update
|
def update
|
||||||
authorize! :update, :pending
|
authorize! :update, :pending
|
||||||
|
|
||||||
@epp_domain = Epp::Domain.find(params[:domain_id]) # only epp domain has apply pending
|
if registrant_verification.domain_registrant_delete_confirm!
|
||||||
@epp_domain.is_admin= true
|
|
||||||
if @epp_domain.apply_pending_delete!
|
|
||||||
redirect_to admin_domain_path(@domain.id), notice: t(:pending_applied)
|
redirect_to admin_domain_path(@domain.id), notice: t(:pending_applied)
|
||||||
else
|
else
|
||||||
redirect_to admin_edit_domain_path(@domain.id), alert: t(:failure)
|
redirect_to admin_edit_domain_path(@domain.id), alert: t(:failure)
|
||||||
|
@ -17,7 +15,7 @@ class Admin::PendingDeletesController < AdminController
|
||||||
def destroy
|
def destroy
|
||||||
authorize! :destroy, :pending
|
authorize! :destroy, :pending
|
||||||
|
|
||||||
if @domain.clean_pendings!
|
if registrant_verification.domain_registrant_delete_reject!
|
||||||
redirect_to admin_domain_path(@domain.id), notice: t(:pending_removed)
|
redirect_to admin_domain_path(@domain.id), notice: t(:pending_removed)
|
||||||
else
|
else
|
||||||
redirect_to admin_domain_path(@domain.id), alert: t(:failure)
|
redirect_to admin_domain_path(@domain.id), alert: t(:failure)
|
||||||
|
@ -26,6 +24,14 @@ class Admin::PendingDeletesController < AdminController
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def registrant_verification
|
||||||
|
# steal token
|
||||||
|
token = @domain.registrant_verification_token
|
||||||
|
@registrant_verification = RegistrantVerification.new(domain_id: @domain.id,
|
||||||
|
domain_name: @domain.name,
|
||||||
|
verification_token: token)
|
||||||
|
end
|
||||||
|
|
||||||
def find_domain
|
def find_domain
|
||||||
@domain = Domain.find(params[:domain_id])
|
@domain = Domain.find(params[:domain_id])
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,8 +5,7 @@ class Admin::PendingUpdatesController < AdminController
|
||||||
def update
|
def update
|
||||||
authorize! :update, :pending
|
authorize! :update, :pending
|
||||||
|
|
||||||
@epp_domain = Epp::Domain.find(params[:domain_id]) # only epp domain has apply pending
|
if registrant_verification.domain_registrant_change_confirm!
|
||||||
if @epp_domain.apply_pending_update!
|
|
||||||
redirect_to admin_domain_path(@domain.id), notice: t(:pending_applied)
|
redirect_to admin_domain_path(@domain.id), notice: t(:pending_applied)
|
||||||
else
|
else
|
||||||
redirect_to edit_admin_domain_path(@domain.id), alert: t(:failure)
|
redirect_to edit_admin_domain_path(@domain.id), alert: t(:failure)
|
||||||
|
@ -15,14 +14,21 @@ class Admin::PendingUpdatesController < AdminController
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
authorize! :destroy, :pending
|
authorize! :destroy, :pending
|
||||||
|
if registrant_verification.domain_registrant_change_reject!
|
||||||
if @domain.clean_pendings!
|
|
||||||
redirect_to admin_domain_path(@domain.id), notice: t(:pending_removed)
|
redirect_to admin_domain_path(@domain.id), notice: t(:pending_removed)
|
||||||
else
|
else
|
||||||
redirect_to admin_domain_path(@domain.id), alert: t(:failure)
|
redirect_to admin_domain_path(@domain.id), alert: t(:failure)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def registrant_verification
|
||||||
|
# steal token
|
||||||
|
token = @domain.registrant_verification_token
|
||||||
|
@registrant_verification = RegistrantVerification.new(domain_id: @domain.id,
|
||||||
|
domain_name: @domain.name,
|
||||||
|
verification_token: token)
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def find_domain
|
def find_domain
|
||||||
|
|
|
@ -10,7 +10,7 @@ class DomainUpdateConfirmJob < Que::Job
|
||||||
e.instance_variable_set("@changed_attributes", e.changed_attributes.merge("statuses"=>[]))
|
e.instance_variable_set("@changed_attributes", e.changed_attributes.merge("statuses"=>[]))
|
||||||
end
|
end
|
||||||
domain.clean_pendings!
|
domain.clean_pendings!
|
||||||
WhoisRecord.find_by(domain_id: domain.id).save!
|
WhoisRecord.find_by(domain_id: domain.id).save
|
||||||
when RegistrantVerification::REJECTED
|
when RegistrantVerification::REJECTED
|
||||||
domain.send_mail :pending_update_rejected_notification_for_new_registrant
|
domain.send_mail :pending_update_rejected_notification_for_new_registrant
|
||||||
domain.poll_message!(:poll_pending_update_rejected_by_registrant)
|
domain.poll_message!(:poll_pending_update_rejected_by_registrant)
|
||||||
|
|
|
@ -7,6 +7,7 @@ class Epp::Domain < Domain
|
||||||
|
|
||||||
before_validation :manage_permissions
|
before_validation :manage_permissions
|
||||||
def manage_permissions
|
def manage_permissions
|
||||||
|
return if is_admin # this bad hack for 109086524, refactor later
|
||||||
return true if is_transfer
|
return true if is_transfer
|
||||||
return unless update_prohibited? || delete_prohibited?
|
return unless update_prohibited? || delete_prohibited?
|
||||||
add_epp_error('2304', nil, nil, I18n.t(:object_status_prohibits_operation))
|
add_epp_error('2304', nil, nil, I18n.t(:object_status_prohibits_operation))
|
||||||
|
|
|
@ -12,7 +12,6 @@ class RegistrantVerification < ActiveRecord::Base
|
||||||
belongs_to :domain
|
belongs_to :domain
|
||||||
|
|
||||||
validates :verification_token, :domain_name, :domain, :action, :action_type, presence: true
|
validates :verification_token, :domain_name, :domain, :action, :action_type, presence: true
|
||||||
validates :domain, uniqueness: { scope: [:domain_id, :verification_token] }
|
|
||||||
|
|
||||||
def domain_registrant_change_confirm!
|
def domain_registrant_change_confirm!
|
||||||
self.action_type = DOMAIN_REGISTRANT_CHANGE
|
self.action_type = DOMAIN_REGISTRANT_CHANGE
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue