Added ApiUser and WhiteIp endpoints to REPP API

This commit is contained in:
Sergei Tsoganov 2023-05-29 14:26:53 +03:00
parent 0442f7f087
commit b84e9e1579
9 changed files with 206 additions and 3 deletions

View file

@ -34,8 +34,12 @@ module Repp
iban: registrar.iban,
iban_max_length: Iban.max_length,
linked_users: serialized_users(current_user.linked_users),
api_users: serialized_users(current_user.api_users),
white_ips: serialized_ips(registrar.white_ips),
balance_auto_reload: type,
min_deposit: Setting.minimum_deposit } }
min_deposit: Setting.minimum_deposit },
roles: ApiUser::ROLES,
interfaces: WhiteIp::INTERFACES }
render_success(data: resp)
end
@ -148,7 +152,8 @@ module Repp
arr = []
users.each do |u|
arr << { id: u.id, username: u.username,
role: u.roles.first, registrar_name: u.registrar.name }
role: u.roles.first, registrar_name: u.registrar.name,
active: u.active }
end
arr
@ -165,6 +170,10 @@ module Repp
arr
end
def serialized_ips(ips)
ips.as_json(only: %i[id ipv4 ipv6 interfaces])
end
end
end
end