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
|
|
|
*/
|
|
|
|
|
|
2022-06-18 10:56:25 -04:00
|
|
|
import ModelAbility from './model';
|
2025-03-12 08:29:54 -07:00
|
|
|
import { service } from '@ember/service';
|
2022-06-18 10:56:25 -04:00
|
|
|
/**
|
|
|
|
|
* Provides abilities for credential store.
|
|
|
|
|
*/
|
|
|
|
|
export default class CredentialStoreAbility extends ModelAbility {
|
2022-07-15 12:39:45 -07:00
|
|
|
// =services
|
|
|
|
|
|
|
|
|
|
@service features;
|
|
|
|
|
|
2022-06-18 10:56:25 -04:00
|
|
|
// =permissions
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Only "known" credential store types may be read.
|
|
|
|
|
* @type {boolean}
|
|
|
|
|
*/
|
|
|
|
|
get canRead() {
|
2022-07-15 12:39:45 -07:00
|
|
|
return this.features.isEnabled('static-credentials')
|
|
|
|
|
? this.hasAuthorizedAction('read')
|
|
|
|
|
: !this.model.isStatic && this.hasAuthorizedAction('read');
|
2022-06-18 10:56:25 -04:00
|
|
|
}
|
|
|
|
|
}
|