2023-03-15 15:45:51 -04:00
|
|
|
/**
|
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
*/
|
|
|
|
|
|
2023-03-16 13:49:04 -04:00
|
|
|
import SessionRecordingAbility from 'api/abilities/session-recording';
|
2023-03-15 15:45:51 -04:00
|
|
|
import { inject as service } from '@ember/service';
|
|
|
|
|
|
2023-03-16 13:49:04 -04:00
|
|
|
export default class OverrideSessionRecordingAbility extends SessionRecordingAbility {
|
2023-03-15 15:45:51 -04:00
|
|
|
// =service
|
|
|
|
|
@service features;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This override ensures that session recordings may be read only if the
|
|
|
|
|
* session-recording feature flag is enabled.
|
|
|
|
|
*/
|
|
|
|
|
get canRead() {
|
2023-05-22 08:49:30 -07:00
|
|
|
return this.features.isEnabled('ssh-session-recording')
|
|
|
|
|
? super.canRead
|
|
|
|
|
: false;
|
2023-03-15 15:45:51 -04:00
|
|
|
}
|
2024-01-17 11:37:54 -08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Reapplying policy is allowed only if the feature flag is enabled
|
|
|
|
|
* @type {boolean}
|
|
|
|
|
*/
|
|
|
|
|
get canReapplyStoragePolicy() {
|
|
|
|
|
return this.features.isEnabled('ssh-session-recording')
|
|
|
|
|
? this.hasAuthorizedAction('reapply-storage-policy')
|
|
|
|
|
: false;
|
|
|
|
|
}
|
2024-02-13 13:26:23 -08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This override ensures that session recordings may be deleted only if the
|
|
|
|
|
* session-recording feature flag is enabled.
|
|
|
|
|
*/
|
|
|
|
|
get canDelete() {
|
|
|
|
|
return this.features.isEnabled('ssh-session-recording')
|
|
|
|
|
? super.canDelete
|
|
|
|
|
: false;
|
|
|
|
|
}
|
2023-03-15 15:45:51 -04:00
|
|
|
}
|