Repository: fossasia/open-event-server

Issue:
Organizer video tab shows errors if there are video rooms not using BBB
Organizer video tab shows errors if there are video rooms not using BBB.

![Screenshot from 2021-11-10 23-44-19](https://user-images.githubusercontent.com/1583873/141205891-371c9945-1294-450b-8b35-3904f41c6af3.png)
![Screenshot from 2021-11-10 23-43-45](https://user-images.githubusercontent.com/1583873/141205894-141314cb-58cb-4525-9a1a-f48c2b77f522.png)

Compare https://eventyay.com/events/3ea940a8/video/all (only for organizer accessible)

Related to https://github.com/fossasia/open-event-frontend/pull/7927


Discussion:

Resolving patch:
diff --git a/app/api/video_recordings.py b/app/api/video_recordings.py
--- a/app/api/video_recordings.py
+++ b/app/api/video_recordings.py
@@ -19,39 +19,48 @@ def before_get(self, args, kwargs):
         if kwargs.get('video_stream_id'):
             stream = safe_query_kwargs(VideoStream, kwargs, 'video_stream_id', 'id')
 
-            if not has_access('is_organizer', event_id=stream.event_id):
-                raise ForbiddenError(
-                    {'pointer': 'event_id'},
-                    'You need to be the event organizer to access video recordings.',
-                )
+            if stream.channel and stream.channel.provider == 'bbb':
+                if not has_access('is_organizer', event_id=stream.event_id):
+                    raise ForbiddenError(
+                        {'pointer': 'event_id'},
+                        'You need to be the event organizer to access video recordings.',
+                    )
 
-            params = dict(
-                meetingID=stream.extra['response']['meetingID'],
-            )
-            channel = stream.channel
-            bbb = BigBlueButton(channel.api_url, channel.api_key)
-            result = bbb.request('getRecordings', params)
-
-            if result.data['response']['recordings']:
-                recordings = []
-                if type(result.data['response']['recordings']['recording']) is list:
-                    recordings = result.data['response']['recordings']['recording']
-                else:
-                    recordings.append(result.data['response']['recordings']['recording'])
-                for recording in recordings:
-                    get_or_create(
-                        VideoRecording,
-                        bbb_record_id=recording['recordID'],
-                        participants=recording['participants'],
-                        url=recording['playback']['format']['url'],
-                        start_time=datetime.fromtimestamp(
-                            int(int(recording['startTime']) / 1000)
-                        ),
-                        end_time=datetime.fromtimestamp(
-                            int(int(recording['endTime']) / 1000)
-                        ),
-                        video_stream=stream,
+                if stream.extra is not None:
+                    params = dict(
+                        meetingID=stream.extra['response']['meetingID'],
                     )
+                    channel = stream.channel
+                    bbb = BigBlueButton(channel.api_url, channel.api_key)
+                    result = bbb.request('getRecordings', params)
+
+                    if result.data['response']['recordings']:
+                        recordings = []
+                        if (
+                            type(result.data['response']['recordings']['recording'])
+                            is list
+                        ):
+                            recordings = result.data['response']['recordings'][
+                                'recording'
+                            ]
+                        else:
+                            recordings.append(
+                                result.data['response']['recordings']['recording']
+                            )
+                        for recording in recordings:
+                            get_or_create(
+                                VideoRecording,
+                                bbb_record_id=recording['recordID'],
+                                participants=recording['participants'],
+                                url=recording['playback']['format']['url'],
+                                start_time=datetime.fromtimestamp(
+                                    int(int(recording['startTime']) / 1000)
+                                ),
+                                end_time=datetime.fromtimestamp(
+                                    int(int(recording['endTime']) / 1000)
+                                ),
+                                video_stream=stream,
+                            )
 
     def query(self, view_kwargs):
         query_ = VideoRecording.query


Test patch: