Pass user to ApiAbility
This commit is contained in:
parent
bb5bad9115
commit
304e0ef638
4 changed files with 43 additions and 33 deletions
|
@ -65,9 +65,10 @@ class ApiController < ApplicationController
|
|||
def current_ability
|
||||
# Use capabilities from the oauth token if it exists and is a valid access token
|
||||
if doorkeeper_token&.accessible?
|
||||
ApiAbility.new(doorkeeper_token)
|
||||
user = User.find(doorkeeper_token.resource_owner_id)
|
||||
ApiAbility.new(user, doorkeeper_token)
|
||||
else
|
||||
ApiAbility.new(nil)
|
||||
ApiAbility.new(nil, nil)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue