mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 10:16:01 +02:00
Add epp log view
This commit is contained in:
parent
360c2d3db8
commit
0544dbd3ff
13 changed files with 114 additions and 16 deletions
11
app/controllers/admin/epp_logs_controller.rb
Normal file
11
app/controllers/admin/epp_logs_controller.rb
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
class Admin::EppLogsController < ApplicationController
|
||||||
|
load_and_authorize_resource class: ApiLog::EppLog
|
||||||
|
|
||||||
|
def index
|
||||||
|
@epp_logs = ApiLog::EppLog.order(id: :desc).page(params[:page])
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
@epp_log = ApiLog::EppLog.find(params[:id])
|
||||||
|
end
|
||||||
|
end
|
|
@ -9,7 +9,6 @@ module Epp::Common
|
||||||
included do
|
included do
|
||||||
protect_from_forgery with: :null_session
|
protect_from_forgery with: :null_session
|
||||||
before_action :validate_request, only: [:proxy]
|
before_action :validate_request, only: [:proxy]
|
||||||
after_action :write_to_epp_log
|
|
||||||
|
|
||||||
helper_method :current_epp_user
|
helper_method :current_epp_user
|
||||||
end
|
end
|
||||||
|
@ -117,6 +116,7 @@ module Epp::Common
|
||||||
def render_epp_response(*args)
|
def render_epp_response(*args)
|
||||||
@response = render_to_string(*args)
|
@response = render_to_string(*args)
|
||||||
render xml: @response
|
render xml: @response
|
||||||
|
write_to_epp_log
|
||||||
end
|
end
|
||||||
|
|
||||||
def write_to_epp_log
|
def write_to_epp_log
|
||||||
|
|
|
@ -4,6 +4,6 @@ class Epp::ErrorsController < ApplicationController
|
||||||
|
|
||||||
def error
|
def error
|
||||||
epp_errors << { code: params[:code], msg: params[:msg] }
|
epp_errors << { code: params[:code], msg: params[:msg] }
|
||||||
render '/epp/error'
|
render_epp_response '/epp/error'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -24,6 +24,7 @@ class Ability
|
||||||
can :manage, EppUser
|
can :manage, EppUser
|
||||||
can :manage, Keyrelay
|
can :manage, Keyrelay
|
||||||
can :manage, LegalDocument
|
can :manage, LegalDocument
|
||||||
|
can :read, ApiLog::EppLog
|
||||||
can :index, :delayed_job
|
can :index, :delayed_job
|
||||||
can :create, :zonefile
|
can :create, :zonefile
|
||||||
can :access, :settings_menu
|
can :access, :settings_menu
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
= link_to(t('edit_statuses'), edit_admin_domain_path(@domain), class: 'btn btn-primary')
|
= link_to(t('edit_statuses'), edit_admin_domain_path(@domain), class: 'btn btn-primary')
|
||||||
= link_to(t(:'history'), admin_domain_version_path(@domain.id), method: :get, class: 'btn btn-primary')
|
= link_to(t(:'history'), admin_domain_version_path(@domain.id), method: :get, class: 'btn btn-primary')
|
||||||
|
|
||||||
/= link_to(t('generate_zonefile'), zonefile_admin_domain_path(@domain), class: 'btn btn-primary')
|
|
||||||
|
|
||||||
%hr
|
%hr
|
||||||
.row
|
.row
|
||||||
.col-md-6= render 'admin/domains/partials/general'
|
.col-md-6= render 'admin/domains/partials/general'
|
||||||
|
|
28
app/views/admin/epp_logs/index.haml
Normal file
28
app/views/admin/epp_logs/index.haml
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
.row
|
||||||
|
.col-sm-12
|
||||||
|
%h2.text-center-xs= t('epp_logs')
|
||||||
|
%hr
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
.table-responsive
|
||||||
|
%table.table.table-hover.table-bordered.table-condensed
|
||||||
|
%thead
|
||||||
|
%tr
|
||||||
|
%th{class: 'col-xs-2'}= t('request_command')
|
||||||
|
%th{class: 'col-xs-2'}= t('request_object')
|
||||||
|
%th{class: 'col-xs-2'}= t('request_successful')
|
||||||
|
%th{class: 'col-xs-2'}= t('api_user')
|
||||||
|
%th{class: 'col-xs-2'}= t('registrar')
|
||||||
|
%th{class: 'col-xs-2'}= t('created_at')
|
||||||
|
%tbody
|
||||||
|
- @epp_logs.each do |x|
|
||||||
|
%tr
|
||||||
|
%td= link_to(x.request_command, admin_epp_log_path(x))
|
||||||
|
%td= x.request_object
|
||||||
|
%td= x.request_successful
|
||||||
|
%td= x.api_user_name
|
||||||
|
%td= x.api_user_registrar
|
||||||
|
%td= l(x.created_at)
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
= paginate @epp_logs
|
55
app/views/admin/epp_logs/show.haml
Normal file
55
app/views/admin/epp_logs/show.haml
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
.row
|
||||||
|
.col-sm-6
|
||||||
|
%h2.text-center-xs
|
||||||
|
= t('epp_log')
|
||||||
|
.col-sm-6
|
||||||
|
%h2.text-right.text-center-xs
|
||||||
|
= link_to(t('back'), :back, class: 'btn btn-primary')
|
||||||
|
%hr
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
.panel.panel-default
|
||||||
|
.panel-heading
|
||||||
|
%h3.panel-title= t('details')
|
||||||
|
.panel-body
|
||||||
|
%dl.dl-horizontal
|
||||||
|
%dt= t('request_command')
|
||||||
|
%dd= @epp_log.request_command
|
||||||
|
|
||||||
|
%dt= t('request_object')
|
||||||
|
%dd= @epp_log.request_object
|
||||||
|
|
||||||
|
%dt= t('request_successful')
|
||||||
|
%dd= @epp_log.request_successful
|
||||||
|
|
||||||
|
%dt= t('api_user')
|
||||||
|
%dd= @epp_log.api_user_name
|
||||||
|
|
||||||
|
%dt= t('registrar')
|
||||||
|
%dd= @epp_log.api_user_registrar
|
||||||
|
|
||||||
|
%dt= t('created_at')
|
||||||
|
%dd= @epp_log.created_at
|
||||||
|
|
||||||
|
.row
|
||||||
|
.col-md-6
|
||||||
|
.panel.panel-default
|
||||||
|
.panel-heading
|
||||||
|
%h3.panel-title= t('request')
|
||||||
|
.panel-body
|
||||||
|
= preserve do
|
||||||
|
%pre
|
||||||
|
- formatted_req = Nokogiri::XML(@epp_log.request)
|
||||||
|
- if formatted_req.errors.none?
|
||||||
|
= formatted_req.root
|
||||||
|
- else
|
||||||
|
= @epp_log.request
|
||||||
|
.col-md-6
|
||||||
|
.panel.panel-default
|
||||||
|
.panel-heading
|
||||||
|
%h3.panel-title= t('response')
|
||||||
|
.panel-body
|
||||||
|
= preserve do
|
||||||
|
%pre
|
||||||
|
= @epp_log.response
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
%li= link_to t('settings'), admin_settings_path
|
%li= link_to t('settings'), admin_settings_path
|
||||||
%li= link_to t('zonefile'), admin_zonefile_settings_path
|
%li= link_to t('zonefile'), admin_zonefile_settings_path
|
||||||
%li= link_to t(:domains_history), admin_domain_versions_path
|
%li= link_to t(:domains_history), admin_domain_versions_path
|
||||||
|
%li= link_to t(:epp_logs), admin_epp_logs_path
|
||||||
%li= link_to t(:background_jobs), admin_delayed_jobs_path
|
%li= link_to t(:background_jobs), admin_delayed_jobs_path
|
||||||
|
|
||||||
%li.divider
|
%li.divider
|
||||||
|
|
|
@ -481,3 +481,11 @@ en:
|
||||||
action_failed_due_to_server_error: 'Action failed due to server error'
|
action_failed_due_to_server_error: 'Action failed due to server error'
|
||||||
pending_transfer_was_not_found: 'Pending transfer was not found'
|
pending_transfer_was_not_found: 'Pending transfer was not found'
|
||||||
transfer_can_be_rejected_only_by_current_registrar: 'Transfer can be rejected only by current registrar'
|
transfer_can_be_rejected_only_by_current_registrar: 'Transfer can be rejected only by current registrar'
|
||||||
|
epp_logs: 'EPP logs'
|
||||||
|
epp_log: 'EPP log'
|
||||||
|
request_command: 'Request command'
|
||||||
|
request_object: 'Request object'
|
||||||
|
api_user: 'API user'
|
||||||
|
request: 'Request'
|
||||||
|
response: 'Response'
|
||||||
|
details: 'Details'
|
||||||
|
|
|
@ -40,6 +40,8 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
resource :dashboard
|
resource :dashboard
|
||||||
|
|
||||||
|
resources :epp_logs
|
||||||
|
|
||||||
root 'domains#index'
|
root 'domains#index'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
15
db/seeds.rb
15
db/seeds.rb
|
@ -61,16 +61,9 @@ User.where(
|
||||||
country: Country.where(name: 'Estonia').first
|
country: Country.where(name: 'Estonia').first
|
||||||
).first_or_create
|
).first_or_create
|
||||||
|
|
||||||
Setting.ds_algorithm = 2
|
Role.create(code: 'admin')
|
||||||
Setting.ds_data_allowed = true
|
Role.create(code: 'user')
|
||||||
Setting.ds_data_with_key_allowed = true
|
Role.create(code: 'customer_service')
|
||||||
Setting.key_data_allowed = true
|
|
||||||
|
|
||||||
Setting.dnskeys_min_count = 0
|
|
||||||
Setting.dnskeys_max_count = 9
|
|
||||||
Setting.ns_min_count = 2
|
|
||||||
Setting.ns_max_count = 11
|
|
||||||
|
|
||||||
Setting.transfer_wait_time = 0
|
|
||||||
|
|
||||||
|
User.update_all(role_id: Role.first.id)
|
||||||
# Setting.whois_enabled = true only uncomment this if you wish whois
|
# Setting.whois_enabled = true only uncomment this if you wish whois
|
||||||
|
|
|
@ -67,7 +67,6 @@ describe 'EPP Session', epp: true do
|
||||||
expect(response[:msg]).to match(/Already logged in. Use/)
|
expect(response[:msg]).to match(/Already logged in. Use/)
|
||||||
|
|
||||||
log = ApiLog::EppLog.all
|
log = ApiLog::EppLog.all
|
||||||
|
|
||||||
expect(log.length).to eq(3)
|
expect(log.length).to eq(3)
|
||||||
expect(log[0].request_command).to eq('hello')
|
expect(log[0].request_command).to eq('hello')
|
||||||
expect(log[0].request_successful).to eq(true)
|
expect(log[0].request_successful).to eq(true)
|
||||||
|
|
|
@ -21,6 +21,7 @@ describe User do
|
||||||
it { should be_able_to(:manage, EppUser.new) }
|
it { should be_able_to(:manage, EppUser.new) }
|
||||||
it { should be_able_to(:manage, Keyrelay.new) }
|
it { should be_able_to(:manage, Keyrelay.new) }
|
||||||
it { should be_able_to(:manage, LegalDocument.new) }
|
it { should be_able_to(:manage, LegalDocument.new) }
|
||||||
|
it { should be_able_to(:read, ApiLog::EppLog.new) }
|
||||||
it { should be_able_to(:index, :delayed_job) }
|
it { should be_able_to(:index, :delayed_job) }
|
||||||
it { should be_able_to(:create, :zonefile) }
|
it { should be_able_to(:create, :zonefile) }
|
||||||
it { should be_able_to(:access, :settings_menu) }
|
it { should be_able_to(:access, :settings_menu) }
|
||||||
|
@ -38,6 +39,7 @@ describe User do
|
||||||
it { should_not be_able_to(:manage, User.new) }
|
it { should_not be_able_to(:manage, User.new) }
|
||||||
it { should_not be_able_to(:manage, EppUser.new) }
|
it { should_not be_able_to(:manage, EppUser.new) }
|
||||||
it { should_not be_able_to(:manage, LegalDocument.new) }
|
it { should_not be_able_to(:manage, LegalDocument.new) }
|
||||||
|
it { should_not be_able_to(:read, ApiLog::EppLog.new) }
|
||||||
it { should_not be_able_to(:index, :delayed_job) }
|
it { should_not be_able_to(:index, :delayed_job) }
|
||||||
it { should_not be_able_to(:create, :zonefile) }
|
it { should_not be_able_to(:create, :zonefile) }
|
||||||
it { should_not be_able_to(:access, :settings_menu) }
|
it { should_not be_able_to(:access, :settings_menu) }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue