2023-03-01 09:39:41 -06:00
|
|
|
/**
|
2026-01-28 17:09:06 -08:00
|
|
|
* Copyright IBM Corp. 2021, 2026
|
2024-05-31 11:29:24 -07:00
|
|
|
* SPDX-License-Identifier: BUSL-1.1
|
2023-03-01 09:39:41 -06:00
|
|
|
*/
|
|
|
|
|
|
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-27 16:55:19 -04:00
|
|
|
|
2021-09-28 14:09:11 -04:00
|
|
|
/**
|
|
|
|
|
* @type {boolean}
|
|
|
|
|
*/
|
|
|
|
|
get canAddHostSources() {
|
|
|
|
|
return this.hasAuthorizedAction('add-host-sources');
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-27 16:55:19 -04:00
|
|
|
/**
|
|
|
|
|
* @type {boolean}
|
|
|
|
|
*/
|
|
|
|
|
get canRemoveHostSources() {
|
|
|
|
|
return this.hasAuthorizedAction('remove-host-sources');
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-28 14:09:11 -04:00
|
|
|
/**
|
|
|
|
|
* @type {boolean}
|
|
|
|
|
*/
|
2022-08-18 09:11:38 -07:00
|
|
|
get canAddBrokeredCredentialSources() {
|
2021-09-28 14:09:11 -04:00
|
|
|
return this.hasAuthorizedAction('add-credential-sources');
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-27 16:55:19 -04:00
|
|
|
/**
|
|
|
|
|
* @type {boolean}
|
|
|
|
|
*/
|
2022-08-30 12:01:59 -07:00
|
|
|
get canAddInjectedApplicationCredentialSources() {
|
|
|
|
|
return (
|
2025-06-20 09:52:22 -05:00
|
|
|
(this.model.isSSH || this.model.isRDP) &&
|
|
|
|
|
this.hasAuthorizedAction('add-credential-sources')
|
2022-08-30 12:01:59 -07:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* @type {boolean}
|
|
|
|
|
*/
|
|
|
|
|
get canRemoveCredentialSources() {
|
2021-09-27 16:55:19 -04:00
|
|
|
return this.hasAuthorizedAction('remove-credential-sources');
|
|
|
|
|
}
|
2021-09-16 14:49:48 -04:00
|
|
|
}
|