Skip to content

Check the stored customer group before an API update - #1108

Merged
KrzysztofPajak merged 2 commits into
developfrom
fix/customer-group-api-put
Nov 23, 2026
Merged

KrzysztofPajak merged 2 commits into
developfrom
fix/customer-group-api-put

Conversation

@KrzysztofPajak

Copy link
Copy Markdown
Member

Type: bugfix

Issue

  • API PUT /CustomerGroup decided whether a group is a system group from the IsSystem value in the request body. A client that sent IsSystem: false could edit a system group, and one that sent IsSystem: true for an ordinary group got 400. PATCH and DELETE already check the stored group.
  • The product review lists in Admin and Store linked to Edit/{id}?ProductId={productId}. The edit form no longer forwards that value (Keep the product, customer and rating of a review out of the edit form #1086), so the query string did nothing.

Solution

  • Put loads the stored group: 404 when it does not exist, 400 when it is a system group. An empty Id returns 400, the same as Patch with an empty key.
  • The review edit links point to Edit/{id} only.
  • New CustomerGroupControllerTests cover Put (system, ordinary, unknown, without id) and Patch on a system group.

Breaking changes

API PUT /CustomerGroup on a system group now returns 400 whatever IsSystem says in the body, and returns 404 for an unknown id.

Testing

  1. API: PUT a system group (e.g. Administrators) with IsSystem: false and a changed name. Expect 400 and no change.
  2. API: PUT an ordinary group. Expect 200 and the change saved.
  3. Admin → Catalog → Product reviews: open a review from the list. Expect the edit page to open.
  4. dotnet test src/Tests/Grand.Module.Api.Tests passes.

Copilot AI balanced review requested due to automatic review settings November 23, 2026 06:14

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.

@KrzysztofPajak
KrzysztofPajak merged commit c9918e1 into develop Nov 23, 2026
9 checks passed
@KrzysztofPajak
KrzysztofPajak deleted the fix/customer-group-api-put branch November 23, 2026 17:10
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