-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨(backend) add shared note retrieve api endpoint
retrieve shared notes by recreating access link
- Loading branch information
alfredpichard
committed
Apr 25, 2023
1 parent
a3c6817
commit d9496c8
Showing
10 changed files
with
305 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ [email protected] | |
# BBB server credentials | ||
DJANGO_BBB_ENABLED=False | ||
DJANGO_BBB_API_ENDPOINT=https://example.com/bbb/api | ||
DJANGO_BBB_SHARED_NOTES_RETRIEVE_LINK=https://example.com/bbb | ||
DJANGO_BBB_API_SECRET=BbbSecret | ||
# BBB callback through scalelite may use a different secret to sign the sent token | ||
DJANGO_BBB_API_CALLBACK_SECRET=BbbOtherSecret | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
src/backend/marsha/bbb/migrations/0014_classroomsharednote.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# Generated by Django 4.1.7 on 2023-04-20 15:49 | ||
|
||
import uuid | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import django.utils.timezone | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("bbb", "0013_classroom_tools_parameters"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="ClassroomSharedNote", | ||
fields=[ | ||
( | ||
"deleted", | ||
models.DateTimeField(db_index=True, editable=False, null=True), | ||
), | ||
( | ||
"deleted_by_cascade", | ||
models.BooleanField(default=False, editable=False), | ||
), | ||
( | ||
"id", | ||
models.UUIDField( | ||
default=uuid.uuid4, | ||
editable=False, | ||
help_text="primary key for the shared note as UUID", | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="id", | ||
), | ||
), | ||
( | ||
"created_on", | ||
models.DateTimeField( | ||
default=django.utils.timezone.now, | ||
editable=False, | ||
help_text="date and time at which a shared note was created", | ||
verbose_name="created on", | ||
), | ||
), | ||
( | ||
"updated_on", | ||
models.DateTimeField( | ||
auto_now=True, | ||
help_text="date and time at which a shared note was last updated", | ||
verbose_name="updated on", | ||
), | ||
), | ||
( | ||
"shared_note_url", | ||
models.CharField( | ||
blank=True, | ||
help_text="url of the classroom shared note", | ||
max_length=255, | ||
null=True, | ||
verbose_name="shared note url", | ||
), | ||
), | ||
( | ||
"classroom", | ||
models.ForeignKey( | ||
help_text="classroom to which this shared note belongs", | ||
on_delete=django.db.models.deletion.PROTECT, | ||
related_name="shared notes", | ||
to="bbb.classroom", | ||
verbose_name="classroom shared note", | ||
), | ||
), | ||
], | ||
options={ | ||
"verbose_name": "Classroom shared note", | ||
"verbose_name_plural": "Classroom shared notes", | ||
"db_table": "classroom_shared_note", | ||
"ordering": ["-updated_on"], | ||
}, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
src/backend/marsha/bbb/tests/bbb_utils/test_get_session_shared_note.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
"""Tests for the get_recordings service in the ``bbb`` app of the Marsha project.""" | ||
from django.test import TestCase, override_settings | ||
|
||
import responses | ||
|
||
from marsha.bbb.factories import ClassroomFactory, ClassroomRecordingFactory | ||
from marsha.bbb.utils.bbb_utils import get_session_shared_note | ||
from marsha.core.tests.testing_utils import reload_urlconf | ||
|
||
|
||
@override_settings( | ||
BBB_SHARED_NOTES_RETRIEVE_LINK="https://10.7.7.1/bigbluebutton/sharednotes" | ||
) | ||
@override_settings(BBB_API_ENDPOINT="https://10.7.7.1/bigbluebutton/api") | ||
@override_settings(BBB_API_SECRET="SuperSecret") | ||
@override_settings(BBB_ENABLED=True) | ||
class ClassroomServiceTestCase(TestCase): | ||
"""Test our intentions about the Classroom get_recordings service.""" | ||
|
||
maxDiff = None | ||
|
||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
|
||
# Force URLs reload to use BBB_ENABLED | ||
reload_urlconf() | ||
|
||
@responses.activate | ||
def test_get_shared_notes(self): | ||
"""Validate response when multiple recordings exists.""" | ||
classroom = ClassroomFactory( | ||
meeting_id="881e8986-9673-11ed-a1eb-0242ac120002", started=True | ||
) | ||
|
||
responses.add( | ||
responses.GET, | ||
"https://10.7.7.1/bigbluebutton/api/getMeetingInfo", | ||
match=[ | ||
responses.matchers.query_param_matcher( | ||
{ | ||
"meetingID": "7a567d67-29d3-4547-96f3-035733a4dfaa", | ||
"checksum": "7f13332ec54e7df0a02d07904746cb5b8b330498", | ||
} | ||
) | ||
], | ||
body=""" | ||
<response> | ||
<returncode>SUCCESS</returncode> | ||
<meetingName>random-6256545</meetingName> | ||
<meetingID>random-6256545</meetingID> | ||
<internalMeetingID>ab0da0b4a1f283e94cfefdf32dd761eebd5461ce-1635514947533</internalMeetingID> | ||
<createTime>1635514947533</createTime> | ||
<createDate>Fri Oct 29 13:42:27 UTC 2021</createDate> | ||
<voiceBridge>77581</voiceBridge> | ||
<dialNumber>613-555-1234</dialNumber> | ||
<attendeePW>trac</attendeePW> | ||
<moderatorPW>trusti</moderatorPW> | ||
<running>true</running> | ||
<duration>0</duration> | ||
<hasUserJoined>true</hasUserJoined> | ||
<recording>false</recording> | ||
<hasBeenForciblyEnded>false</hasBeenForciblyEnded> | ||
<startTime>1635514947596</startTime> | ||
<endTime>0</endTime> | ||
<participantCount>1</participantCount> | ||
<listenerCount>0</listenerCount> | ||
<voiceParticipantCount>0</voiceParticipantCount> | ||
<videoCount>0</videoCount> | ||
<maxUsers>0</maxUsers> | ||
<moderatorCount>0</moderatorCount> | ||
<attendees> | ||
<attendee> | ||
<userID>w_2xox6leao03w</userID> | ||
<fullName>User 1907834</fullName> | ||
<role>MODERATOR</role> | ||
<isPresenter>true</isPresenter> | ||
<isListeningOnly>false</isListeningOnly> | ||
<hasJoinedVoice>false</hasJoinedVoice> | ||
<hasVideo>false</hasVideo> | ||
<clientType>HTML5</clientType> | ||
</attendee> | ||
<attendee> | ||
<userID>w_bau7cr7aefju</userID> | ||
<fullName>User 1907834</fullName> | ||
<role>VIEWER</role> | ||
<isPresenter>false</isPresenter> | ||
<isListeningOnly>false</isListeningOnly> | ||
<hasJoinedVoice>false</hasJoinedVoice> | ||
<hasVideo>false</hasVideo> | ||
<clientType>HTML5</clientType> | ||
</attendee> | ||
</attendees> | ||
<metadata> | ||
</metadata> | ||
<isBreakout>false</isBreakout> | ||
</response> | ||
""", | ||
status=200, | ||
) | ||
|
||
shared_note_object = get_session_shared_note(classroom.meeting_id) | ||
assert ( | ||
shared_note_object.shared_note_url | ||
== "https://10.7.7.1/bigbluebutton/sharednotes/ab0da0b4a1f283e94cfefdf32dd761eebd5461ce-1635514947533/notes.html" | ||
) |
Oops, something went wrong.