mirror of
https://github.com/internetee/registry.git
synced 2025-07-05 18:53:26 +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
|
||||
authorize! :update, :pending
|
||||
|
||||
@epp_domain = Epp::Domain.find(params[:domain_id]) # only epp domain has apply pending
|
||||
@epp_domain.is_admin= true
|
||||
if @epp_domain.apply_pending_delete!
|
||||
if registrant_verification.domain_registrant_delete_confirm!
|
||||
redirect_to admin_domain_path(@domain.id), notice: t(:pending_applied)
|
||||
else
|
||||
redirect_to admin_edit_domain_path(@domain.id), alert: t(:failure)
|
||||
|
@ -17,7 +15,7 @@ class Admin::PendingDeletesController < AdminController
|
|||
def destroy
|
||||
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)
|
||||
else
|
||||
redirect_to admin_domain_path(@domain.id), alert: t(:failure)
|
||||
|
@ -26,6 +24,14 @@ class Admin::PendingDeletesController < AdminController
|
|||
|
||||
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
|
||||
@domain = Domain.find(params[:domain_id])
|
||||
end
|
||||
|
|
|
@ -5,8 +5,7 @@ class Admin::PendingUpdatesController < AdminController
|
|||
def update
|
||||
authorize! :update, :pending
|
||||
|
||||
@epp_domain = Epp::Domain.find(params[:domain_id]) # only epp domain has apply pending
|
||||
if @epp_domain.apply_pending_update!
|
||||
if registrant_verification.domain_registrant_change_confirm!
|
||||
redirect_to admin_domain_path(@domain.id), notice: t(:pending_applied)
|
||||
else
|
||||
redirect_to edit_admin_domain_path(@domain.id), alert: t(:failure)
|
||||
|
@ -15,14 +14,21 @@ class Admin::PendingUpdatesController < AdminController
|
|||
|
||||
def destroy
|
||||
authorize! :destroy, :pending
|
||||
|
||||
if @domain.clean_pendings!
|
||||
if registrant_verification.domain_registrant_change_reject!
|
||||
redirect_to admin_domain_path(@domain.id), notice: t(:pending_removed)
|
||||
else
|
||||
redirect_to admin_domain_path(@domain.id), alert: t(:failure)
|
||||
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
|
||||
|
||||
def find_domain
|
||||
|
|
|
@ -10,7 +10,7 @@ class DomainUpdateConfirmJob < Que::Job
|
|||
e.instance_variable_set("@changed_attributes", e.changed_attributes.merge("statuses"=>[]))
|
||||
end
|
||||
domain.clean_pendings!
|
||||
WhoisRecord.find_by(domain_id: domain.id).save!
|
||||
WhoisRecord.find_by(domain_id: domain.id).save
|
||||
when RegistrantVerification::REJECTED
|
||||
domain.send_mail :pending_update_rejected_notification_for_new_registrant
|
||||
domain.poll_message!(:poll_pending_update_rejected_by_registrant)
|
||||
|
|
|
@ -7,6 +7,7 @@ class Epp::Domain < Domain
|
|||
|
||||
before_validation :manage_permissions
|
||||
def manage_permissions
|
||||
return if is_admin # this bad hack for 109086524, refactor later
|
||||
return true if is_transfer
|
||||
return unless update_prohibited? || delete_prohibited?
|
||||
add_epp_error('2304', nil, nil, I18n.t(:object_status_prohibits_operation))
|
||||
|
|
|
@ -12,7 +12,6 @@ class RegistrantVerification < ActiveRecord::Base
|
|||
belongs_to :domain
|
||||
|
||||
validates :verification_token, :domain_name, :domain, :action, :action_type, presence: true
|
||||
validates :domain, uniqueness: { scope: [:domain_id, :verification_token] }
|
||||
|
||||
def domain_registrant_change_confirm!
|
||||
self.action_type = DOMAIN_REGISTRANT_CHANGE
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue