-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom tooltip for Generated Token Policies form field on auth methods #15046
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work tracking this down! Small change request, let me know if that doesn't work for some reason
ui/app/components/generated-item.js
Outdated
// HelpText from the backend says add a comma separated list, which works on the CLI but not here on the UI. | ||
// This effects TLS Certificates, Userpass, and Kubernetes. https://github.com/hashicorp/vault/issues/10346 | ||
if (element.Tokens) { | ||
element.Tokens.forEach((attr) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of iterating over all of them can we do element.Tokens.find(attr => attr.name === 'tokenPolicies')
and then update it if found? That way iteration will stop once the item is found, or have the same behavior as iterating over each if not found
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea. Amending.
@@ -69,6 +70,18 @@ module('Acceptance | auth backend list', function (hooks) { | |||
await triggerKeyEvent('[data-test-input="username"]', 'keyup', 65); | |||
await fillIn('[data-test-textarea]', user2); | |||
await triggerKeyEvent('[data-test-textarea]', 'keyup', 65); | |||
// test for modified helpText on generated token policies | |||
await click('[data-test-toggle-group="Tokens"]'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
#15046) * the conditional fix * add test coverage * changelog * add possesive * fix language * fix * fix * change quotes * fix * replace with find
#15046) * the conditional fix * add test coverage * changelog * add possesive * fix language * fix * fix * change quotes * fix * replace with find
#15046) * the conditional fix * add test coverage * changelog * add possesive * fix language * fix * fix * change quotes * fix * replace with find
This PR intercepts the model on the
generatedItem
component to replace thehelpText
for the auth form field "Generated Token's Policies"Before the help text read: Comma-separated list of policies associated with the user.
However, this field (e.g form field = stringArray) does not accept comma separated lists. We instead want a user to add a row for each new policy. We cannot change the text here because that changes the CLI text which does accept a comma separated list. So instead, we interrupt the component, search for this field type and replace the helpText with the following: Add policies that will apply to the generated token for this user. One policy per row.
This now looks like this:
This change effects TLS Certificates, Userpass, and Kubernetes who have this field. The other auth methods have a different field or no policy field at all.
Will backport to 1.8
See GH issue here.