mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 00:12:03 +02:00
Added csv export to registrar api_users and white_ips
This commit is contained in:
parent
316f00cadc
commit
0f16ec77f5
11 changed files with 104 additions and 6 deletions
|
@ -91,6 +91,25 @@ class ApiUser < User
|
|||
another_api_user.identity_code == identity_code
|
||||
end
|
||||
|
||||
def as_csv_row
|
||||
[
|
||||
username,
|
||||
plain_text_password,
|
||||
identity_code,
|
||||
roles.join(', '),
|
||||
active,
|
||||
accredited?,
|
||||
accreditation_expire_date,
|
||||
created_at,
|
||||
updated_at
|
||||
]
|
||||
end
|
||||
|
||||
def self.csv_header
|
||||
['Username', 'Password', 'Identity Code', 'Role', 'Active', 'Accredited',
|
||||
'Accreditation Expire Date', 'Created', 'Updated']
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def machine_readable_certificate(cert)
|
||||
|
|
|
@ -72,5 +72,19 @@ class WhiteIp < ApplicationRecord
|
|||
rescue StandardError => _e
|
||||
nil
|
||||
end
|
||||
|
||||
def csv_header
|
||||
%w[IPv4 IPv6 Interfaces Created Updated]
|
||||
end
|
||||
end
|
||||
|
||||
def as_csv_row
|
||||
[
|
||||
ipv4,
|
||||
ipv6,
|
||||
interfaces.join(', ').upcase,
|
||||
created_at,
|
||||
updated_at
|
||||
]
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue