Skip to content

Answer 404 from the permission actions popup for an unknown group or permission - #1011

Merged
KrzysztofPajak merged 2 commits into
developfrom
fix/permission-action-unknown-entity
Nov 2, 2026
Merged

KrzysztofPajak merged 2 commits into
developfrom
fix/permission-action-unknown-entity

Conversation

@KrzysztofPajak

@KrzysztofPajak KrzysztofPajak commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Type: bugfix

Issue

The permission actions popup edits one permission of one customer group, so both must exist. PermissionsAction had no proper answer when one of them does not, and the save changed the denied actions before it looked at the permission.

Solution

  • PermissionsAction (GET) answers 404 when the customer group or the permission does not exist.
  • PermissionsAction (POST) checks both before it changes anything, and answers 404 in the same cases. The 404 has a text body, because an empty one is re-executed at /page-not-found as a POST and runs a storefront action.
  • The popup shows that message when a save is rejected, and stays open.
  • The ViewBag.ClosePage writes go, because no view reads them. The popup closes from its own script after a successful save.

No new resources, settings or migrations.

Breaking changes

None.

Testing

Unit tests pass: Grand.Web.Admin.Tests (1847), with eight new tests in PermissionControllerTests. The tests for an unknown group or permission failed before the change. On a running build with a test database, a save for an unknown group or permission answered 404 with the message, the popup showed it and stayed open, and a normal save closed the popup. Steps 2 and 3 below, which check that the action stays off, were not run.

  1. Open /Admin/Permission/Index and open the actions popup of a permission.
  2. Turn an action off and save. The popup closes.
  3. Open the popup again. The action is still off.

…permission

The popup edits one permission of one customer group, so both must exist.
The save checks them before it changes anything.
Copilot AI balanced review requested due to automatic review settings November 1, 2026 21:03

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.

An empty 404 on the POST is re-executed by the status code pages at
/page-not-found, still as a POST, where it ran the storefront's
BlogController.BlogPost. A 404 with a body is left alone. The popup had no
error callback, so a rejected save showed nothing and stayed open.

Also cover removing an earlier denial and saving with nothing selected.
@KrzysztofPajak
KrzysztofPajak merged commit c640469 into develop Nov 2, 2026
9 checks passed
@KrzysztofPajak
KrzysztofPajak deleted the fix/permission-action-unknown-entity branch November 2, 2026 06:20
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