@@ -288,9 +288,9 @@
{{#if this.toggleInputEnabled}}
- {{@attr.options.helperTextEnabled}}
+ {{if @attr.options.isOppositeValue @attr.options.helperTextDisabled @attr.options.helperTextEnabled}}
{{else}}
- {{@attr.options.helperTextDisabled}}
+ {{if @attr.options.isOppositeValue @attr.options.helperTextEnabled @attr.options.helperTextDisabled}}
{{/if}}
diff --git a/ui/tests/acceptance/secrets/backend/database/workflow-test.js b/ui/tests/acceptance/secrets/backend/database/workflow-test.js
index fd70c62981..d8a604ca1e 100644
--- a/ui/tests/acceptance/secrets/backend/database/workflow-test.js
+++ b/ui/tests/acceptance/secrets/backend/database/workflow-test.js
@@ -88,7 +88,7 @@ module('Acceptance | database workflow', function (hooks) {
label: 'Root rotation statements',
value: `Default`,
},
- { label: 'Skip initial rotation on static roles', value: 'No' },
+ { label: 'Rotate static roles immediately', value: 'Yes' },
];
});
test('create with rotate', async function (assert) {
@@ -121,7 +121,7 @@ module('Acceptance | database workflow', function (hooks) {
assert.dom(PAGE.infoRow).exists({ count: this.expectedRows.length }, 'correct number of rows');
this.expectedRows.forEach(({ label, value }) => {
const valueSelector =
- label === 'Skip initial rotation on static roles'
+ label === 'Rotate static roles immediately'
? PAGE.infoRowValueDiv(label)
: PAGE.infoRowValue(label);
assert.dom(PAGE.infoRowLabel(label)).hasText(label, `Label for ${label} is correct`);
@@ -158,7 +158,7 @@ module('Acceptance | database workflow', function (hooks) {
assert.dom(PAGE.infoRow).exists({ count: this.expectedRows.length }, 'correct number of rows');
this.expectedRows.forEach(({ label, value }) => {
const valueSelector =
- label === 'Skip initial rotation on static roles'
+ label === 'Rotate static roles immediately'
? PAGE.infoRowValueDiv(label)
: PAGE.infoRowValue(label);
assert.dom(PAGE.infoRowLabel(label)).hasText(label, `Label for ${label} is correct`);
@@ -202,7 +202,7 @@ module('Acceptance | database workflow', function (hooks) {
assert.dom(PAGE.infoRow).exists({ count: this.expectedRows.length }, 'correct number of rows');
this.expectedRows.forEach(({ label, value }) => {
const valueSelector =
- label === 'Skip initial rotation on static roles'
+ label === 'Rotate static roles immediately'
? PAGE.infoRowValueDiv(label)
: PAGE.infoRowValue(label);
assert.dom(PAGE.infoRowLabel(label)).hasText(label, `Label for ${label} is correct`);
@@ -238,7 +238,7 @@ module('Acceptance | database workflow', function (hooks) {
);
});
});
- module('roles', function (hooks) {
+ module('dynamic roles', function (hooks) {
hooks.beforeEach(async function () {
this.connection = `connect-${this.backend}`;
await visit(`/vault/secrets/${this.backend}/create`);
@@ -356,4 +356,59 @@ module('Acceptance | database workflow', function (hooks) {
.hasText(`database/creds/${roleName}/abcd`, 'shows lease ID from response');
});
});
+
+ module('static roles', function (hooks) {
+ hooks.beforeEach(async function () {
+ this.setup = async ({ toggleRotateOff = false }) => {
+ this.connection = `connect-${this.backend}`;
+ await visit(`/vault/secrets/${this.backend}/create`);
+ await fillOutConnection(this.connection);
+ if (toggleRotateOff) {
+ await click('[data-test-toggle-input="toggle-skip_static_role_rotation_import"]');
+ }
+ await click(FORM.saveBtn);
+ await visit(`/vault/secrets/${this.backend}/show/${this.connection}`);
+ };
+ });
+
+ test('set parent db to rotate static roles immediately, verify static role reflects that default', async function (assert) {
+ await this.setup({ toggleRotateOff: false });
+
+ const roleName = 'static-role';
+ await click(PAGE.addRole);
+ assert.strictEqual(
+ currentURL(),
+ `/vault/secrets/${this.backend}/create?initialKey=${this.connection}&itemType=role`,
+ 'Takes you to create role page'
+ );
+
+ await fillIn(FORM.inputByAttr('name'), roleName);
+
+ await fillIn(FORM.inputByAttr('type'), 'static');
+
+ assert
+ .dom('[data-test-toggle-subtext]')
+ .containsText(`Vault will rotate the password for this static role on creation.`);
+ });
+
+ test('set parent db to not rotate static roles immediately, verify static role reflects that default', async function (assert) {
+ await this.setup({ toggleRotateOff: true });
+
+ const roleName = 'static-role';
+ await click(PAGE.addRole);
+ assert.strictEqual(
+ currentURL(),
+ `/vault/secrets/${this.backend}/create?initialKey=${this.connection}&itemType=role`,
+ 'Takes you to create role page'
+ );
+
+ await fillIn(FORM.inputByAttr('name'), roleName);
+
+ await fillIn(FORM.inputByAttr('type'), 'static');
+
+ assert
+ .dom('[data-test-toggle-subtext]')
+ .containsText(`Vault will not rotate this role's password on creation.`);
+ });
+ });
});
diff --git a/ui/tests/integration/components/database-role-edit-test.js b/ui/tests/integration/components/database-role-edit-test.js
index 62f46ef84a..05e14f6091 100644
--- a/ui/tests/integration/components/database-role-edit-test.js
+++ b/ui/tests/integration/components/database-role-edit-test.js
@@ -16,6 +16,7 @@ module('Integration | Component | database-role-edit', function (hooks) {
setupMirage(hooks);
hooks.beforeEach(function () {
+ this.version = this.owner.lookup('service:version');
this.store = this.owner.lookup('service:store');
this.store.pushPayload('database-role', {
modelName: 'database/role',
@@ -76,7 +77,8 @@ module('Integration | Component | database-role-edit', function (hooks) {
await click('[data-test-secret-save]');
});
- test('it should successfully create user with skip import rotation', async function (assert) {
+ test('enterprise: it should successfully create user that does not rotate immediately', async function (assert) {
+ this.version.type = 'enterprise';
this.server.post('/sys/capabilities-self', capabilitiesStub('database/static-creds/my-role', ['create']));
this.server.post(`/database/static-roles/my-static-role`, (schema, req) => {
assert.true(true, 'request made to create static role');
@@ -99,7 +101,18 @@ module('Integration | Component | database-role-edit', function (hooks) {
await click('[data-test-secret-save]');
await render(hbs``);
- assert.dom('[data-test-value-div="Skip initial rotation"]').containsText('Yes');
+ assert.dom('[data-test-value-div="Rotate immediately"]').containsText('No');
+ });
+
+ test('enterprise: it should successfully create user that does rotate immediately', async function (assert) {
+ this.version.type = 'enterprise';
+ this.server.post('/sys/capabilities-self', capabilitiesStub('database/static-creds/my-role', ['create']));
+
+ await render(hbs``);
+ await click('[data-test-secret-save]');
+
+ await render(hbs``);
+ assert.dom('[data-test-value-div="Rotate immediately"]').containsText('Yes');
});
test('it should show Get credentials button when a user has the correct policy', async function (assert) {