From 18aa16650d8030c28591a7a7e0234cfd5b4ebc9c Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Fri, 19 Jul 2019 23:12:19 +0100 Subject: [PATCH] Remove dependency to Spree::ApiConfiguration, overall requires_authentication? is true, exceptions will be endpoint specific --- app/controllers/spree/api/base_controller.rb | 4 ++-- spec/controllers/spree/api/base_controller_spec.rb | 1 - spec/spec_helper.rb | 2 -- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/controllers/spree/api/base_controller.rb b/app/controllers/spree/api/base_controller.rb index 7dc2867eb3..3f28596fec 100644 --- a/app/controllers/spree/api/base_controller.rb +++ b/app/controllers/spree/api/base_controller.rb @@ -57,7 +57,7 @@ module Spree def check_for_user_or_api_key # User is already authenticated with Spree, make request this way instead. return true if @current_api_user = try_spree_current_user || - !Spree::Api::Config[:requires_authentication] + !requires_authentication? return if api_key.present? render("spree/api/errors/must_specify_api_key", status: :unauthorized) && return @@ -86,7 +86,7 @@ module Spree end def requires_authentication? - Spree::Api::Config[:requires_authentication] + true end def not_found diff --git a/spec/controllers/spree/api/base_controller_spec.rb b/spec/controllers/spree/api/base_controller_spec.rb index b8ad0580a1..cab638c74e 100644 --- a/spec/controllers/spree/api/base_controller_spec.rb +++ b/spec/controllers/spree/api/base_controller_spec.rb @@ -14,7 +14,6 @@ describe Spree::Api::BaseController do before do allow(controller).to receive_messages try_spree_current_user: double(email: "spree@example.com") - Spree::Api::Config[:requires_authentication] = true end it "can make a request" do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 499a810302..59354e2701 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -127,8 +127,6 @@ RSpec.configure do |config| spree_config.shipping_instructions = true spree_config.auto_capture = true end - - Spree::Api::Config[:requires_authentication] = true end # Helpers