[openstreetmap/openstreetmap-website] Merge ApiCapability class into ApiAbility (PR #5429)
Anton Khorev
notifications at github.com
Fri Dec 20 15:32:09 UTC 2024
@AntonKhorev commented on this pull request.
> @@ -64,11 +64,7 @@ def authorize(errormessage = "Couldn't authenticate you")
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))
- else
- ApiAbility.new(current_user)
- end
+ ApiAbility.new((doorkeeper_token if doorkeeper_token&.accessible?))
This is where you get `current_user`, it requires a token:
https://github.com/openstreetmap/openstreetmap-website/blob/e2904daf7764928d33a67055349d5660040e16dd/app/controllers/api_controller.rb#L98
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5429#discussion_r1894077903
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/5429/review/2517796750 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20241220/f733fae3/attachment-0001.htm>
More information about the rails-dev
mailing list