Skip to content

Apply the order scope to the selected-orders export and delete - #1023

Merged
KrzysztofPajak merged 1 commit into
developfrom
fix/order-bulk-scope
Nov 4, 2026
Merged

KrzysztofPajak merged 1 commit into
developfrom
fix/order-bulk-scope

Conversation

@KrzysztofPajak

Copy link
Copy Markdown
Member

Type: bugfix

Issue

The order list, ExportExcelAll and PdfInvoiceSelected apply the staff member's order scope (IAdminDataScope<Order>). ExportExcelSelected and DeleteSelected in the Admin OrderController did not, so the bulk actions did not follow the same rule as the rest of the order screens.

Solution

Both actions keep only the orders scope.HasAccess allows, the same check as PdfInvoiceSelected. Nothing changes for administrators.

Tests: OrderControllerScopeTests.

No new resources, settings or migrations.

Breaking changes

None.

Testing

Unit tests pass: Grand.Web.Admin.Tests (1865).

  1. In Admin, select orders on the order list and choose Export to Excel (selected). The file contains the selected orders.
  2. Select orders without shipments and choose Delete (selected). They are deleted.

ExportExcelSelected and DeleteSelected took the order ids from the request and acted on every order found. They now skip orders the staff member's scope does not cover, as PdfInvoiceSelected already does, so a Sales Manager exports and deletes only their sales employees' orders.
Copilot AI balanced review requested due to automatic review settings November 4, 2026 19:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Comment on lines +109 to +111
foreach (var order in await OrderService.GetOrdersByIds(ids))
if (await Scope.HasAccess(order))
orders.Add(order);
@KrzysztofPajak
KrzysztofPajak merged commit 007524d into develop Nov 4, 2026
9 checks passed
@KrzysztofPajak
KrzysztofPajak deleted the fix/order-bulk-scope branch November 4, 2026 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants