mirror of
https://github.com/internetee/registry.git
synced 2025-07-19 17:25:57 +02:00
Version refactored
This commit is contained in:
parent
c1949e7069
commit
3e2be53853
48 changed files with 379 additions and 147 deletions
|
@ -2,12 +2,16 @@ class Admin::DomainVersionsController < AdminController
|
|||
load_and_authorize_resource
|
||||
|
||||
def index
|
||||
@q = DomainVersion.deleted.search(params[:q])
|
||||
@domains = @q.result.page(params[:page])
|
||||
@domain = Domain.find(params[:domain_id])
|
||||
@versions = @domain.versions
|
||||
end
|
||||
|
||||
def show
|
||||
@versions = DomainVersion.where(item_id: params[:id])
|
||||
@name = @versions.last.name
|
||||
end
|
||||
# def index
|
||||
# # @q = DomainVersion.deleted.search(params[:q])
|
||||
# # @domains = @q.result.page(params[:page])
|
||||
# end
|
||||
|
||||
# def show
|
||||
# @versions = DomainVersion.where(item_id: params[:id])
|
||||
# end
|
||||
end
|
||||
|
|
|
@ -16,13 +16,23 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
def user_for_paper_trail
|
||||
if defined?(current_api_user) && current_api_user.present?
|
||||
"#{current_api_user.id}-api-#{current_api_user.username}"
|
||||
# Most of the time it's not loaded in correct time because PaperTrail before filter kicks in
|
||||
# before current_api_user is defined. PaperTrail is triggered also at current_api_user
|
||||
api_user_log_str(current_api_user)
|
||||
elsif current_user.present?
|
||||
"#{current_user.id}-#{current_user.username}"
|
||||
else
|
||||
'public'
|
||||
end
|
||||
end
|
||||
|
||||
def api_user_log_str(user)
|
||||
if user.present?
|
||||
"#{user.id}-api-#{user.username}"
|
||||
else
|
||||
'api-public'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class ApplicationController < ActionController::Base
|
||||
|
|
|
@ -22,7 +22,14 @@ class EppController < ApplicationController
|
|||
end
|
||||
|
||||
def current_api_user
|
||||
@current_api_user ||= ApiUser.find(epp_session[:api_user_id]) if epp_session[:api_user_id]
|
||||
return @current_api_user if @current_api_user
|
||||
|
||||
@current_api_user ||= ApiUser.find_by_id(epp_session[:api_user_id])
|
||||
# by default PaperTrail uses before filter and at that
|
||||
# time current_api_user is not yet present
|
||||
::PaperTrail.whodunnit = api_user_log_str(@current_api_user)
|
||||
::PaperSession.session = epp_session.session_id if epp_session.session_id.present?
|
||||
@current_api_user
|
||||
end
|
||||
|
||||
# ERROR + RESPONSE HANDLING
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue