Merge pull request #2502 from internetee/2492-return-contact-details-with-domain-authinfo

get contact info through domain transferred code
This commit is contained in:
Timo Võhmar 2022-12-07 10:56:58 +02:00 committed by GitHub
commit 8713e96f77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 2 deletions

View file

@ -54,8 +54,14 @@ class Ability
can(:delete, Epp::Domain) { |d, pw| d.registrar_id == @user.registrar_id || d.transfer_code == pw }
# Epp::Contact
can(:info, Epp::Contact) { |c, pw| c.registrar_id == @user.registrar_id || pw.blank? ? true : c.auth_info == pw }
can(:view_full_info, Epp::Contact) { |c, pw| c.registrar_id == @user.registrar_id || c.auth_info == pw }
can(:info, Epp::Contact) do |c, pw|
c.registrar_id == @user.registrar_id ||
pw.blank? ? true : c.auth_info == pw ||
c.transferred_passwords.include?(pw)
end
can(:view_full_info, Epp::Contact) do |c, pw|
c.registrar_id == @user.registrar_id || c.auth_info == pw || c.transferred_passwords.include?(pw)
end
can(:check, Epp::Contact)
can(:create, Epp::Contact)
can(:update, Epp::Contact) { |c, pw| c.registrar_id == @user.registrar_id || c.auth_info == pw }

View file

@ -16,6 +16,10 @@ class Epp::Contact < Contact
throw(:abort)
end
def transferred_passwords
domains.pluck(:transfer_code)
end
class << self
# support legacy search
def find_by_epp_code(code)