mirror of
https://github.com/internetee/registry.git
synced 2025-05-20 03:09:36 +02:00
Merge branch '109367694-epp-id-conventions' into staging
This commit is contained in:
commit
02e08a5b15
4 changed files with 19 additions and 21 deletions
|
@ -67,7 +67,7 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def user_log_str(user)
|
def user_log_str(user)
|
||||||
user.nil? ? 'public' : user.string
|
user.nil? ? 'public' : user.id_role_username
|
||||||
end
|
end
|
||||||
|
|
||||||
def comma_support_for(parent_key, key)
|
def comma_support_for(parent_key, key)
|
||||||
|
|
|
@ -22,30 +22,28 @@ module Versions
|
||||||
|
|
||||||
def creator
|
def creator
|
||||||
return nil if creator_str.blank?
|
return nil if creator_str.blank?
|
||||||
|
creator = user_from_id_role_username creator_str
|
||||||
if creator_str =~ /^\d+-AdminUser:/
|
|
||||||
creator = AdminUser.find_by(id: creator_str)
|
|
||||||
elsif creator_str =~ /^\d+-ApiUser:/
|
|
||||||
creator = ApiUser.find_by(id: creator_str)
|
|
||||||
elsif creator_str =~ /^\d+-api-/ # depricated
|
|
||||||
creator = ApiUser.find_by(id: creator_str)
|
|
||||||
end
|
|
||||||
|
|
||||||
creator.present? ? creator : creator_str
|
creator.present? ? creator : creator_str
|
||||||
end
|
end
|
||||||
|
|
||||||
def updator
|
def updator
|
||||||
return nil if updator_str.blank?
|
return nil if updator_str.blank?
|
||||||
|
updator = user_from_id_role_username updator_str
|
||||||
if updator_str =~ /^\d+-AdminUser:/
|
updator.present? ? updator : updator_str
|
||||||
updator = AdminUser.find_by(id: updator_str)
|
|
||||||
elsif updator_str =~ /^\d+-ApiUser:/
|
|
||||||
updator = ApiUser.find_by(id: updator_str)
|
|
||||||
elsif updator_str =~ /^\d+-api-/ # depricated
|
|
||||||
updator = ApiUser.find_by(id: updator_str)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
updator.present? ? updator : updator_str
|
def user_from_id_role_username(str)
|
||||||
|
user = ApiUser.find_by(id: $1) if str =~ /^(\d+)-(ApiUser:|api-)/
|
||||||
|
unless user.present?
|
||||||
|
user = AdminUser.find_by(id: $1) if str =~ /^(\d+)-AdminUser:/
|
||||||
|
unless user.present?
|
||||||
|
# on import we copied Registrar name, which may eql code
|
||||||
|
registrar = Registrar.find_by(name: str).first
|
||||||
|
# assume each registrar has only one user
|
||||||
|
user = registrar.api_users.first if registrar
|
||||||
|
end
|
||||||
|
end
|
||||||
|
user
|
||||||
end
|
end
|
||||||
|
|
||||||
# callbacks
|
# callbacks
|
||||||
|
|
|
@ -504,7 +504,7 @@ class Epp::Domain < Domain
|
||||||
old_registrant_email = DomainMailer.registrant_updated_notification_for_old_registrant(id, deliver_emails)
|
old_registrant_email = DomainMailer.registrant_updated_notification_for_old_registrant(id, deliver_emails)
|
||||||
preclean_pendings
|
preclean_pendings
|
||||||
user = ApiUser.find(pending_json['current_user_id'])
|
user = ApiUser.find(pending_json['current_user_id'])
|
||||||
::PaperTrail.whodunnit = user.string # updator str should be the request originator not the approval user
|
::PaperTrail.whodunnit = user.id_role_username # updator str should be the request originator not the approval user
|
||||||
frame = Nokogiri::XML(pending_json['frame'])
|
frame = Nokogiri::XML(pending_json['frame'])
|
||||||
statuses.delete(DomainStatus::PENDING_UPDATE)
|
statuses.delete(DomainStatus::PENDING_UPDATE)
|
||||||
yield(self) if block_given? # need to skip statuses check here
|
yield(self) if block_given? # need to skip statuses check here
|
||||||
|
|
|
@ -4,7 +4,7 @@ class User < ActiveRecord::Base
|
||||||
|
|
||||||
attr_accessor :phone
|
attr_accessor :phone
|
||||||
|
|
||||||
def string
|
def id_role_username
|
||||||
"#{self.id}-#{self.class}: #{self.username}"
|
"#{self.id}-#{self.class}: #{self.username}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue