You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
consul/ui/packages/consul-ui/app/abilities/intention.js

22 lines
567 B

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import BaseAbility from './base';
export default class IntentionAbility extends BaseAbility {
resource = 'intention';
get canWrite() {
// Peered intentions aren't writable
if (typeof this.item !== 'undefined' && typeof this.item.SourcePeer !== 'undefined') {
return false;
}
return super.canWrite && (typeof this.item === 'undefined' || !this.canViewCRD);
}
get canViewCRD() {
return typeof this.item !== 'undefined' && this.item.IsManagedByCRD;
}
}