fix: 🐛 delete and retain_until should be readonly and Scope level policies (#2104)

* fix: 🐛 delete and retain_until should be readonly

* fix: 🐛 global scope should have policies from self and orgs
This commit is contained in:
Dharini Jeeva authored and GitHub committed 2024-01-23 11:31:43 -08:00
1 parent 3f4beaada8
commit db50bfc9df
2 files changed
+14 -4

No files matched your search

@@ -112,12 +112,14 @@ export default class GeneratedSessionRecordingModel extends BaseModel {
@attr('date', {
description: 'The time until a session recording is required to be stored.',
readOnly: true,
})
retain_until;
@attr('date', {
description:
'The time a session recording is scheduled to be automatically deleted.',
readOnly: true,
})
delete_after;
}
@@ -22,13 +22,21 @@ export default class ScopesScopeAddStoragePolicyIndexRoute extends Route {
*/
async afterModel() {
const { id: scope_id } = this.modelFor('scopes.scope');
//fetch policies from current scope
const orgScopePolicies = await this.store.query('policy', {
const currentScopePolicies = await this.store.query('policy', {
scope_id,
});
this.policyList = orgScopePolicies;
if (scope_id === 'global') {
// Global scope should only list policies from its scope
this.policyList = currentScopePolicies;
} else {
// Org scope should list both global and org scope policies
const globalScopePolicies = await this.store.query('policy', {
scope_id: 'global',
});
this.policyList = [...globalScopePolicies, ...currentScopePolicies];
}
}
/**