refactor: 💡 account and auth-method abilities (#1691)

* refactor: 💡 account and auth-method abilities

* refactor: 💡 add update & delete abilities & unit tests
This commit is contained in:
lisbet-alvarez authored and GitHub committed 2023-05-17 14:31:12 -07:00
1 parent e8a10b3131
commit 6dd0423923
14 files changed
+551 -51

No files matched your search

+24
View File
@@ -11,6 +11,30 @@ import ModelAbility from './model';
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');
}
/**
* @type {boolean}
*/