File tree Expand file tree Collapse file tree 2 files changed +7
-10
lines changed
Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -36,18 +36,15 @@ def me
3636 # define instance variable json and associated getter and setter methods
3737 attr_accessor :json
3838
39- def get_client_and_server_details # rubocop:todo Naming/AccessorMethodName
40- @server = ApplicationService . application_name
41- @client = OauthApplication . find ( doorkeeper_token . application_id ) if doorkeeper_token
42- @scopes = doorkeeper_token . scopes . to_a if doorkeeper_token
43- return unless doorkeeper_token &.resource_owner_id
44-
45- @resource_owner = User . find ( doorkeeper_token . resource_owner_id )
39+ def get_client_and_server_details
40+ @application = ApplicationService . application_name
41+ @caller = request . remote_ip if @client . blank?
42+ @caller = @client . is_a? ( User ) ? @client . name ( false ) : @client . name if @client . present?
4643 end
4744
4845 def log_access
49- Rails . logger . info "Client (OAuth) application name: #{ @client . name } "
50- Rails . logger . info "Client (OAuth) application uid: #{ @client . uid } "
46+ Rails . logger . info "Client (OAuth) application name: #{ @client . name } " if @client . present?
47+ Rails . logger . info "Client (OAuth) application uid: #{ @client . uid } " if @client . present?
5148 Rails . logger . info "Resource owner id: #{ @resource_owner . id } " if @resource_owner
5249 end
5350
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ json.ignore_nil!
1515json . server @server
1616json . source "#{ request . method } #{ request . path } "
1717json . time Time . now . to_formatted_s ( :iso8601 )
18- json . client @client . name
18+ json . client @client . name if @client . present?
1919json . code response . status
2020json . message Rack ::Utils ::HTTP_STATUS_CODES [ response . status ]
2121
You can’t perform that action at this time.
0 commit comments