mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Search within all enterprises if user is the super admin
This commit is contained in:
committed by
Konrad
parent
2c2d244c56
commit
cdf71b419f
@@ -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]).
|
||||
|
||||
@@ -755,7 +755,6 @@ describe '
|
||||
end
|
||||
|
||||
it "finds a customer by name" do
|
||||
pending("issue #9684")
|
||||
serching_for_customers
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user