From d18192e87f649513d7cf86eea6367f4c49759cc9 Mon Sep 17 00:00:00 2001 From: Kianna Quach Date: Mon, 2 Oct 2023 16:10:28 -0700 Subject: [PATCH 1/3] Hide replication if usr doesnt have permissions --- ui/app/templates/components/dashboard/overview.hbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/app/templates/components/dashboard/overview.hbs b/ui/app/templates/components/dashboard/overview.hbs index 2bf091433134..43ea3415e7f3 100644 --- a/ui/app/templates/components/dashboard/overview.hbs +++ b/ui/app/templates/components/dashboard/overview.hbs @@ -7,7 +7,7 @@ {{#if @license}} {{/if}} - {{#if @isRootNamespace}} + {{#if (and @isRootNamespace (has-permission "status" routeParams="replication"))}} Date: Tue, 3 Oct 2023 08:13:48 -0700 Subject: [PATCH 2/3] Add tests --- ui/tests/acceptance/dashboard-test.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ui/tests/acceptance/dashboard-test.js b/ui/tests/acceptance/dashboard-test.js index 189e9232a1f4..31e818caf91a 100644 --- a/ui/tests/acceptance/dashboard-test.js +++ b/ui/tests/acceptance/dashboard-test.js @@ -33,6 +33,8 @@ import { SELECTORS } from 'vault/tests/helpers/components/dashboard/dashboard-se const consoleComponent = create(consoleClass); +const createNS = async (name) => consoleComponent.runCommands(`write sys/namespaces/${name} -force`); + module('Acceptance | landing page dashboard', function (hooks) { setupApplicationTest(hooks); setupMirage(hooks); @@ -390,6 +392,16 @@ module('Acceptance | landing page dashboard', function (hooks) { assert.dom(SELECTORS.emptyStateActions('replication')).hasText('Enable replication'); }); + test('hides the replication card on a non-root namespace enterprise version', async function (assert) { + await visit('/vault/dashboard'); + const version = this.owner.lookup('service:version'); + assert.true(version.isEnterprise, 'vault is enterprise'); + assert.dom(SELECTORS.cardName('replication')).exists(); + createNS('blah'); + await visit('/vault/dashboard?namespace=blah'); + assert.dom(SELECTORS.cardName('replication')).doesNotExist(); + }); + test('it should show replication status if both dr and performance replication are enabled as features in enterprise', async function (assert) { const version = this.owner.lookup('service:version'); assert.true(version.isEnterprise, 'vault is enterprise'); From 02c0442d20f0ca4aac013332cca0d245c93a9c02 Mon Sep 17 00:00:00 2001 From: Kianna Quach Date: Tue, 3 Oct 2023 08:22:16 -0700 Subject: [PATCH 3/3] Add namespace configuration details tests --- ui/tests/acceptance/dashboard-test.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ui/tests/acceptance/dashboard-test.js b/ui/tests/acceptance/dashboard-test.js index 31e818caf91a..e3ee02471791 100644 --- a/ui/tests/acceptance/dashboard-test.js +++ b/ui/tests/acceptance/dashboard-test.js @@ -172,6 +172,16 @@ module('Acceptance | landing page dashboard', function (hooks) { await authPage.login(); }); + test('hides the configuration details card on a non-root namespace enterprise version', async function (assert) { + await visit('/vault/dashboard'); + const version = this.owner.lookup('service:version'); + assert.true(version.isEnterprise, 'vault is enterprise'); + assert.dom(SELECTORS.cardName('configuration-details')).exists(); + createNS('world'); + await visit('/vault/dashboard?namespace=world'); + assert.dom(SELECTORS.cardName('configuration-details')).doesNotExist(); + }); + test('shows the configuration details card', async function (assert) { this.server.get('sys/config/state/sanitized', () => ({ data: this.data,