Files
threshold-ui/addons/api/addon/abilities/target.js
T

56 lines
1.1 KiB
JavaScript
Raw Normal View History

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
2021-09-16 14:49:48 -04:00
import ModelAbility from './model';
/**
2021-09-29 17:47:48 -04:00
* Provides abilities for targets.
2021-09-16 14:49:48 -04:00
*/
export default class TargetAbility extends ModelAbility {
// =permissions
/**
* @type {boolean}
*/
get canConnect() {
return this.hasAuthorizedAction('authorize-session');
}
2021-09-28 14:09:11 -04:00
/**
* @type {boolean}
*/
get canAddHostSources() {
return this.hasAuthorizedAction('add-host-sources');
}
/**
* @type {boolean}
*/
get canRemoveHostSources() {
return this.hasAuthorizedAction('remove-host-sources');
}
2021-09-28 14:09:11 -04:00
/**
* @type {boolean}
*/
get canAddBrokeredCredentialSources() {
2021-09-28 14:09:11 -04:00
return this.hasAuthorizedAction('add-credential-sources');
}
/**
* @type {boolean}
*/
get canAddInjectedApplicationCredentialSources() {
return (
this.model.isSSH && this.hasAuthorizedAction('add-credential-sources')
);
}
/**
* @type {boolean}
*/
get canRemoveCredentialSources() {
return this.hasAuthorizedAction('remove-credential-sources');
}
2021-09-16 14:49:48 -04:00
}