From 03c33eee352bb9bfda7bad5ef25296fe59509ca6 Mon Sep 17 00:00:00 2001 From: Claire Bontempo Date: Wed, 30 Mar 2022 13:02:31 -0700 Subject: [PATCH 1/6] only show value in edit form if has read capabilities --- ui/app/templates/components/secret-create-or-update.hbs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/app/templates/components/secret-create-or-update.hbs b/ui/app/templates/components/secret-create-or-update.hbs index cb72e8ada35f..93cb9324972a 100644 --- a/ui/app/templates/components/secret-create-or-update.hbs +++ b/ui/app/templates/components/secret-create-or-update.hbs @@ -192,7 +192,7 @@
From 90ac146be4c459a6bbb4c15bedf0ded495496226 Mon Sep 17 00:00:00 2001 From: Claire Bontempo Date: Wed, 30 Mar 2022 13:28:25 -0700 Subject: [PATCH 2/6] revert messing with form --- ui/app/templates/components/secret-create-or-update.hbs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/app/templates/components/secret-create-or-update.hbs b/ui/app/templates/components/secret-create-or-update.hbs index 93cb9324972a..cb72e8ada35f 100644 --- a/ui/app/templates/components/secret-create-or-update.hbs +++ b/ui/app/templates/components/secret-create-or-update.hbs @@ -192,7 +192,7 @@
From 6a058e918ca951fbc4ab3de8e84d5cb4aa4af459 Mon Sep 17 00:00:00 2001 From: Claire Bontempo Date: Thu, 31 Mar 2022 15:20:42 -0500 Subject: [PATCH 3/6] delete secret data from secret --- ui/app/components/secret-create-or-update.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ui/app/components/secret-create-or-update.js b/ui/app/components/secret-create-or-update.js index 05f97327ecaa..ab76efa3190d 100644 --- a/ui/app/components/secret-create-or-update.js +++ b/ui/app/components/secret-create-or-update.js @@ -129,6 +129,9 @@ export default class SecretCreateOrUpdate extends Component { return secretData .save() .then(() => { + if (!this.args.canReadSecretData) { + delete secret.selectedVersion.secretData; + } if (!secretData.isError) { if (isV2) { secret.set('id', key); @@ -201,6 +204,7 @@ export default class SecretCreateOrUpdate extends Component { @action addRow() { const data = this.args.secretData; + // fired off on init if (isNone(data.findBy('name', ''))) { data.pushObject({ name: '', value: '' }); From 8db4d03d22ae2f99bb2d191e8ac9f34353ec6644 Mon Sep 17 00:00:00 2001 From: Claire Bontempo Date: Fri, 1 Apr 2022 13:25:04 -0500 Subject: [PATCH 4/6] add check for selected version --- ui/app/components/secret-create-or-update.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/app/components/secret-create-or-update.js b/ui/app/components/secret-create-or-update.js index ab76efa3190d..b3cfc7d60fb0 100644 --- a/ui/app/components/secret-create-or-update.js +++ b/ui/app/components/secret-create-or-update.js @@ -129,7 +129,7 @@ export default class SecretCreateOrUpdate extends Component { return secretData .save() .then(() => { - if (!this.args.canReadSecretData) { + if (!this.args.canReadSecretData && secret.selectedVersion) { delete secret.selectedVersion.secretData; } if (!secretData.isError) { From a7bdf89564817a2aa94931a4b466ec13dea75598 Mon Sep 17 00:00:00 2001 From: Claire Bontempo Date: Fri, 1 Apr 2022 13:31:40 -0500 Subject: [PATCH 5/6] remove added line --- ui/app/components/secret-create-or-update.js | 1 - 1 file changed, 1 deletion(-) diff --git a/ui/app/components/secret-create-or-update.js b/ui/app/components/secret-create-or-update.js index b3cfc7d60fb0..ea7ba030942f 100644 --- a/ui/app/components/secret-create-or-update.js +++ b/ui/app/components/secret-create-or-update.js @@ -204,7 +204,6 @@ export default class SecretCreateOrUpdate extends Component { @action addRow() { const data = this.args.secretData; - // fired off on init if (isNone(data.findBy('name', ''))) { data.pushObject({ name: '', value: '' }); From 1f499224fe481d183cbdf7acd2cccb0b94515da0 Mon Sep 17 00:00:00 2001 From: Claire Bontempo Date: Fri, 1 Apr 2022 14:22:06 -0500 Subject: [PATCH 6/6] add changelog --- changelog/14794.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelog/14794.txt diff --git a/changelog/14794.txt b/changelog/14794.txt new file mode 100644 index 000000000000..fb454922201b --- /dev/null +++ b/changelog/14794.txt @@ -0,0 +1,3 @@ +```release-note:bug +ui: Fix KV secret showing in the edit form after a user creates a new version but doesn't have read capabilities +``` \ No newline at end of file