From 87aea507f8f60877f74f0040f843e8924e0da91f Mon Sep 17 00:00:00 2001 From: Cameron Perera Date: Fri, 21 Apr 2023 16:39:13 -0500 Subject: [PATCH] =?UTF-8?q?refactor:=20=F0=9F=92=A1=20enable=20permission?= =?UTF-8?q?=20for=20listing=20session=20recordings=20(#215)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✅ Closes: ICU-9003 --- .../routes/scopes/scope/session-recordings.js | 40 ++++++++++--------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/ui/admin/app/routes/scopes/scope/session-recordings.js b/ui/admin/app/routes/scopes/scope/session-recordings.js index 4715a8a71..8d26602ae 100644 --- a/ui/admin/app/routes/scopes/scope/session-recordings.js +++ b/ui/admin/app/routes/scopes/scope/session-recordings.js @@ -28,28 +28,32 @@ export default class ScopesScopeSessionRecordingsRoute extends Route { const scope = this.modelFor('scopes.scope'); const { id: scope_id } = scope; - // if (this.can.can('list session-recording', scope, { collection: 'session-recordings' })) { - const sessionRecordings = await this.store.query('session-recording', { - scope_id, - recursive: true, - }); - - // Storage buckets could fail for a number of reasons, including that - // the user isn't authorized to access them. - try { - storageBuckets = await this.store.query('storage-bucket', { + if ( + this.can.can('list session-recording', scope, { + collection: 'session-recordings', + }) + ) { + const sessionRecordings = await this.store.query('session-recording', { scope_id, recursive: true, }); - } catch (e) { - // no op - } - return { - sessionRecordings, - storageBuckets, - }; - // } + // Storage buckets could fail for a number of reasons, including that + // the user isn't authorized to access them. + try { + storageBuckets = await this.store.query('storage-bucket', { + scope_id, + recursive: true, + }); + } catch (e) { + // no op + } + + return { + sessionRecordings, + storageBuckets, + }; + } } // =actions