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