diff --git a/addons/api/addon/abilities/host-catalog.js b/addons/api/addon/abilities/host-catalog.js new file mode 100644 index 000000000..6a6da85d0 --- /dev/null +++ b/addons/api/addon/abilities/host-catalog.js @@ -0,0 +1,16 @@ +import ModelAbility from './model'; + +/** + * Provides abilities for host catalogs. + */ +export default class HostCatalogAbility extends ModelAbility { + // =permissions + + /** + * Only "known" host catalog types may be read. + * @type {boolean} + */ + get canRead() { + return !this.model.isUnknown && this.hasAuthorizedAction('read'); + } +} diff --git a/addons/api/app/abilities/host-catalog.js b/addons/api/app/abilities/host-catalog.js new file mode 100644 index 000000000..a79d57652 --- /dev/null +++ b/addons/api/app/abilities/host-catalog.js @@ -0,0 +1 @@ +export { default } from 'api/abilities/host-catalog'; diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index d1de853d6..4ac6c4023 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -86,6 +86,8 @@ host-catalog: types: static: Static unknown: Unknown + aws: AWS + azure: Azure host-set: title: Host Set title_plural: Host Sets @@ -113,6 +115,8 @@ host-set: types: static: Static unknown: Unknown + aws: AWS + azure: Azure host: title: Host title_plural: Hosts @@ -133,6 +137,8 @@ host: types: static: Static unknown: Unknown + aws: AWS + azure: Azure session: title: Session title_plural: Sessions diff --git a/ui/admin/app/templates/scopes/scope/host-catalogs/index.hbs b/ui/admin/app/templates/scopes/scope/host-catalogs/index.hbs index b2280bc1a..3b21dcb30 100644 --- a/ui/admin/app/templates/scopes/scope/host-catalogs/index.hbs +++ b/ui/admin/app/templates/scopes/scope/host-catalogs/index.hbs @@ -43,7 +43,7 @@ {{#each @model as |hostCatalog|}} - {{#if (can 'read model' hostCatalog)}} + {{#if (can 'read host-catalog' hostCatalog)}} - {{hostCatalog.compositeType}} + {{t + (concat + 'resources.host-catalog.types.' + hostCatalog.compositeType + ) + }} {{/if}}