diff --git a/app/controllers/user_api_keys_controller.rb b/app/controllers/user_api_keys_controller.rb index 5ab817980..175623751 100644 --- a/app/controllers/user_api_keys_controller.rb +++ b/app/controllers/user_api_keys_controller.rb @@ -38,13 +38,6 @@ class UserApiKeysController < ApplicationController @auth_redirect = params[:auth_redirect] @push_url = params[:push_url] - if @access.include?("p") - if !SiteSetting.allow_push_user_api_keys || - !SiteSetting.allowed_user_api_push_urls.split('|').any?{|u| params[:push_url] == u} - @access.gsub!("p","") - @push_url = nil - end - end rescue Discourse::InvalidAccess @generic_error = true end @@ -123,7 +116,7 @@ class UserApiKeysController < ApplicationController ].each{|p| params.require(p)} end - def validate_params(skip_push_check = false) + def validate_params request_read = params[:access].include? 'r' request_read ||= params[:access].include? 'p' request_write = params[:access].include? 'w' diff --git a/spec/controllers/user_api_keys_controller_spec.rb b/spec/controllers/user_api_keys_controller_spec.rb index a2acc61e6..9884eff07 100644 --- a/spec/controllers/user_api_keys_controller_spec.rb +++ b/spec/controllers/user_api_keys_controller_spec.rb @@ -122,6 +122,7 @@ TXT expect(parsed["access"].split('').sort).to eq(['r']) key = user.user_api_keys.first + expect(key.push).to eq(true) expect(key.push_url).to eq("https://push.it/here") end