Files
threshold-ui/ui/admin/app/abilities/host-catalog.js
T
hashicorp-copywrite[bot]andCameron Perera 3d610427d0 [COMPLIANCE] Add Copyright and License Headers (#1617)
* [COMPLIANCE] Add Copyright and License Headers

* chore: 🤖 update Copyright headers to satisfy our lint rules

---------

Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
Co-authored-by: Cameron Perera <cameron.perera@hashicorp.com>
2023-03-01 09:39:41 -06:00

23 lines
786 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import HostCatalogAbility from 'api/abilities/host-catalog';
export default class OverrideHostCatalogAbility extends HostCatalogAbility {
/**
* Navigating to a resource is allowed if either list or create grants
* are present, except in the following case. Navigating to hosts directly
* from a dynamic host catalog is not allowed, since this might present more
* hosts than is practical or useful.
* @type {boolean}
*/
get canNavigate() {
const { isPlugin } = this.model;
const isHostsCollection = this.collection === 'hosts';
const isDynamicHostsNavigation = isPlugin && isHostsCollection;
return !isDynamicHostsNavigation && (this.canList || this.canCreate);
}
}