ui: Fix "cannot toggle global mode" error when updating ACL tokens#27950
Open
sreekanthkk96 wants to merge 1 commit into
Open
ui: Fix "cannot toggle global mode" error when updating ACL tokens#27950sreekanthkk96 wants to merge 1 commit into
sreekanthkk96 wants to merge 1 commit into
Conversation
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.
Description
This PR fixes a bug where editing an existing ACL token in the UI would fail with the error:
token 0 invalid: 1 error occurred: * cannot toggle global mode.Root Cause: The
token-editorcomponent was setting theglobalproperty on every save operation, even for existing tokens. The Nomad API doesn't allow changing theglobalproperty after token creation, which caused the error.Solution: Modified
ui/app/components/token-editor.jsto only set theglobalproperty for new tokens. For existing tokens, theglobalproperty is preserved from the loaded model and not modified, preventing Ember Data from marking it as changed and including it in the update request.Impact: Users can now successfully:
global(which is immutable after creation)Testing & Reproduction steps
To Reproduce the Bug (Before Fix):
nomad acl bootstrapGlobal = false:test-tokenScreen.Recording.2026-05-12.at.5.04.42.PM.mov
After Fix:
Screen.Recording.2026-05-12.at.5.01.45.PM.mov
Automated Tests:
Existing tests in
ui/tests/acceptance/token-test.jsalready cover this functionality:These tests will now pass with the fix applied.
Links
Jira Item : https://hashicorp.atlassian.net/browse/NMD-1278
Contributor Checklist
make clcommand.Reviewer Checklist
Changes to Security Controls
No changes to security controls. This PR only fixes a bug in the UI that prevented users from editing ACL tokens. The ACL token permissions, access controls, and API behavior remain unchanged. The fix ensures that the
globalproperty (which controls token replication across regions) is not inadvertently modified during token updates, maintaining the existing security model.