mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Only show payment methods that user has access to
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
Spree::Admin::PaymentMethodsController.class_eval do
|
||||
# Only show payment methods that user has access to.
|
||||
# ! Redundant code copied from Spree::Admin::ResourceController with two added lines
|
||||
def collection
|
||||
return parent.send(controller_name) if parent_data.present?
|
||||
if model_class.respond_to?(:accessible_by) && !current_ability.has_block?(params[:action], model_class)
|
||||
model_class.accessible_by(current_ability, action).
|
||||
managed_by(spree_current_user) # this line added
|
||||
else
|
||||
model_class.scoped.
|
||||
managed_by(spree_current_user) # this line added
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user