mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-17 20:17:00 +02:00
* Add UI feature allowing database role credential rotation * Only show the 'rotate credentials' option for static roles * rotate role path uses id for permissions * Add rotate credentials button to show page on static role * Mirage handlers for role for simple testing * Add changelog * lint rules * fix lint Co-authored-by: Bartek Marczak <bartek.marczak@gmail.com>
92 lines
3.5 KiB
Handlebars
92 lines
3.5 KiB
Handlebars
<LinkedBlock
|
|
@params={{array "vault.cluster.secrets.backend.show" (if this.keyTypeValue (concat "role/" @item.id) @item.id)}}
|
|
class="list-item-row"
|
|
data-test-secret-link={{@item.id}}
|
|
encode={{true}}
|
|
queryParams={{secret-query-params @backendType @item.type}}
|
|
>
|
|
<div class="columns is-mobile">
|
|
<div class="column is-10">
|
|
<LinkTo
|
|
@route={{concat "vault.cluster.secrets.backend.show"}}
|
|
@model={{if this.keyTypeValue (concat "role/" @item.id) @item.id}}
|
|
@query={{secret-query-params @backendType @item.type}}
|
|
class="has-text-black has-text-weight-semibold"
|
|
>
|
|
<Icon @name="user" class="has-text-grey-light is-pulled-left" />
|
|
<div class="role-item-details">
|
|
<span class="is-underline">{{if (eq @item.id " ") "(self)" (or @item.keyWithoutParent @item.id)}}</span>
|
|
<span class="tag has-text-grey-dark">{{this.keyTypeValue}}</span>
|
|
</div>
|
|
</LinkTo>
|
|
</div>
|
|
<div class="column has-text-right">
|
|
<PopupMenu name="secret-menu">
|
|
<nav class="menu">
|
|
<ul class="menu-list">
|
|
{{#if @item.canEdit}}
|
|
<li class="action">
|
|
<SecretLink @mode="show" @secret={{@item.id}} @class="has-text-black has-text-weight-semibold">
|
|
Edit connection
|
|
</SecretLink>
|
|
</li>
|
|
{{/if}}
|
|
{{#if @item.canEditRole}}
|
|
<li class="action">
|
|
<SecretLink
|
|
@mode="edit"
|
|
@secret={{concat "role/" @item.id}}
|
|
@class="has-text-black has-text-weight-semibold"
|
|
>
|
|
Edit Role
|
|
</SecretLink>
|
|
</li>
|
|
{{/if}}
|
|
{{#if @item.canReset}}
|
|
<li class="action">
|
|
<button type="button" class="link" {{on "click" (fn this.resetConnection @item.id)}}>
|
|
Reset connection
|
|
</button>
|
|
</li>
|
|
{{/if}}
|
|
{{#if (and (eq @item.type "dynamic") @item.canGenerateCredentials)}}
|
|
<li class="action">
|
|
<LinkTo
|
|
@route="vault.cluster.secrets.backend.credentials"
|
|
@model={{@item.id}}
|
|
@query={{hash roleType=this.keyTypeValue}}
|
|
>
|
|
Generate credentials
|
|
</LinkTo>
|
|
</li>
|
|
{{else if (and (eq @item.type "static") @item.canGetCredentials)}}
|
|
<li class="action">
|
|
<LinkTo
|
|
@route="vault.cluster.secrets.backend.credentials"
|
|
@model={{@item.id}}
|
|
@query={{hash roleType=this.keyTypeValue}}
|
|
>
|
|
Get credentials
|
|
</LinkTo>
|
|
</li>
|
|
{{/if}}
|
|
{{#if (and @item.canRotateRoleCredentials (eq this.keyTypeValue "static"))}}
|
|
<li class="action">
|
|
<button type="button" class="link" {{on "click" (fn this.rotateRoleCred @item.id)}}>
|
|
Rotate credentials
|
|
</button>
|
|
</li>
|
|
{{/if}}
|
|
{{#if @item.canRotateRoot}}
|
|
<li class="action">
|
|
<button type="button" class="link" {{on "click" (fn this.rotateRootCred @item.id)}}>
|
|
Rotate root credentials
|
|
</button>
|
|
</li>
|
|
{{/if}}
|
|
</ul>
|
|
</nav>
|
|
</PopupMenu>
|
|
</div>
|
|
</div>
|
|
</LinkedBlock> |