Files
threshold-ui/ui/admin/app/abilities/credential.js
T

23 lines
650 B
JavaScript
Raw Normal View History

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
2022-12-12 16:37:01 -08:00
import CredentialAbility from 'api/abilities/credential';
import { inject as service } from '@ember/service';
export default class OverrideCredentialAbility extends CredentialAbility {
// =service
@service features;
2022-12-16 15:06:19 -05:00
/**
* This override ensures that JSON credentials may be read only if the
* json-credentials feature flag is enabled. All other types are subject
* to the standard logic found in the api addon.
*/
2022-12-12 16:37:01 -08:00
get canRead() {
2022-12-16 15:06:19 -05:00
return this.features.isEnabled('json-credentials') || !this.model.isJSON
2022-12-12 16:37:01 -08:00
? super.canRead
: false;
}
}