Search within all enterprises if user is the super admin

This commit is contained in:
Jean-Baptiste Bellet
2022-09-19 17:36:07 +02:00
committed by Konrad
parent 2c2d244c56
commit cdf71b419f
2 changed files with 6 additions and 2 deletions

View File

@@ -19,7 +19,12 @@ module Spree
def customers
@customers = []
if spree_current_user.enterprises.pluck(:id).include? search_params[:distributor_id].to_i
enterprise_ids = if spree_current_user.admin?
Enterprise.pluck(:id)
else
spree_current_user.enterprises.pluck(:id)
end
if enterprise_ids.include? search_params[:distributor_id].to_i
@customers = Customer.
ransack(m: 'or', email_start: search_params[:q], first_name_start: search_params[:q],
last_name_start: search_params[:q]).

View File

@@ -755,7 +755,6 @@ describe '
end
it "finds a customer by name" do
pending("issue #9684")
serching_for_customers
end
end