From db50bfc9df56b01fc3dbd22a2eb9da9816a9ac3b Mon Sep 17 00:00:00 2001 From: Dharini Jeeva Date: Tue, 23 Jan 2024 11:31:43 -0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20delete=20and=20retain=5Fu?= =?UTF-8?q?ntil=20should=20be=20readonly=20and=20Scope=20level=20policies?= =?UTF-8?q?=20(#2104)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 🐛 delete and retain_until should be readonly * fix: 🐛 global scope should have policies from self and orgs --- .../addon/generated/models/session-recording.js | 2 ++ .../scopes/scope/add-storage-policy/index.js | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/addons/api/addon/generated/models/session-recording.js b/addons/api/addon/generated/models/session-recording.js index d78325880..f5e3c3606 100644 --- a/addons/api/addon/generated/models/session-recording.js +++ b/addons/api/addon/generated/models/session-recording.js @@ -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; } diff --git a/ui/admin/app/routes/scopes/scope/add-storage-policy/index.js b/ui/admin/app/routes/scopes/scope/add-storage-policy/index.js index 91d0ba0ec..ae07dd5d8 100644 --- a/ui/admin/app/routes/scopes/scope/add-storage-policy/index.js +++ b/ui/admin/app/routes/scopes/scope/add-storage-policy/index.js @@ -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]; + } } /**