Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

Plan fix: escalate Task 10 review's per-id ownership filter gap to a Task 11 blocking prerequisite

KrzysztofPajak0a1a8e1ce098
diff --git a/docs/superpowers/plans/2026-08-16-arch001-product-consolidation-phase1.md b/docs/superpowers/plans/2026-08-16-arch001-product-consolidation-phase1.md
index 165f4513c..4604e77e1 100644
--- a/docs/superpowers/plans/2026-08-16-arch001-product-consolidation-phase1.md
+++ b/docs/superpowers/plans/2026-08-16-arch001-product-consolidation-phase1.md
@@ -1290,7 +1290,11 @@ Expected: no matches (or only local variables inside method bodies that read `sc
## Task 11: Convert the three host `ProductController`s to thin subclasses
-**Blocking prerequisite (added after Task 8 row 15's review):** do not subclass Vendor's `ProductController` onto `BaseProductController` until Task 10's `PrepareBulkEditProductModel` row is done and confirmed to preserve vendor-scoped filtering on the bulk-edit grid — see that row's note. Wiring Vendor on first would silently expose every vendor's products in `BulkEditSelect`'s grid to every other vendor. Admin and Store have no equivalent gap and can be subclassed independently of this prerequisite.
+**Blocking prerequisite (added after Task 8 row 15's review):** do not subclass Vendor's `ProductController` onto `BaseProductController` until Task 10's `PrepareBulkEditProductModel` row is done and confirmed to preserve vendor-scoped filtering on the bulk-edit grid — see that row's note. Wiring Vendor on first would silently expose every vendor's products in `BulkEditSelect`'s grid to every other vendor. Admin and Store have no equivalent gap and can be subclassed independently of this prerequisite. **Status: satisfied as of Task 10 (`ae5a6d187`)** — `PrepareBulkEditProductModel` now vendor-scopes via `IAdminDataScope<TEntity>.DefaultVendorId`, reviewed and confirmed unbypassable.
+
+**Second blocking prerequisite (added after Task 10's review, opus):** `InsertRelatedProductModel`/`InsertSimilarProductModel`/`InsertBundleProductModel`/`InsertCrossSellProductModel`/`InsertRecommendedProductModel` in `Grand.Web.AdminShared/Services/ProductViewModelService.cs` do not filter `SelectedProductIds` by ownership before inserting mapping rows — Vendor's original `InsertRelatedProductModel` does (`if (product == null || !HasAccessToProduct(product)) continue;`). This gap is inert today only because Vendor isn't yet subclassed onto `BaseProductController`; it goes live the moment this task wires Vendor in, letting a vendor map another vendor's products into their own related/similar/bundle/cross-sell/recommended lists. Add the same per-id `scope.HasAccess` filter (the pattern already used for `AssociatedProductAddPopup` in Task 8 row 9) to all five `Insert*ProductModel` methods in `ProductViewModelService.cs` as part of this task, before or immediately after wiring Vendor's controller — verify with a test asserting a not-owned id is silently dropped, not inserted.
+
+**Risk note (added after Task 10's review):** `InsertProductPicture` in AdminShared's service never sets `IsDefault`; Vendor's original sets `IsDefault = product.ProductPictures.Any()` (reads as inverted/likely-buggy in the original, but is nonetheless a behavior change for the Vendor host once wired). Confirm intentionally during this task's Vendor smoke-test rather than discovering it post-merge.
**Files:**
- Modify (rewrite, shrink): `src/Web/Grand.Web.Admin/Controllers/ProductController.cs`