mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-27 06:05:19 +00:00
Show Connected Apps only to enterprise managers
Super-admins also saw that tab but connecting an app doesn't work unless you are a manager of that enterprise.
This commit is contained in:
@@ -21,7 +21,8 @@ module Admin
|
||||
show_payment_methods = can?(:manage_payment_methods, enterprise) && is_shop
|
||||
show_enterprise_fees = can?(:manage_enterprise_fees,
|
||||
enterprise) && (is_shop || enterprise.is_primary_producer)
|
||||
show_connected_apps = feature?(:connected_apps, spree_current_user, enterprise)
|
||||
show_connected_apps = can?(:manage_connected_apps, enterprise) &&
|
||||
feature?(:connected_apps, spree_current_user, enterprise)
|
||||
|
||||
build_enterprise_side_menu_items(
|
||||
is_shop:,
|
||||
|
||||
@@ -147,7 +147,8 @@ module Spree
|
||||
end
|
||||
can [:manage_payment_methods,
|
||||
:manage_shipping_methods,
|
||||
:manage_enterprise_fees], Enterprise do |enterprise|
|
||||
:manage_enterprise_fees,
|
||||
:manage_connected_apps], Enterprise do |enterprise|
|
||||
user.enterprises.include? enterprise
|
||||
end
|
||||
|
||||
|
||||
@@ -27,7 +27,8 @@ describe Admin::EnterprisesHelper, type: :helper do
|
||||
]
|
||||
end
|
||||
|
||||
it "lists enabled features", feature: :connected_apps do
|
||||
it "lists enabled features when allowed", feature: :connected_apps do
|
||||
user.enterprises << enterprise
|
||||
expect(visible_items.pluck(:name)).to include "connected_apps"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user