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

44 lines
881 B
JavaScript
Raw Normal View History

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
2021-09-29 17:47:48 -04:00
import ModelAbility from './model';
/**
* Provides abilities for accounts.
*/
export default class AccountAbility extends ModelAbility {
// =permissions
/**
* Only "known" account types may be read.
* @type {boolean}
*/
get canRead() {
return !this.model.isUnknown && this.hasAuthorizedAction('read');
}
/**
* Only "known" account types may be updated.
* @type {boolean}
*/
get canUpdate() {
return !this.model.isUnknown && this.hasAuthorizedAction('update');
}
/**
* Only "known" account types may be deleted.
* @type {boolean}
*/
get canDelete() {
return !this.model.isUnknown && this.hasAuthorizedAction('delete');
}
2021-09-29 17:47:48 -04:00
/**
* @type {boolean}
*/
get canSetPassword() {
return this.hasAuthorizedAction('set-password');
}
}