Icu 17393 manage resource button permissions bug (#2927)
* fix: 🐛 hide manage button if no action items ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-17393 * fix: 🐛 update manage actions for credential-stores ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-17393 * fix: 🐛 update manage actions for groups ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-17393 * fix: 🐛 update manage actions for host-sets ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-17393 * fix: 🐛 update manage actions for roles ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-17393 * fix: 🐛 update manage action for targets ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-17393 * fix: 🐛 update manage actions for workers ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-17393 * fix: 🐛 update manage actions for users ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-17393 * fix: 🐛 update manage actions for auth-methods ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-17393
This commit is contained in:
1 parent
c0d41c0a62
commit
4cd56f8ae5
16 files changed
+403
-222
No files matched your search
@@ -26,39 +26,54 @@
|
||||
{{/each}}
|
||||
</Hds::Dropdown>
|
||||
{{/if}}
|
||||
<Hds::Dropdown data-test-manage-auth-method as |dd|>
|
||||
<dd.ToggleButton @text={{t 'actions.manage'}} @color='secondary' />
|
||||
{{#if @model.isPrimary}}
|
||||
<dd.Interactive {{on 'click' (fn @removeAsPrimary @model)}}>
|
||||
{{t 'resources.auth-method.actions.remove-as-primary'}}
|
||||
</dd.Interactive>
|
||||
{{else}}
|
||||
<dd.Interactive {{on 'click' (fn @makePrimary @model)}}>
|
||||
{{t 'resources.auth-method.actions.make-primary'}}
|
||||
</dd.Interactive>
|
||||
{{#let
|
||||
(hash
|
||||
canCreateAccount=(can 'create model' @model collection='accounts')
|
||||
canCreateManagedGroup=(can
|
||||
'create model' @model collection='managed-groups'
|
||||
)
|
||||
canDelete=(can 'delete auth-method' @model)
|
||||
)
|
||||
as |perms|
|
||||
}}
|
||||
{{#if
|
||||
(or perms.canCreateAccount perms.canCreateManagedGroup perms.canDelete)
|
||||
}}
|
||||
<Hds::Dropdown data-test-manage-auth-method as |dd|>
|
||||
<dd.ToggleButton @text={{t 'actions.manage'}} @color='secondary' />
|
||||
{{#if @model.isPrimary}}
|
||||
<dd.Interactive {{on 'click' (fn @removeAsPrimary @model)}}>
|
||||
{{t 'resources.auth-method.actions.remove-as-primary'}}
|
||||
</dd.Interactive>
|
||||
{{else}}
|
||||
<dd.Interactive {{on 'click' (fn @makePrimary @model)}}>
|
||||
{{t 'resources.auth-method.actions.make-primary'}}
|
||||
</dd.Interactive>
|
||||
{{/if}}
|
||||
{{#if perms.canCreateAccount}}
|
||||
<dd.Interactive
|
||||
@route='scopes.scope.auth-methods.auth-method.accounts.new'
|
||||
@model={{@model}}
|
||||
>
|
||||
{{t 'resources.account.actions.create'}}
|
||||
</dd.Interactive>
|
||||
{{/if}}
|
||||
{{#if perms.canCreateManagedGroup}}
|
||||
{{#if (or @model.isOIDC @model.isLDAP)}}
|
||||
<dd.Interactive
|
||||
@route='scopes.scope.auth-methods.auth-method.managed-groups.new'
|
||||
@model={{@model}}
|
||||
>
|
||||
{{t 'resources.managed-group.actions.create'}}
|
||||
</dd.Interactive>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{#if perms.canDelete}}
|
||||
<dd.Separator />
|
||||
<dd.Interactive @color='critical' {{on 'click' (fn @delete @model)}}>
|
||||
{{t 'resources.auth-method.actions.delete'}}
|
||||
</dd.Interactive>
|
||||
{{/if}}
|
||||
</Hds::Dropdown>
|
||||
{{/if}}
|
||||
{{#if (can 'create model' @model collection='accounts')}}
|
||||
<dd.Interactive
|
||||
@route='scopes.scope.auth-methods.auth-method.accounts.new'
|
||||
@model={{@model}}
|
||||
>
|
||||
{{t 'resources.account.actions.create'}}
|
||||
</dd.Interactive>
|
||||
{{/if}}
|
||||
{{#if (can 'create model' @model collection='managed-groups')}}
|
||||
{{#if (or @model.isOIDC @model.isLDAP)}}
|
||||
<dd.Interactive
|
||||
@route='scopes.scope.auth-methods.auth-method.managed-groups.new'
|
||||
@model={{@model}}
|
||||
>
|
||||
{{t 'resources.managed-group.actions.create'}}
|
||||
</dd.Interactive>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{#if (can 'delete auth-method' @model)}}
|
||||
<dd.Separator />
|
||||
<dd.Interactive @color='critical' {{on 'click' (fn @delete @model)}}>
|
||||
{{t 'resources.auth-method.actions.delete'}}
|
||||
</dd.Interactive>
|
||||
{{/if}}
|
||||
</Hds::Dropdown>
|
||||
{{/let}}
|
||||
Reference in new issue
Block a user