ui: Hide create buttons for policies/roles/namespaces with readonly access (#10914)

This PR adds a check to policy, role and namespace list pages to make sure the user has can write those things before offering to create them via a button. (The create page/form would then be a read-only form)
This commit is contained in:
John Cowen 2021-09-27 17:20:44 +01:00 committed by GitHub
parent d157c63fe4
commit ce731453ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 0 deletions

3
.changelog/10914.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
ui: hide create button for policies/roles/namespace if users token has no write permissions to those areas
```

View File

@ -69,7 +69,9 @@ as |route|>
</h1>
</BlockSlot>
<BlockSlot @name="actions">
{{#if (can "create policies")}}
<a data-test-create href="{{href-to 'dc.acls.policies.create'}}" class="type-create">Create</a>
{{/if}}
</BlockSlot>
<BlockSlot @name="toolbar">
{{#if (gt items.length 0) }}

View File

@ -63,7 +63,9 @@ as |route|>
</h1>
</BlockSlot>
<BlockSlot @name="actions">
{{#if (can "create roles")}}
<a data-test-create href="{{href-to 'dc.acls.roles.create'}}" class="type-create">Create</a>
{{/if}}
</BlockSlot>
<BlockSlot @name="toolbar">
{{#if (gt items.length 0) }}

View File

@ -55,7 +55,9 @@ as |route|>
</h1>
</BlockSlot>
<BlockSlot @name="actions">
{{#if (can "create nspaces")}}
<a data-test-create href="{{href-to 'dc.nspaces.create'}}" class="type-create">Create</a>
{{/if}}
</BlockSlot>
<BlockSlot @name="toolbar">
{{#if (gt items.length 0)}}