-
Notifications
You must be signed in to change notification settings - Fork 543
Implementing store owner settings management #695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
b562049
feat: add store settings management for store owners
Copilot f57c54d
fix: move admin sitemap migration from version 2.5 to 2.4
Copilot 1d7b448
Potential fix for pull request finding 'Generic catch clause'
KrzysztofPajak d8a2037
feat: make merchandise return reasons and actions per-store
Copilot 7cd454c
Add PermissionNames to Vendor settings menu item
KrzysztofPajak 8ad8344
Merge branch 'copilot/allow-store-owner-settings' of https://github.c…
KrzysztofPajak a36b145
feat: add Stores selector to admin views and access control to store …
Copilot fed6a1c
feat: filter admin merchandise return reason/action lists by selected…
Copilot a3aafbe
fix: admin store pre-selection and store owner all-stores access cont…
Copilot e47017b
fix: enforce store assignment server-side in Store area create POST a…
Copilot 47ad1a2
fix: preserve Stores/LimitedToStores on edit POST in Store area for r…
Copilot 38966b9
fix: clear cache after DeleteMerchandiseReturnAction
Copilot 418eabf
fix: update mapping test snapshots for LimitedToStores field on Merch…
Copilot c5e82a0
Fix Sales settings invalid ModelState flow
Copilot cf28a1a
fix: add Vendor settings to migration adminOnlyItems to match Standar…
Copilot 0019b67
Fix store filtering at IQueryable level before ToList in MerchandiseR…
Copilot 98785e0
Fix CS0266: explicitly type query as IQueryable to allow Where reassi…
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/Modules/Grand.Module.Migration/Migrations/2.4/MigrationUpdateAdminSiteMap.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| using Grand.Data; | ||
| using Grand.Domain.Admin; | ||
| using Grand.Domain.Permissions; | ||
| using Grand.Infrastructure.Migrations; | ||
| using Microsoft.Extensions.DependencyInjection; | ||
| using Microsoft.Extensions.Logging; | ||
|
|
||
| namespace Grand.Module.Migration.Migrations._2._4; | ||
|
|
||
| public class MigrationUpdateAdminSiteMap : IMigration | ||
| { | ||
| public int Priority => 1; | ||
| public DbVersion Version => new(2, 4); | ||
| public Guid Identity => new("B7C3D8E2-F1A4-4B9E-8C62-197E3F5A4D21"); | ||
| public string Name => "Update standard admin site map - restrict Vendor, Push notifications, Admin search, System settings to System permission"; | ||
|
|
||
| /// <summary> | ||
| /// Upgrade process | ||
| /// </summary> | ||
| /// <param name="serviceProvider"></param> | ||
| /// <returns></returns> | ||
| public bool UpgradeProcess(IServiceProvider serviceProvider) | ||
| { | ||
| var repository = serviceProvider.GetRequiredService<IRepository<AdminSiteMap>>(); | ||
| var logService = serviceProvider.GetRequiredService<ILogger<MigrationUpdateAdminSiteMap>>(); | ||
|
|
||
| try | ||
| { | ||
| var sitemapSettings = repository.Table.FirstOrDefault(x => x.SystemName == "Settings"); | ||
| if (sitemapSettings == null) return true; | ||
|
|
||
| var adminOnlyItems = new[] { | ||
| "Vendor settings", | ||
| "Push notifications settings", | ||
| "Admin search settings", | ||
| "System settings" | ||
| }; | ||
|
|
||
| foreach (var itemName in adminOnlyItems) | ||
| { | ||
| var item = sitemapSettings.ChildNodes.FirstOrDefault(x => x.SystemName == itemName); | ||
| if (item != null && !item.PermissionNames.Contains(PermissionSystemName.System)) | ||
| item.PermissionNames.Add(PermissionSystemName.System); | ||
| } | ||
|
|
||
| repository.Update(sitemapSettings); | ||
| } | ||
| catch (InvalidOperationException ex) | ||
| { | ||
| logService.LogError(ex, "UpgradeProcess - UpdateAdminSiteMap (2.4)"); | ||
| } | ||
|
|
||
| return true; | ||
| } | ||
| } |
1 change: 1 addition & 0 deletions
1
...g.Tests/AdminShared/CommonMappingTests.MerchandiseReturnActionModel_ToDomain.verified.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| { | ||
| Name: Refund, | ||
| DisplayOrder: 1, | ||
| LimitedToStores: false, | ||
| Id: ObjectId_1 | ||
| } |
1 change: 1 addition & 0 deletions
1
...g.Tests/AdminShared/CommonMappingTests.MerchandiseReturnReasonModel_ToDomain.verified.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| { | ||
| Name: Defective, | ||
| DisplayOrder: 1, | ||
| LimitedToStores: false, | ||
| Id: ObjectId_1 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.