ui: Remove authorization and disabled partials/blocks (#8829)

* Add disabled and unauthorized views into AppView without a block

* Remove disabled/unauthorized block usage

* Remove unauthorized and diabled partials

* Passthrough allowLogin attribute
This commit is contained in:
John Cowen 2020-10-06 14:34:32 +01:00 committed by GitHub
parent bc5ca8b638
commit 61b17cc941
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 33 additions and 78 deletions

View File

@ -82,7 +82,31 @@
</header> </header>
<div> <div>
{{#if (not enabled) }} {{#if (not enabled) }}
<YieldSlot @name="disabled">{{yield}}</YieldSlot> <EmptyState>
<BlockSlot @name="header">
<h2>Welcome to ACLs</h2>
</BlockSlot>
<BlockSlot @name="body">
<p>
ACLs are not enabled in this Consul cluster. We strongly encourage the use of ACLs in production environments for the best security practices.
</p>
</BlockSlot>
<BlockSlot @name="actions">
<li class="docs-link">
<a href="{{env 'CONSUL_DOCS_URL'}}/acl/index.html" rel="noopener noreferrer" target="_blank">Read the documentation</a>
</li>
<li class="learn-link">
<a href="{{env 'CONSUL_DOCS_LEARN_URL'}}/consul/security-networking/production-acls" rel="noopener noreferrer" target="_blank">Follow the guide</a>
</li>
</BlockSlot>
</EmptyState>
{{else if (not authorized)}}
<ErrorState
@error={{hash
status='403'
}}
@allowLogin={{true}}
/>
{{else}} {{else}}
<YieldSlot @name="content">{{yield}}</YieldSlot> <YieldSlot @name="content">{{yield}}</YieldSlot>
{{/if}} {{/if}}

View File

@ -1,5 +1,8 @@
{{#if (not-eq error.status "403")}} {{#if (not-eq error.status "403")}}
<EmptyState class={{concat "status-" error.status}}> <EmptyState
class={{concat "status-" error.status}}
@allowLogin={{@allowLogin}}
>
<BlockSlot @name="header"> <BlockSlot @name="header">
<h2>{{or error.message "Consul returned an error"}}</h2> <h2>{{or error.message "Consul returned an error"}}</h2>
</BlockSlot> </BlockSlot>
@ -23,7 +26,10 @@
</BlockSlot> </BlockSlot>
</EmptyState> </EmptyState>
{{else}} {{else}}
<EmptyState class="status-403"> <EmptyState
class="status-403"
@allowLogin={{@allowLogin}}
>
<BlockSlot @name="header"> <BlockSlot @name="header">
<h2 data-test-status={{error.status}}>You are not authorized</h2> <h2 data-test-status={{error.status}}>You are not authorized</h2>
</BlockSlot> </BlockSlot>

View File

@ -1,21 +0,0 @@
<EmptyState class="status-403" @allowLogin={{true}}>
<BlockSlot @name="header">
<h2>You are not authorized</h2>
</BlockSlot>
<BlockSlot @name="subheader">
<h3>Error 403</h3>
</BlockSlot>
<BlockSlot @name="body">
<p>
You must be granted permissions to view this data. Login or ask your administrator if you think you should have access.
</p>
</BlockSlot>
<BlockSlot @name="actions">
<li class="docs-link">
<a href="{{env 'CONSUL_DOCS_URL'}}/acl/index.html" rel="noopener noreferrer" target="_blank">Read the documentation</a>
</li>
<li class="learn-link">
<a href="{{env 'CONSUL_DOCS_LEARN_URL'}}/consul/security-networking/production-acls" rel="noopener noreferrer" target="_blank">Follow the guide</a>
</li>
</BlockSlot>
</EmptyState>

View File

@ -1,18 +0,0 @@
<EmptyState>
<BlockSlot @name="header">
<h2>Welcome to ACLs</h2>
</BlockSlot>
<BlockSlot @name="body">
<p>
ACLs are not enabled in this Consul cluster. We strongly encourage the use of ACLs in production environments for the best security practices.
</p>
</BlockSlot>
<BlockSlot @name="actions">
<li class="docs-link">
<a href="{{env 'CONSUL_DOCS_URL'}}/acl/index.html" rel="noopener noreferrer" target="_blank">Read the documentation</a>
</li>
<li class="learn-link">
<a href="{{env 'CONSUL_DOCS_LEARN_URL'}}/consul/security-networking/production-acls" rel="noopener noreferrer" target="_blank">Follow the guide</a>
</li>
</BlockSlot>
</EmptyState>

View File

@ -14,12 +14,6 @@
<BlockSlot @name="notification" as |status type item error|> <BlockSlot @name="notification" as |status type item error|>
{{partial 'dc/acls/policies/notifications'}} {{partial 'dc/acls/policies/notifications'}}
</BlockSlot> </BlockSlot>
<BlockSlot @name="disabled">
{{partial 'dc/acls/disabled'}}
</BlockSlot>
<BlockSlot @name="authorization">
{{partial 'dc/acls/authorization'}}
</BlockSlot>
<BlockSlot @name="breadcrumbs"> <BlockSlot @name="breadcrumbs">
<ol> <ol>
<li><a data-test-back href={{href-to 'dc.acls.policies'}}>All Policies</a></li> <li><a data-test-back href={{href-to 'dc.acls.policies'}}>All Policies</a></li>

View File

@ -25,12 +25,6 @@
{{partial 'dc/acls/nav'}} {{partial 'dc/acls/nav'}}
{{/if}} {{/if}}
</BlockSlot> </BlockSlot>
<BlockSlot @name="disabled">
{{partial 'dc/acls/disabled'}}
</BlockSlot>
<BlockSlot @name="authorization">
{{partial 'dc/acls/authorization'}}
</BlockSlot>
<BlockSlot @name="actions"> <BlockSlot @name="actions">
<a data-test-create href="{{href-to 'dc.acls.policies.create'}}" class="type-create">Create</a> <a data-test-create href="{{href-to 'dc.acls.policies.create'}}" class="type-create">Create</a>
</BlockSlot> </BlockSlot>

View File

@ -14,12 +14,6 @@
<BlockSlot @name="notification" as |status type item error|> <BlockSlot @name="notification" as |status type item error|>
{{partial 'dc/acls/roles/notifications'}} {{partial 'dc/acls/roles/notifications'}}
</BlockSlot> </BlockSlot>
<BlockSlot @name="disabled">
{{partial 'dc/acls/disabled'}}
</BlockSlot>
<BlockSlot @name="authorization">
{{partial 'dc/acls/authorization'}}
</BlockSlot>
<BlockSlot @name="breadcrumbs"> <BlockSlot @name="breadcrumbs">
<ol> <ol>
<li><a data-test-back href={{href-to 'dc.acls.roles'}}>All Roles</a></li> <li><a data-test-back href={{href-to 'dc.acls.roles'}}>All Roles</a></li>

View File

@ -22,12 +22,6 @@
{{partial 'dc/acls/nav'}} {{partial 'dc/acls/nav'}}
{{/if}} {{/if}}
</BlockSlot> </BlockSlot>
<BlockSlot @name="disabled">
{{partial 'dc/acls/disabled'}}
</BlockSlot>
<BlockSlot @name="authorization">
{{partial 'dc/acls/authorization'}}
</BlockSlot>
<BlockSlot @name="actions"> <BlockSlot @name="actions">
<a data-test-create href="{{href-to 'dc.acls.roles.create'}}" class="type-create">Create</a> <a data-test-create href="{{href-to 'dc.acls.roles.create'}}" class="type-create">Create</a>
</BlockSlot> </BlockSlot>

View File

@ -14,12 +14,6 @@
<BlockSlot @name="notification" as |status type item error|> <BlockSlot @name="notification" as |status type item error|>
{{partial 'dc/acls/tokens/notifications'}} {{partial 'dc/acls/tokens/notifications'}}
</BlockSlot> </BlockSlot>
<BlockSlot @name="disabled">
{{partial 'dc/acls/disabled'}}
</BlockSlot>
<BlockSlot @name="authorization">
{{partial 'dc/acls/authorization'}}
</BlockSlot>
<BlockSlot @name="breadcrumbs"> <BlockSlot @name="breadcrumbs">
<ol> <ol>
<li><a data-test-back href={{href-to 'dc.acls.tokens'}}>All Tokens</a></li> <li><a data-test-back href={{href-to 'dc.acls.tokens'}}>All Tokens</a></li>

View File

@ -25,12 +25,6 @@
{{partial 'dc/acls/nav'}} {{partial 'dc/acls/nav'}}
{{/if}} {{/if}}
</BlockSlot> </BlockSlot>
<BlockSlot @name="disabled">
{{partial 'dc/acls/disabled'}}
</BlockSlot>
<BlockSlot @name="authorization">
{{partial 'dc/acls/authorization'}}
</BlockSlot>
<BlockSlot @name="actions"> <BlockSlot @name="actions">
<a data-test-create href="{{href-to 'dc.acls.tokens.create'}}" class="type-create">Create</a> <a data-test-create href="{{href-to 'dc.acls.tokens.create'}}" class="type-create">Create</a>
</BlockSlot> </BlockSlot>