diff --git a/ui-v2/app/templates/dc/acls/tokens/-form.hbs b/ui-v2/app/templates/dc/acls/tokens/-form.hbs index b22991cabd..8d73e80991 100644 --- a/ui-v2/app/templates/dc/acls/tokens/-form.hbs +++ b/ui-v2/app/templates/dc/acls/tokens/-form.hbs @@ -13,7 +13,7 @@ {{/if}} -{{# if (and (not create) (not (token/is-anonymous item))) }} +{{# if (and (not create) (not (token/is-anonymous item)) (not-eq item.AccessorID token.AccessorID) ) }} {{#confirmation-dialog message='Are you sure you want to delete this Token?'}} {{#block-slot 'action' as |confirm|}} diff --git a/ui-v2/app/templates/dc/acls/tokens/index.hbs b/ui-v2/app/templates/dc/acls/tokens/index.hbs index 6de3eacc8a..4dad5c7e92 100644 --- a/ui-v2/app/templates/dc/acls/tokens/index.hbs +++ b/ui-v2/app/templates/dc/acls/tokens/index.hbs @@ -90,7 +90,7 @@ Use {{/if}} -{{#unless (token/is-anonymous item) }} +{{#unless (or (token/is-anonymous item) (eq item.AccessorID token.AccessorID)) }}
  • Delete
  • @@ -102,9 +102,6 @@

    {{#if (eq name 'delete')}} {{message}} - {{#if (eq item.AccessorID token.AccessorID)}} - Warning: This is the token you are currently using! - {{/if}} {{else if (eq name 'logout')}} Are you sure you want to stop using this ACL token? This will log you out. {{else if (eq name 'use')}} diff --git a/ui-v2/tests/acceptance/dc/acls/tokens/own-no-delete.feature b/ui-v2/tests/acceptance/dc/acls/tokens/own-no-delete.feature new file mode 100644 index 0000000000..61e1f6131d --- /dev/null +++ b/ui-v2/tests/acceptance/dc/acls/tokens/own-no-delete.feature @@ -0,0 +1,37 @@ +@setupApplicationTest +Feature: dc / acls / tokens / own no delete: The your current token has no delete buttons + Background: + Given 1 datacenter model with the value "dc-1" + And 1 token model from yaml + --- + AccessorID: token + SecretID: ee52203d-989f-4f7a-ab5a-2bef004164ca + --- + Scenario: On the listing page + Then I have settings like yaml + --- + consul:token: ~ + --- + When I visit the tokens page for yaml + --- + dc: dc-1 + --- + Then the url should be /dc-1/acls/tokens + And I click actions on the tokens + And I click use on the tokens + And I click confirmUse on the tokens + Then "[data-notification]" has the "notification-use" class + And "[data-notification]" has the "success" class + Then I have settings like yaml + --- + consul:token: "{\"AccessorID\":\"token\",\"SecretID\":\"ee52203d-989f-4f7a-ab5a-2bef004164ca\"}" + --- + And I click actions on the tokens + Then I don't see delete on the tokens + And I visit the token page for yaml + --- + dc: dc-1 + token: ee52203d-989f-4f7a-ab5a-2bef004164ca + --- + Then the url should be /dc-1/acls/tokens/ee52203d-989f-4f7a-ab5a-2bef004164ca + Then I don't see confirmDelete diff --git a/ui-v2/tests/acceptance/steps/dc/acls/tokens/own-no-delete-steps.js b/ui-v2/tests/acceptance/steps/dc/acls/tokens/own-no-delete-steps.js new file mode 100644 index 0000000000..9bfbe9ac9b --- /dev/null +++ b/ui-v2/tests/acceptance/steps/dc/acls/tokens/own-no-delete-steps.js @@ -0,0 +1,10 @@ +import steps from '../../../steps'; + +// step definitions that are shared between features should be moved to the +// tests/acceptance/steps/steps.js file + +export default function(assert) { + return steps(assert).then('I should find a file', function() { + assert.ok(true, this.step); + }); +}