Implementing store owner settings management#695
Conversation
- Add SettingController to Grand.Web.Store with GeneralCommon, Catalog, Customer, Sales, Media (no file manager), Content actions - Create views and partials for all settings pages in Store area - Media settings preserve file manager fields (AllowedFileTypes, FileManagerEnabledCommands, FileManagerDisabledUICommands) - Add Settings model namespace to Store _ViewImports.cshtml - Restrict PushNotifications/AdminSearch/SystemSettings SiteMap entries to ManageSystem permission so store managers cannot see them - Add migration 2.5 to update existing installations Agent-Logs-Url: https://github.com/grandnode/grandnode2/sessions/e0160bcc-7e3e-4cd7-9f36-e0a1f176f95b Co-authored-by: KrzysztofPajak <16772986+KrzysztofPajak@users.noreply.github.com>
|
@copilot migration to version 2.4 |
Agent-Logs-Url: https://github.com/grandnode/grandnode2/sessions/25e0c368-068f-46b8-9ec9-e6ba9aeee5a4 Co-authored-by: KrzysztofPajak <16772986+KrzysztofPajak@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
|
@copilot Merchandise return reasons and Merchandise return actions, need to be per store |
Agent-Logs-Url: https://github.com/grandnode/grandnode2/sessions/1bb61bfc-6900-4ff3-928d-0e52909309b9 Co-authored-by: KrzysztofPajak <16772986+KrzysztofPajak@users.noreply.github.com>
Done in commit d8a2037. Both Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Added a new `PermissionNames` property to the `StandardAdminSiteMap` class in `StandardAdminSiteMap.cs`. This property specifies required permissions for the "Vendor settings" menu item, enhancing access control.
…om/grandnode/grandnode2 into copilot/allow-store-owner-settings
|
@copilot MerchandiseReturnReason and MerchandiseReturnActio in Grand.Web.Admin - Edit/Add shoud be able to select store (only one or any), Grand.Web.Store - should be able add, edit new store with Current store, If Edit and store is not selected store owner can't edit, delete |
…edit/delete Agent-Logs-Url: https://github.com/grandnode/grandnode2/sessions/72a91e28-9c24-4ec8-a1c3-31096706e27b Co-authored-by: KrzysztofPajak <16772986+KrzysztofPajak@users.noreply.github.com>
Done in commit a36b145. Grand.Web.Admin: Both MerchandiseReturnReason and MerchandiseReturnAction create/edit partials now include a Grand.Web.Store: Edit and delete actions for both MerchandiseReturnReason and MerchandiseReturnAction now check whether the current store is included in the item's Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot Grand.Web.Amin - list Merchandise return reasons and Merchandise return actions show for all store - to just only for selected store |
|
@copilot Grand.Web.Admin - edit store does not select current store, Grand.Web.Store - it allow to edit/delete Merchandise return actions/Merchandise return reasons event if the belong to all store - it shouldn't |
… store scope Agent-Logs-Url: https://github.com/grandnode/grandnode2/sessions/ea9c4855-f181-40ae-b3d4-f99c9c898926 Co-authored-by: KrzysztofPajak <16772986+KrzysztofPajak@users.noreply.github.com>
Done in commit fed6a1c. The admin Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Agent-Logs-Url: https://github.com/grandnode/grandnode2/sessions/867feaba-6afe-4cab-a9be-09d8f705a90d Co-authored-by: KrzysztofPajak <16772986+KrzysztofPajak@users.noreply.github.com>
... Fixed in commit 38966b9. |
|
@copilot fix the tests Grand.Mapping.Tests.AdminShared |
…andiseReturn entities Agent-Logs-Url: https://github.com/grandnode/grandnode2/sessions/1db192cd-09d5-4459-98ed-b112dabe429b Co-authored-by: KrzysztofPajak <16772986+KrzysztofPajak@users.noreply.github.com>
Fixed in commit 418eabf. The two failing snapshot files ( Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull request overview
This PR adds store-owner-facing settings management and makes merchandise return reasons/actions store-scoped, ensuring both admin and store-owner UIs/services respect the active store context.
Changes:
- Add a Store-area
SettingControllerplus corresponding Razor views/partials for managing common, catalog, sales, media, customer, and content settings. - Make merchandise return reasons/actions store-linked (domain + models + mappings) and update service/API consumers to filter by store (with updated cache keys/invalidation).
- Adjust admin UI to preselect/filter by store scope for return reasons/actions and add a DB migration to update selected admin sitemap permissions.
Reviewed changes
Copilot reviewed 56 out of 56 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Web/Grand.Web/Features/Handlers/Orders/GetMerchandiseReturnHandler.cs | Fetch return reasons/actions scoped to the current store. |
| src/Web/Grand.Web.Store/Controllers/SettingController.cs | New Store-area settings controller + store-owner guarded CRUD for return reasons/actions. |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Sales.cshtml | Store-area sales settings page with tabstrip layout. |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/Sales.TabShoppingCart.cshtml | Shopping cart settings partial for Store area. |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/Sales.TabOrderSettings.cshtml | Order settings partial for Store area. |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/Sales.TabMerchandiseReturn.cshtml | Merchandise return settings partial + embeds reasons/actions grids. |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/Sales.TabLoyaltyPoints.cshtml | Loyalty points settings partial for Store area. |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/MerchandiseReturnReasons.cshtml | Store-area grid for listing/editing return reasons. |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/MerchandiseReturnActions.cshtml | Store-area grid for listing/editing return actions. |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/GeneralCommon.TabStoreInformationSettings.cshtml | Store information/common settings partial (Store area). |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/GeneralCommon.TabSEOSettings.cshtml | SEO settings partial (Store area). |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/GeneralCommon.TabSecuritySettings.cshtml | Security/CAPTCHA settings partial (Store area). |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/GeneralCommon.TabPdfSettings.cshtml | PDF settings partial (Store area). |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/GeneralCommon.TabMenuSettings.cshtml | Menu/display settings partial (Store area). |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/Customer.TabCustomerSettings.cshtml | Customer settings partial (Store area). |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/Customer.TabCustomerSecurity.cshtml | Customer security settings partial (Store area). |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/Customer.TabCustomerFormFields.cshtml | Customer form fields partial (Store area). |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/Customer.TabAddressFormFields.cshtml | Address form fields partial (Store area). |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/CreateOrUpdate.MerchandiseReturnReason.cshtml | Store-area create/edit partial for return reason (no Stores field). |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/CreateOrUpdate.MerchandiseReturnAction.cshtml | Store-area create/edit partial for return action (no Stores field). |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/Content.TabNewsSettings.cshtml | News settings partial (Store area). |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/Content.TabKnowledgebaseSettings.cshtml | Knowledgebase settings partial (Store area). |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/Content.TabBlogSettings.cshtml | Blog settings partial (Store area). |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/Catalog.TabSortOptions.cshtml | Sort options grid partial (Store area). |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/Catalog.TabSharing.cshtml | Sharing settings partial (Store area). |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/Catalog.TabSearchSettings.cshtml | Search settings partial (Store area). |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/Catalog.TabProductReviews.cshtml | Product reviews settings partial (Store area). |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/Catalog.TabPerformance.cshtml | Performance settings partial (Store area). |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/Catalog.TabCompareProducts.cshtml | Compare products settings partial (Store area). |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/MerchandiseReturnReasonEdit.cshtml | Store-area edit page for return reason. |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/MerchandiseReturnReasonCreate.cshtml | Store-area create page for return reason. |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/MerchandiseReturnActionEdit.cshtml | Store-area edit page for return action. |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/MerchandiseReturnActionCreate.cshtml | Store-area create page for return action. |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Media.cshtml | Store-area media settings page. |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/GeneralCommon.cshtml | Store-area general/common settings page. |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Customer.cshtml | Store-area customer settings page. |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Content.cshtml | Store-area content settings page. |
| src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Catalog.cshtml | Store-area catalog settings page. |
| src/Web/Grand.Web.Store/Areas/Store/Views/_ViewImports.cshtml | Add Settings models import for Store-area views. |
| src/Web/Grand.Web.AdminShared/Models/Settings/MerchandiseReturnReasonModel.cs | Add Stores linkage to reason model for UI + mapping. |
| src/Web/Grand.Web.AdminShared/Models/Settings/MerchandiseReturnActionModel.cs | Add Stores linkage to action model for UI + mapping. |
| src/Web/Grand.Web.AdminShared/Mapper/MerchandiseReturnReasonProfile.cs | Map Stores + derive LimitedToStores for return reasons. |
| src/Web/Grand.Web.AdminShared/Mapper/MerchandiseReturnActionProfile.cs | Map Stores + derive LimitedToStores for return actions. |
| src/Web/Grand.Web.Admin/Controllers/SettingController.cs | Admin filtering/preselect for store-scoped return reasons/actions. |
| src/Web/Grand.Web.Admin/Areas/Admin/Views/Setting/Partials/CreateOrUpdate.MerchandiseReturnReason.cshtml | Add Stores multi-select to admin create/edit reason UI. |
| src/Web/Grand.Web.Admin/Areas/Admin/Views/Setting/Partials/CreateOrUpdate.MerchandiseReturnAction.cshtml | Add Stores multi-select to admin create/edit action UI. |
| src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MerchandiseReturnReasonModel_ToDomain.verified.txt | Update mapping snapshot to include LimitedToStores. |
| src/Tests/Grand.Mapping.Tests/AdminShared/CommonMappingTests.MerchandiseReturnActionModel_ToDomain.verified.txt | Update mapping snapshot to include LimitedToStores. |
| src/Modules/Grand.Module.Migration/Migrations/2.4/MigrationUpdateAdminSiteMap.cs | Migration to add System permission to selected sitemap items. |
| src/Modules/Grand.Module.Installer/Utilities/StandardAdminSiteMap.cs | Installer sitemap updates: System permission on selected settings nodes. |
| src/Core/Grand.Infrastructure/Caching/Constants/MerchandiseReturnCacheKey.cs | Make return-reason/action cache keys store-specific + add prefix patterns. |
| src/Core/Grand.Domain/Orders/MerchandiseReturnReason.cs | Add store-linking fields (LimitedToStores, Stores). |
| src/Core/Grand.Domain/Orders/MerchandiseReturnAction.cs | Add store-linking fields (LimitedToStores, Stores). |
| src/Business/Grand.Business.Core/Interfaces/Checkout/Orders/IMerchandiseReturnService.cs | Add optional storeId parameter to action/reason retrieval methods. |
| src/Business/Grand.Business.Checkout/Services/Orders/MerchandiseReturnService.cs | Implement store filtering + store-scoped caching + improved cache invalidation. |
Comments suppressed due to low confidence (1)
src/Business/Grand.Business.Checkout/Services/Orders/MerchandiseReturnService.cs:281
- Store filtering is applied after materializing the full list with ToList(). This loads all reasons into memory even when a storeId is provided. Apply the store filter at the IQueryable level before ToList() so the database does the filtering.
var query = from rra in _merchandiseReturnReasonRepository.Table
orderby rra.DisplayOrder
select rra;
var reasons = query.ToList();
if (!string.IsNullOrEmpty(storeId))
reasons = reasons.Where(x => !x.LimitedToStores || x.Stores.Contains(storeId)).ToList();
return await Task.FromResult(reasons);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| var query = from rra in _merchandiseReturnActionRepository.Table | ||
| orderby rra.DisplayOrder | ||
| select rra; | ||
| return await Task.FromResult(query.ToList()); | ||
| var actions = query.ToList(); | ||
| if (!string.IsNullOrEmpty(storeId)) | ||
| actions = actions.Where(x => !x.LimitedToStores || x.Stores.Contains(storeId)).ToList(); | ||
| return await Task.FromResult(actions); |
There was a problem hiding this comment.
Fixed in commit 0019b67. The store filter is now applied at the IQueryable level before ToList() in both GetAllMerchandiseReturnActions and GetAllMerchandiseReturnReasons, so the database does the filtering instead of loading all records into memory first. The same fix was also applied at line 275 as noted.
Agent-Logs-Url: https://github.com/grandnode/grandnode2/sessions/ab9d9d31-9e76-4bdf-824a-54ba7b72a9bc Co-authored-by: KrzysztofPajak <16772986+KrzysztofPajak@users.noreply.github.com>
…dAdminSiteMap Agent-Logs-Url: https://github.com/grandnode/grandnode2/sessions/fef80026-1805-44a0-84d7-d5bbc2550c28 Co-authored-by: KrzysztofPajak <16772986+KrzysztofPajak@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
…eturnService Agent-Logs-Url: https://github.com/grandnode/grandnode2/sessions/f54db71b-9444-46d9-9e1d-6ac9ee183283 Co-authored-by: KrzysztofPajak <16772986+KrzysztofPajak@users.noreply.github.com>
|
@copilot src/Business/Grand.Business.Checkout/Services/Orders/MerchandiseReturnService.cs(131,25): Error CS0266: Cannot implicitly convert type 'System.Linq.IQueryable<Grand.Domain.Orders.MerchandiseReturnAction>' to 'System.Linq.IOrderedQueryable<Grand.Domain.Orders.MerchandiseReturnAction>'. An explicit conversion exists (are you missing a cast?) |
…gnment Agent-Logs-Url: https://github.com/grandnode/grandnode2/sessions/a8ebdafc-8eef-4c8f-85a3-c22cd47de3b5 Co-authored-by: KrzysztofPajak <16772986+KrzysztofPajak@users.noreply.github.com>
Fixed in commit |
ToList()inGetAllMerchandiseReturnActionsToList()inGetAllMerchandiseReturnReasonsIQueryable<T>so the.Where(...)reassignment compiles