Files
threshold-ui/ui/admin/app/components/targets/target/actions/index.hbs
T
Cameron Perera 4cd56f8ae5 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
2025-07-15 14:03:27 -05:00

69 lines
2.1 KiB
Handlebars

{{!
Copyright (c) HashiCorp, Inc.
SPDX-License-Identifier: BUSL-1.1
}}
{{#let
(hash
canAddHostSources=(can 'addHostSources target' @model)
canAddBrokeredCredSources=(can 'addBrokeredCredentialSources target' @model)
canAddInjectedApplicationCredSources=(can
'addInjectedApplicationCredentialSources target' @model
)
canDelete=(can 'delete model' @model)
)
as |perms|
}}
{{#if
(or
perms.canAddHostSources
perms.canAddBrokeredCredSources
perms.canAddInjectedApplicationCredSources
perms.canDelete
)
}}
<Hds::Dropdown data-test-manage-targets-dropdown as |dd|>
<dd.ToggleButton @text={{t 'actions.manage'}} @color='secondary' />
{{#if perms.canAddHostSources}}
<dd.Interactive
@route='scopes.scope.targets.target.add-host-sources'
data-test-add-host-sources-action
>
{{t 'resources.target.actions.add-host-sources'}}
</dd.Interactive>
{{/if}}
{{#if perms.canAddBrokeredCredSources}}
<dd.Interactive
@route='scopes.scope.targets.target.add-brokered-credential-sources'
data-test-add-brokered-cred-sources-action
>
{{t 'resources.target.actions.add-brokered-credential-sources'}}
</dd.Interactive>
{{/if}}
{{#if perms.canAddInjectedApplicationCredSources}}
<dd.Interactive
@route='scopes.scope.targets.target.add-injected-application-credential-sources'
data-test-add-injected-cred-sources-action
>
{{t
'resources.target.actions.add-injected-application-credential-sources'
}}
</dd.Interactive>
{{/if}}
{{#if perms.canDelete}}
{{#if
(or
perms.canAddHostSources
perms.canAddBrokeredCredSources
perms.canAddInjectedApplicationCredSources
)
}}
<dd.Separator />
{{/if}}
<dd.Interactive @color='critical' {{on 'click' (fn @delete @model)}}>
{{t 'resources.target.actions.delete'}}
</dd.Interactive>
{{/if}}
</Hds::Dropdown>
{{/if}}
{{/let}}