added endpoints to demo registry for accr results

This commit is contained in:
olegphenomenon 2021-12-10 16:53:25 +02:00
parent 487cbb1774
commit c07abaea59
20 changed files with 401 additions and 78 deletions

View file

@ -56,6 +56,16 @@ class ApiUser < User
username
end
def accredited?
!accreditation_date.nil?
end
def accreditation_expired?
return false if accreditation_expire_date.nil?
accreditation_expire_date < Time.zone.now
end
def unread_notifications
registrar.notifications.unread
end

View file

@ -190,6 +190,16 @@ class Registrar < ApplicationRecord # rubocop:disable Metrics/ClassLength
white_ips.api.include_ip?(ip)
end
def accredited?
api_users.any? do |a|
return true unless a.accreditation_date.nil?
end
end
def accreditation_expired?
api_users.all? { |api| api.accreditation_expired? }
end
# Audit log is needed, therefore no raw SQL
def replace_nameservers(hostname, new_attributes, domains: [])
transaction do