Fix current_resource_owner caching implementation
This commit is contained in:
parent
c84e7e3451
commit
0587875a75
|
@ -63,12 +63,13 @@ class Api::BaseController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def current_resource_owner
|
def current_resource_owner
|
||||||
return nil if cookies.signed['_session_id'].nil?
|
if doorkeeper_token
|
||||||
# return @current_user if doorkeeper_token.nil?
|
|
||||||
@current_user ||= Rails.cache.fetch("dk:user:#{doorkeeper_token.resource_owner_id}", expires_in: 25.hours) do
|
@current_user ||= Rails.cache.fetch("dk:user:#{doorkeeper_token.resource_owner_id}", expires_in: 25.hours) do
|
||||||
User.find(doorkeeper_token.resource_owner_id)
|
User.find(doorkeeper_token.resource_owner_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
return @current_user
|
||||||
|
end
|
||||||
|
|
||||||
def current_user
|
def current_user
|
||||||
current_resource_owner || super
|
current_resource_owner || super
|
||||||
|
|
Loading…
Reference in New Issue