Repository navigation
Answer 404 from the permission actions popup for an unknown group or permission - #1011
Merged
Merged
Conversation
…permission The popup edits one permission of one customer group, so both must exist. The save checks them before it changes anything.
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.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Type: bugfix
Issue
The permission actions popup edits one permission of one customer group, so both must exist.
PermissionsActionhad 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-foundas a POST and runs a storefront action.ViewBag.ClosePagewrites 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 inPermissionControllerTests. 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./Admin/Permission/Indexand open the actions popup of a permission.