feat: 🎸 Add abilities for session recordings (#120)

* feat: 🎸 Add abilities for session recordings

✅ Closes: ICU-8079
This commit is contained in:
Zhihe Li authored and GitHub committed 2023-03-15 15:45:51 -04:00
1 parent 5992829fa2
commit bf2029eb54
8 files changed
+324 -27

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import ModelAbility from './model';
/**
* Provides abilities for session recordings.
*/
export default class RecordingAbility extends ModelAbility {
// =services
// =permissions
/**
* Only "known" session recording types may be read.
* @type {boolean}
*/
get canRead() {
return !this.model.isUnknown && this.hasAuthorizedAction('read');
}
get canList() {
return (
this.hasAuthorizedCollectionAction('list') &&
(this.model.isGlobal || this.model.isOrg)
);
}
get canDownloadAsciiCast() {
return this.model.isSSH && this.hasAuthorizedAction('download');
}
}