mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Fix variant_overrides permissions for overrides that belong to the supplier herself
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
class AllowAllSuppliersOwnVariantOverrides < ActiveRecord::Migration
|
||||
def up
|
||||
# This migration is fixing a detail of previous migration RevokeVariantOverrideswithoutPermissions
|
||||
# Here we allow all variant_overrides where hub_id is the products supplier_id
|
||||
# This is needed when the supplier herself uses the inventory to manage stock and not the catalog
|
||||
owned_variant_overrides = VariantOverride.unscoped
|
||||
.joins(variant: :product).where("spree_products.supplier_id = variant_overrides.hub_id")
|
||||
|
||||
owned_variant_overrides.update_all(permission_revoked_at: nil)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20181020103501) do
|
||||
ActiveRecord::Schema.define(:version => 20181031105158) do
|
||||
|
||||
create_table "account_invoices", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
|
||||
Reference in New Issue
Block a user