mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 10:16:01 +02:00
Merge remote-tracking branch 'origin/105842700-registrants_portal' into 105846070-merge-with-105842700-arireg-for-registrant-port
This commit is contained in:
commit
613a34a2c5
28 changed files with 699 additions and 29 deletions
|
@ -16,7 +16,7 @@ class Ability
|
|||
@user.roles.each { |role| send(role) } if @user.roles
|
||||
when 'ApiUser'
|
||||
@user.roles.each { |role| send(role) } if @user.roles
|
||||
when 'RegistrantUser'
|
||||
when 'RegistrantUser'
|
||||
static_registrant
|
||||
end
|
||||
|
||||
|
@ -117,9 +117,11 @@ class Ability
|
|||
end
|
||||
|
||||
def static_registrant
|
||||
customer_service
|
||||
can :manage, :registrant_domains
|
||||
can :manage, :registrant_whois
|
||||
can :manage, Depp::Domain
|
||||
can :manage, Domain
|
||||
end
|
||||
|
||||
def user
|
||||
|
|
|
@ -818,5 +818,19 @@ class Domain < ActiveRecord::Base
|
|||
status_notes[status] = notes[i]
|
||||
end
|
||||
end
|
||||
|
||||
def self.to_csv
|
||||
CSV.generate do |csv|
|
||||
csv << column_names
|
||||
all.each do |domain|
|
||||
csv << domain.attributes.values_at(*column_names)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.pdf(html)
|
||||
kit = PDFKit.new(html)
|
||||
kit.to_pdf
|
||||
end
|
||||
end
|
||||
# rubocop: enable Metrics/ClassLength
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
class RegistrantUser < User
|
||||
ACCEPTED_ISSUER = 'AS Sertifitseerimiskeskus'
|
||||
attr_accessor :idc_data
|
||||
|
||||
def ability
|
||||
|
@ -6,6 +7,15 @@ class RegistrantUser < User
|
|||
end
|
||||
delegate :can?, :cannot?, to: :ability
|
||||
|
||||
def ident
|
||||
registrant_ident.to_s.split("-").last
|
||||
end
|
||||
|
||||
def domains
|
||||
Domain.includes(:registrar, :registrant).where(contacts: {ident: ident})
|
||||
end
|
||||
|
||||
|
||||
def to_s
|
||||
username
|
||||
end
|
||||
|
@ -13,11 +23,9 @@ class RegistrantUser < User
|
|||
class << self
|
||||
def find_or_create_by_idc_data(idc_data, issuer_organization)
|
||||
return false if idc_data.blank?
|
||||
return false if issuer_organization != 'AS Sertifitseerimiskeskus'
|
||||
return false if issuer_organization != ACCEPTED_ISSUER
|
||||
|
||||
idc_data.force_encoding('UTF-8')
|
||||
logger.error(idc_data)
|
||||
logger.error(idc_data.encoding)
|
||||
identity_code = idc_data.scan(/serialNumber=(\d+)/).flatten.first
|
||||
country = idc_data.scan(/^\/C=(.{2})/).flatten.first
|
||||
first_name = idc_data.scan(%r{/GN=(.+)/serialNumber}).flatten.first
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue