X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/71b21ec47371c7210dfcb234f7bfa0adf00efad1..0888f43d7b5a5e23874ff1a291049b90481d1273:/app/controllers/application_controller.rb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 690bdf5ca..20fcc5f47 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -469,11 +469,12 @@ class ApplicationController < ActionController::Base end def current_ability - Ability.new(current_user).merge(granted_capability) - end - - def granted_capability - Capability.new(current_user, current_token) + # Add in capabilities from the oauth token if it exists and is a valid access token + if Authenticator.new(self, [:token]).allow? + Ability.new(current_user).merge(Capability.new(current_token)) + else + Ability.new(current_user) + end end def deny_access(_exception)