2023-03-14 13:18:55 +00:00
{{ !
Copyright (c) HashiCorp, Inc.
2023-08-11 13:12:13 +00:00
SPDX-License-Identifier: BUSL-1.1
2023-03-14 13:18:55 +00:00
}}
2021-04-06 12:40:40 +00:00
<Route
@name= {{ routeName }}
as |route|>
2021-09-15 18:50:11 +00:00
<DataLoader @src= {{
uri '/$ { partition}/$ { nspace}/$ { dc}/policy/$ { id}'
(hash
partition=route.params.partition
nspace=route.params.nspace
dc=route.params.dc
id=(or route.params.id '')
)
}}
as |loader|>
<BlockSlot @name="error">
{{ # if ( eq loader .error .status '401' ) }}
<Consul::Acl::Disabled />
{{ else }}
<AppError
@error= {{ loader .error }}
@login= {{ route .model .app .login .open }}
/>
{{ / if }}
</BlockSlot>
<BlockSlot @name="loaded">
{{ # let
route.params.dc
route.params.partition
route.params.nspace
2021-10-26 18:00:32 +00:00
(or route.params.id '')
2021-09-15 18:50:11 +00:00
loader.data
loader.data.isNew
2021-10-26 18:00:32 +00:00
as |dc partition nspace id item create|}}
2021-04-06 12:40:40 +00:00
<AppView
@login= {{ route .model .app .login .open }}
>
<BlockSlot @name="breadcrumbs">
<ol>
<li><a data-test-back href= {{ href-to 'dc.acls.policies' }} >All Policies</a></li>
</ol>
</BlockSlot>
<BlockSlot @name="header">
<h1>
{{ # if create }}
2021-09-15 18:50:11 +00:00
<route.Title @title="New Policy" />
2021-04-06 12:40:40 +00:00
{{ else }}
{{ # if ( can "write policy" item = item ) }}
2021-09-15 18:50:11 +00:00
<route.Title @title="Edit Policy" />
2021-04-06 12:40:40 +00:00
{{ else }}
2021-09-15 18:50:11 +00:00
<route.Title @title="View Policy" />
2021-04-06 12:40:40 +00:00
{{ / if }}
{{ / if }}
</h1>
</BlockSlot>
<BlockSlot @name="content">
{{ # if ( not create ) }}
<div class="definition-table">
<dl>
<dt>Policy ID</dt>
<dd>
2022-07-07 16:42:47 +00:00
<CopyableCode
@value= {{ item .ID }}
@name="Policy ID"
/>
2021-04-06 12:40:40 +00:00
</dd>
</dl>
</div>
2020-01-28 14:25:52 +00:00
{{ / if }}
2023-09-01 18:05:32 +00:00
{{ # if ( or ( eq ( policy / typeof item ) 'policy-management' ) ( eq ( policy / typeof item ) 'read-only' ) ) }}
2023-09-01 20:58:03 +00:00
<Hds::Alert @type="inline" @icon="star-fill" class="mb-3 mt-2" as |A|>
<A.Title>Built-in policy</A.Title>
<A.Description>This policy is built into Consul's ACL system. You can use this special policy by adding it to a token. This policy is not editable or removable, but can be ignored by not applying it to any tokens.
</A.Description>
<A.Link::Standalone @text='Learn more'
@href=" {{ env 'CONSUL_DOCS_URL' }} /guides/acl.html#builtin-policies"
@icon='docs-link'
@iconPosition='trailing' />
</Hds::Alert>
2021-09-15 18:50:11 +00:00
<div class="definition-table">
<dl>
<dt>Name</dt>
<dd> {{ item .Name }} </dd>
<dt>Valid Datacenters</dt>
<dd> {{ join ', ' ( policy / datacenters item ) }} </dd>
<dt>Description</dt>
<dd> {{ item .Description }} </dd>
</dl>
</div>
<DataSource
@src= {{ uri '/${partition}/${nspace}/${dc}/tokens/for-policy/${id}'
(hash
partition=partition
nspace=nspace
dc=dc
2021-10-26 18:00:32 +00:00
id=id
2021-09-15 18:50:11 +00:00
)
}}
as |loader|>
{{ # if ( gt loader .data .length 0 ) }}
<TokenList @caption="Applied to the following tokens:" @items= {{ loader .data }} />
{{ / if }}
</DataSource>
2018-10-19 15:17:02 +00:00
{{ else }}
2021-04-06 12:40:40 +00:00
{{ partial 'dc/acls/policies/form' }}
2018-10-19 15:17:02 +00:00
{{ / if }}
2021-04-06 12:40:40 +00:00
</BlockSlot>
</AppView>
2021-09-15 18:50:11 +00:00
{{ / let }}
</BlockSlot>
</DataLoader>
2021-04-06 12:40:40 +00:00
</Route>