def current_ability
# Use capabilities from the oauth token if it exists and is a valid access token
if doorkeeper_token&.accessible?
- ApiAbility.new(nil).merge(ApiCapability.new(doorkeeper_token))
+ ApiAbility.new(doorkeeper_token)
else
- ApiAbility.new(current_user)
+ ApiAbility.new(nil)
end
end
raise OSM::APIRateLimitExceeded if new_changes > max_changes
end
+
+ def scope_enabled?(scope)
+ doorkeeper_token&.includes_scope?(scope)
+ end
+
+ helper_method :scope_enabled?
end