Api log contains only username + refactor #2793

This commit is contained in:
Priit Tark 2015-07-27 23:00:01 +03:00
parent 682d2918ce
commit 7f44227370
8 changed files with 33 additions and 42 deletions

View file

@ -56,15 +56,7 @@ class ApplicationController < ActionController::Base
end
def user_for_paper_trail
if defined?(current_user) && current_user.present?
# Most of the time it's not loaded in correct time because PaperTrail before filter kicks in
# before current_user is defined. PaperTrail is triggered also at current_user
api_user_log_str(current_user)
elsif current_user.present?
"#{current_user.id}-#{current_user.username}"
else
'public'
end
user_log_str(current_user)
end
def depp_current_user
@ -74,11 +66,8 @@ class ApplicationController < ActionController::Base
)
end
def api_user_log_str(user)
if user.present?
"#{user.id}-api-#{user.username}"
else
'api-public'
end
def user_log_str(user)
return 'public' if user.nil?
"#{user.id}-#{user.class}: #{user.username}"
end
end