mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-09 03:20:21 +00:00
Remove dependency to Spree::ApiConfiguration, overall requires_authentication? is true, exceptions will be endpoint specific
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user