chore: 🤖 disallow read on unknown catalogs
This commit is contained in:
4 files changed
+30
-2
No files matched your search
@@ -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');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from 'api/abilities/host-catalog';
|
||||
@@ -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
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
{{#each @model as |hostCatalog|}}
|
||||
<body.row as |row|>
|
||||
<row.headerCell>
|
||||
{{#if (can 'read model' hostCatalog)}}
|
||||
{{#if (can 'read host-catalog' hostCatalog)}}
|
||||
<LinkTo
|
||||
@route='scopes.scope.host-catalogs.host-catalog'
|
||||
@model={{hostCatalog.id}}
|
||||
@@ -82,7 +82,12 @@
|
||||
'-color-16'
|
||||
}}
|
||||
>
|
||||
{{hostCatalog.compositeType}}
|
||||
{{t
|
||||
(concat
|
||||
'resources.host-catalog.types.'
|
||||
hostCatalog.compositeType
|
||||
)
|
||||
}}
|
||||
</Rose::Badge>
|
||||
{{/if}}
|
||||
</row.cell>
|
||||
|
||||
Reference in new issue
Block a user