mirror of
https://github.com/internetee/registry.git
synced 2025-05-29 17:10:08 +02:00
Merge pull request #167 from internetee/115693873-whodunnit_empty
115693873 whodunnit empty
This commit is contained in:
commit
fdb9b5501f
11 changed files with 44 additions and 22 deletions
|
@ -5,17 +5,17 @@ class Admin::PendingDeletesController < AdminController
|
||||||
def update
|
def update
|
||||||
authorize! :update, :pending
|
authorize! :update, :pending
|
||||||
|
|
||||||
if registrant_verification.domain_registrant_delete_confirm!
|
if registrant_verification.domain_registrant_delete_confirm!("admin #{current_user.username}")
|
||||||
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_domain_path(@domain.id), alert: t(:failure)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
authorize! :destroy, :pending
|
authorize! :destroy, :pending
|
||||||
|
|
||||||
if registrant_verification.domain_registrant_delete_reject!
|
if registrant_verification.domain_registrant_delete_reject!("admin #{current_user.username}")
|
||||||
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)
|
||||||
|
|
|
@ -5,7 +5,7 @@ class Admin::PendingUpdatesController < AdminController
|
||||||
def update
|
def update
|
||||||
authorize! :update, :pending
|
authorize! :update, :pending
|
||||||
|
|
||||||
if registrant_verification.domain_registrant_change_confirm!
|
if registrant_verification.domain_registrant_change_confirm!("admin #{current_user.username}")
|
||||||
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)
|
||||||
|
@ -14,7 +14,7 @@ class Admin::PendingUpdatesController < AdminController
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
authorize! :destroy, :pending
|
authorize! :destroy, :pending
|
||||||
if registrant_verification.domain_registrant_change_reject!
|
if registrant_verification.domain_registrant_change_reject!("admin #{current_user.username}")
|
||||||
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)
|
||||||
|
|
|
@ -20,17 +20,20 @@ class Registrant::DomainDeleteConfirmsController < RegistrantController
|
||||||
@registrant_verification = RegistrantVerification.new(domain_id: @domain.id,
|
@registrant_verification = RegistrantVerification.new(domain_id: @domain.id,
|
||||||
domain_name: @domain.name,
|
domain_name: @domain.name,
|
||||||
verification_token: params[:token])
|
verification_token: params[:token])
|
||||||
|
|
||||||
|
initiator = current_user ? current_user.username : t(:user_not_authenticated)
|
||||||
|
|
||||||
if params[:rejected]
|
if params[:rejected]
|
||||||
if @registrant_verification.domain_registrant_delete_reject!
|
if @registrant_verification.domain_registrant_delete_reject!("email link #{initiator}")
|
||||||
flash[:notice] = t(:registrant_domain_delete_rejected)
|
flash[:notice] = t(:registrant_domain_verification_rejected)
|
||||||
redirect_to registrant_domain_delete_confirm_path(@domain.id, rejected: true)
|
redirect_to registrant_domain_delete_confirm_path(@domain.id, rejected: true)
|
||||||
else
|
else
|
||||||
flash[:alert] = t(:registrant_domain_delete_rejected_failed)
|
flash[:alert] = t(:registrant_domain_delete_rejected_failed)
|
||||||
return render 'show'
|
return render 'show'
|
||||||
end
|
end
|
||||||
elsif params[:confirmed]
|
elsif params[:confirmed]
|
||||||
if @registrant_verification.domain_registrant_delete_confirm!
|
if @registrant_verification.domain_registrant_delete_confirm!("email link #{initiator}")
|
||||||
flash[:notice] = t(:registrant_domain_delete_confirmed)
|
flash[:notice] = t(:registrant_domain_verification_confirmed)
|
||||||
redirect_to registrant_domain_delete_confirm_path(@domain.id, confirmed: true)
|
redirect_to registrant_domain_delete_confirm_path(@domain.id, confirmed: true)
|
||||||
else
|
else
|
||||||
flash[:alert] = t(:registrant_domain_delete_confirmed_failed)
|
flash[:alert] = t(:registrant_domain_delete_confirmed_failed)
|
||||||
|
|
|
@ -20,8 +20,11 @@ class Registrant::DomainUpdateConfirmsController < RegistrantController
|
||||||
@registrant_verification = RegistrantVerification.new(domain_id: @domain.id,
|
@registrant_verification = RegistrantVerification.new(domain_id: @domain.id,
|
||||||
domain_name: @domain.name,
|
domain_name: @domain.name,
|
||||||
verification_token: params[:token])
|
verification_token: params[:token])
|
||||||
|
|
||||||
|
initiator = current_user ? current_user.username : t(:user_not_authenticated)
|
||||||
|
|
||||||
if params[:rejected]
|
if params[:rejected]
|
||||||
if @registrant_verification.domain_registrant_change_reject!
|
if @registrant_verification.domain_registrant_change_reject!("email link, #{initiator}")
|
||||||
flash[:notice] = t(:registrant_domain_verification_rejected)
|
flash[:notice] = t(:registrant_domain_verification_rejected)
|
||||||
redirect_to registrant_domain_update_confirm_path(@domain.id, rejected: true)
|
redirect_to registrant_domain_update_confirm_path(@domain.id, rejected: true)
|
||||||
else
|
else
|
||||||
|
@ -29,7 +32,7 @@ class Registrant::DomainUpdateConfirmsController < RegistrantController
|
||||||
return render 'show'
|
return render 'show'
|
||||||
end
|
end
|
||||||
elsif params[:confirmed]
|
elsif params[:confirmed]
|
||||||
if @registrant_verification.domain_registrant_change_confirm!
|
if @registrant_verification.domain_registrant_change_confirm!("email link, #{initiator}")
|
||||||
flash[:notice] = t(:registrant_domain_verification_confirmed)
|
flash[:notice] = t(:registrant_domain_verification_confirmed)
|
||||||
redirect_to registrant_domain_update_confirm_path(@domain.id, confirmed: true)
|
redirect_to registrant_domain_update_confirm_path(@domain.id, confirmed: true)
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
class DomainDeleteConfirmJob < Que::Job
|
class DomainDeleteConfirmJob < Que::Job
|
||||||
def run(domain_id, action)
|
def run(domain_id, action, initiator = nil)
|
||||||
|
::PaperTrail.whodunnit = "job - #{self.class.name} - #{action} by #{initiator}"
|
||||||
# it's recommended to keep transaction against job table as short as possible.
|
# it's recommended to keep transaction against job table as short as possible.
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
domain = Epp::Domain.find(domain_id)
|
domain = Epp::Domain.find(domain_id)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
class DomainUpdateConfirmJob < Que::Job
|
class DomainUpdateConfirmJob < Que::Job
|
||||||
def run(domain_id, action)
|
def run(domain_id, action, initiator = nil)
|
||||||
|
::PaperTrail.whodunnit = "job - #{self.class.name} - #{action} by #{initiator}"
|
||||||
# it's recommended to keep transaction against job table as short as possible.
|
# it's recommended to keep transaction against job table as short as possible.
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
domain = Epp::Domain.find(domain_id)
|
domain = Epp::Domain.find(domain_id)
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
class UpdateWhoisRecordJob < Que::Job
|
class UpdateWhoisRecordJob < Que::Job
|
||||||
|
|
||||||
def run(names, type)
|
def run(names, type)
|
||||||
|
::PaperTrail.whodunnit = "job - #{self.class.name} - #{type}"
|
||||||
|
|
||||||
klass = case type
|
klass = case type
|
||||||
when 'reserved'then ReservedDomain
|
when 'reserved'then ReservedDomain
|
||||||
when 'blocked' then BlockedDomain
|
when 'blocked' then BlockedDomain
|
||||||
|
|
|
@ -3,6 +3,7 @@ class DomainCron
|
||||||
def self.clean_expired_pendings
|
def self.clean_expired_pendings
|
||||||
STDOUT << "#{Time.zone.now.utc} - Clean expired domain pendings\n" unless Rails.env.test?
|
STDOUT << "#{Time.zone.now.utc} - Clean expired domain pendings\n" unless Rails.env.test?
|
||||||
|
|
||||||
|
::PaperTrail.whodunnit = "cron - #{__method__}"
|
||||||
expire_at = Setting.expire_pending_confirmation.hours.ago
|
expire_at = Setting.expire_pending_confirmation.hours.ago
|
||||||
count = 0
|
count = 0
|
||||||
expired_pending_domains = Domain.where('registrant_verification_asked_at <= ?', expire_at)
|
expired_pending_domains = Domain.where('registrant_verification_asked_at <= ?', expire_at)
|
||||||
|
@ -33,6 +34,7 @@ class DomainCron
|
||||||
def self.start_expire_period
|
def self.start_expire_period
|
||||||
STDOUT << "#{Time.zone.now.utc} - Expiring domains\n" unless Rails.env.test?
|
STDOUT << "#{Time.zone.now.utc} - Expiring domains\n" unless Rails.env.test?
|
||||||
|
|
||||||
|
::PaperTrail.whodunnit = "cron - #{__method__}"
|
||||||
domains = Domain.where('valid_to <= ?', Time.zone.now)
|
domains = Domain.where('valid_to <= ?', Time.zone.now)
|
||||||
marked = 0
|
marked = 0
|
||||||
real = 0
|
real = 0
|
||||||
|
@ -50,6 +52,7 @@ class DomainCron
|
||||||
def self.start_redemption_grace_period
|
def self.start_redemption_grace_period
|
||||||
STDOUT << "#{Time.zone.now.utc} - Setting server_hold to domains\n" unless Rails.env.test?
|
STDOUT << "#{Time.zone.now.utc} - Setting server_hold to domains\n" unless Rails.env.test?
|
||||||
|
|
||||||
|
::PaperTrail.whodunnit = "cron - #{__method__}"
|
||||||
d = Domain.where('outzone_at <= ?', Time.zone.now)
|
d = Domain.where('outzone_at <= ?', Time.zone.now)
|
||||||
marked = 0
|
marked = 0
|
||||||
real = 0
|
real = 0
|
||||||
|
@ -92,6 +95,11 @@ class DomainCron
|
||||||
STDOUT << "#{Time.zone.now.utc} - Destroying domains\n" unless Rails.env.test?
|
STDOUT << "#{Time.zone.now.utc} - Destroying domains\n" unless Rails.env.test?
|
||||||
|
|
||||||
c = 0
|
c = 0
|
||||||
|
Domain.where("statuses @> '{deleteCandidate}'::varchar[]").each do |x|
|
||||||
|
::PaperTrail.whodunnit = "cron - #{__method__} case statuses"
|
||||||
|
WhoisRecord.where(domain_id: x.id).destroy_all
|
||||||
|
destroy_with_message x
|
||||||
|
STDOUT << "#{Time.zone.now.utc} Domain.destroy_delete_candidates: by deleteCandidate ##{x.id} (#{x.name})\n" unless Rails.env.test?
|
||||||
|
|
||||||
Domain.where('delete_at <= ?', Time.zone.now).each do |x|
|
Domain.where('delete_at <= ?', Time.zone.now).each do |x|
|
||||||
next unless x.delete_candidateable?
|
next unless x.delete_candidateable?
|
||||||
|
@ -110,6 +118,10 @@ class DomainCron
|
||||||
Domain.where('force_delete_at <= ?', Time.zone.now).each do |x|
|
Domain.where('force_delete_at <= ?', Time.zone.now).each do |x|
|
||||||
DomainDeleteJob.enqueue(x.id, run_at: rand(((24*60) - (DateTime.now.hour * 60 + DateTime.now.minute))).minutes.from_now)
|
DomainDeleteJob.enqueue(x.id, run_at: rand(((24*60) - (DateTime.now.hour * 60 + DateTime.now.minute))).minutes.from_now)
|
||||||
STDOUT << "#{Time.zone.now.utc} DomainCron.destroy_delete_candidates: job added by force delete time ##{x.id} (#{x.name})\n" unless Rails.env.test?
|
STDOUT << "#{Time.zone.now.utc} DomainCron.destroy_delete_candidates: job added by force delete time ##{x.id} (#{x.name})\n" unless Rails.env.test?
|
||||||
|
::PaperTrail.whodunnit = "cron - #{__method__} case force_deleted_at"
|
||||||
|
WhoisRecord.where(domain_id: x.id).destroy_all
|
||||||
|
destroy_with_message x
|
||||||
|
STDOUT << "#{Time.zone.now.utc} DomainCron.destroy_delete_candidates: by force delete time ##{x.id} (#{x.name})\n" unless Rails.env.test?
|
||||||
c += 1
|
c += 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -525,7 +525,6 @@ class Epp::Domain < Domain
|
||||||
self.statuses.delete(DomainStatus::PENDING_UPDATE)
|
self.statuses.delete(DomainStatus::PENDING_UPDATE)
|
||||||
self.upid = user.registrar.id if user.registrar
|
self.upid = user.registrar.id if user.registrar
|
||||||
self.up_date = Time.zone.now
|
self.up_date = Time.zone.now
|
||||||
::PaperTrail.whodunnit = user.id_role_username # updator str should be the request originator not the approval user
|
|
||||||
|
|
||||||
return unless update(frame, user, false)
|
return unless update(frame, user, false)
|
||||||
clean_pendings!
|
clean_pendings!
|
||||||
|
|
|
@ -13,27 +13,27 @@ class RegistrantVerification < ActiveRecord::Base
|
||||||
|
|
||||||
validates :verification_token, :domain_name, :domain, :action, :action_type, presence: true
|
validates :verification_token, :domain_name, :domain, :action, :action_type, presence: true
|
||||||
|
|
||||||
def domain_registrant_change_confirm!
|
def domain_registrant_change_confirm!(initiator)
|
||||||
self.action_type = DOMAIN_REGISTRANT_CHANGE
|
self.action_type = DOMAIN_REGISTRANT_CHANGE
|
||||||
self.action = CONFIRMED
|
self.action = CONFIRMED
|
||||||
DomainUpdateConfirmJob.enqueue domain.id, CONFIRMED if save
|
DomainUpdateConfirmJob.enqueue domain.id, CONFIRMED, initiator if save
|
||||||
end
|
end
|
||||||
|
|
||||||
def domain_registrant_change_reject!
|
def domain_registrant_change_reject!(initiator)
|
||||||
self.action_type = DOMAIN_REGISTRANT_CHANGE
|
self.action_type = DOMAIN_REGISTRANT_CHANGE
|
||||||
self.action = REJECTED
|
self.action = REJECTED
|
||||||
DomainUpdateConfirmJob.run domain.id, REJECTED if save
|
DomainUpdateConfirmJob.run domain.id, REJECTED, initiator if save
|
||||||
end
|
end
|
||||||
|
|
||||||
def domain_registrant_delete_confirm!
|
def domain_registrant_delete_confirm!(initiator)
|
||||||
self.action_type = DOMAIN_DELETE
|
self.action_type = DOMAIN_DELETE
|
||||||
self.action = CONFIRMED
|
self.action = CONFIRMED
|
||||||
DomainDeleteConfirmJob.enqueue domain.id, CONFIRMED if save
|
DomainDeleteConfirmJob.enqueue domain.id, CONFIRMED, initiator if save
|
||||||
end
|
end
|
||||||
|
|
||||||
def domain_registrant_delete_reject!
|
def domain_registrant_delete_reject!(initiator)
|
||||||
self.action_type = DOMAIN_DELETE
|
self.action_type = DOMAIN_DELETE
|
||||||
self.action = REJECTED
|
self.action = REJECTED
|
||||||
DomainDeleteConfirmJob.enqueue domain.id, REJECTED if save
|
DomainDeleteConfirmJob.enqueue domain.id, REJECTED, initiator if save
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -961,3 +961,4 @@ en:
|
||||||
only_estonian_residets_can_signin: "Access currently available only to Estonian citizens and e-residents with Estonian ID-card or Mobile-ID."
|
only_estonian_residets_can_signin: "Access currently available only to Estonian citizens and e-residents with Estonian ID-card or Mobile-ID."
|
||||||
deleted: 'Deleted'
|
deleted: 'Deleted'
|
||||||
cant_match_version: 'Impossible match version with request'
|
cant_match_version: 'Impossible match version with request'
|
||||||
|
user_not_authenticated: "user not authenticated"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue