diff --git a/web/b3desk/endpoints/join.py b/web/b3desk/endpoints/join.py index ee5fe876..2f99d99b 100644 --- a/web/b3desk/endpoints/join.py +++ b/web/b3desk/endpoints/join.py @@ -66,8 +66,14 @@ def signin_mail_meeting(meeting_fake_id, expiration, h): ) +# The role needs to appear in the URL, even if it is unused, so user won't +# mix up invitation links. +# https://github.com/numerique-gouv/b3desk/issues/93 +@bp.route( + "/meeting/signin///creator//hash/" +) @bp.route("/meeting/signin//creator//hash/") -def signin_meeting(meeting_fake_id, creator: User, h): +def signin_meeting(meeting_fake_id, creator: User, h, role: Role = None): meeting = get_meeting_from_meeting_id_and_user_id(meeting_fake_id, creator.id) wordings = current_app.config["WORDINGS"] if meeting is None: diff --git a/web/b3desk/models/meetings.py b/web/b3desk/models/meetings.py index 46b13a89..fe1fd71c 100644 --- a/web/b3desk/models/meetings.py +++ b/web/b3desk/models/meetings.py @@ -229,6 +229,7 @@ def get_signin_url(self, meeting_role: Role): meeting_fake_id=self.fake_id, creator=self.user, h=self.get_hash(meeting_role), + role=meeting_role, _external=True, ) diff --git a/web/b3desk/models/roles.py b/web/b3desk/models/roles.py index 20ac977f..a6573a2b 100644 --- a/web/b3desk/models/roles.py +++ b/web/b3desk/models/roles.py @@ -2,6 +2,6 @@ class Role(Enum): - attendee = "attendee" - moderator = "moderator" - authenticated = "authenticated" + attendee = "invité" + moderator = "modérateur" + authenticated = "authentifié" diff --git a/web/tests/meeting/test_join.py b/web/tests/meeting/test_join.py index 1d225c14..cce52efa 100644 --- a/web/tests/meeting/test_join.py +++ b/web/tests/meeting/test_join.py @@ -178,7 +178,7 @@ def test_join_mail_meeting(client_app, meeting, bbb_response): def test_join_meeting_as_role(client_app, authenticated_user, meeting, bbb_response): fullname = "Alice+Cooper" - response = client_app.get(f"/meeting/join/{meeting.id}/attendee", status=302) + response = client_app.get(f"/meeting/join/{meeting.id}/invite", status=302) assert ( f"{client_app.app.config['BIGBLUEBUTTON_ENDPOINT']}/join?fullName={fullname}" diff --git a/web/tests/meeting/test_meeting.py b/web/tests/meeting/test_meeting.py index 82d2132c..4d68bb9b 100644 --- a/web/tests/meeting/test_meeting.py +++ b/web/tests/meeting/test_meeting.py @@ -298,7 +298,7 @@ def test_create_no_file(client_app, meeting, mocker, bbb_response): "logoutURL": "https://log.out", "record": "true", "duration": "60", - "moderatorOnlyMessage": f"Welcome moderators!\n\n Lien Modérateur :\n\nhttp://localhost:5000/meeting/signin/1/creator/1/hash/{meeting.get_hash(Role.moderator)}\n\n Lien Participant :\n\nhttp://localhost:5000/meeting/signin/1/creator/1/hash/{meeting.get_hash(Role.attendee)}", + "moderatorOnlyMessage": f"Welcome moderators!\n\n Lien Modérateur :\n\nhttp://localhost:5000/meeting/signin/moderateur/1/creator/1/hash/{meeting.get_hash(Role.moderator)}\n\n Lien Participant :\n\nhttp://localhost:5000/meeting/signin/invite/1/creator/1/hash/{meeting.get_hash(Role.attendee)}", "autoStartRecording": "false", "allowStartStopRecording": "true", "webcamsOnlyForModerator": "false", @@ -390,7 +390,7 @@ def test_create_with_only_a_default_file( "logoutURL": "https://log.out", "record": "true", "duration": "60", - "moderatorOnlyMessage": f"Welcome moderators!\n\n Lien Modérateur :\n\nhttp://localhost:5000/meeting/signin/1/creator/1/hash/{meeting.get_hash(Role.moderator)}\n\n Lien Participant :\n\nhttp://localhost:5000/meeting/signin/1/creator/1/hash/{meeting.get_hash(Role.attendee)}", + "moderatorOnlyMessage": f"Welcome moderators!\n\n Lien Modérateur :\n\nhttp://localhost:5000/meeting/signin/moderateur/1/creator/1/hash/{meeting.get_hash(Role.moderator)}\n\n Lien Participant :\n\nhttp://localhost:5000/meeting/signin/invite/1/creator/1/hash/{meeting.get_hash(Role.attendee)}", "autoStartRecording": "false", "allowStartStopRecording": "true", "webcamsOnlyForModerator": "false", @@ -482,7 +482,7 @@ def test_create_with_files( "logoutURL": "https://log.out", "record": "true", "duration": "60", - "moderatorOnlyMessage": f"Welcome moderators!\n\n Lien Modérateur :\n\nhttp://localhost:5000/meeting/signin/1/creator/1/hash/{meeting.get_hash(Role.moderator)}\n\n Lien Participant :\n\nhttp://localhost:5000/meeting/signin/1/creator/1/hash/{meeting.get_hash(Role.attendee)}", + "moderatorOnlyMessage": f"Welcome moderators!\n\n Lien Modérateur :\n\nhttp://localhost:5000/meeting/signin/moderateur/1/creator/1/hash/{meeting.get_hash(Role.moderator)}\n\n Lien Participant :\n\nhttp://localhost:5000/meeting/signin/invite/1/creator/1/hash/{meeting.get_hash(Role.attendee)}", "autoStartRecording": "false", "allowStartStopRecording": "true", "webcamsOnlyForModerator": "false", @@ -562,7 +562,7 @@ def test_create_quick_meeting(client_app, monkeypatch, user, mocker, bbb_respons "duration": "280", "meetingKeepEvents": "true", "meta_analytics-callback-url": "https://bbb-analytics-staging.osc-fr1.scalingo.io/v1/post_events", - "moderatorOnlyMessage": f"Bienvenue aux modérateurs. Pour inviter quelqu'un à ce séminaire, envoyez-lui l'un de ces liens :\n\n Lien Modérateur :\n\nhttp://localhost:5000/meeting/signin/{meeting.fake_id}/creator/1/hash/{meeting.get_hash(Role.moderator)}\n\n Lien Participant :\n\nhttp://localhost:5000/meeting/signin/{meeting.fake_id}/creator/1/hash/{meeting.get_hash(Role.attendee)}", + "moderatorOnlyMessage": f"Bienvenue aux modérateurs. Pour inviter quelqu'un à ce séminaire, envoyez-lui l'un de ces liens :\n\n Lien Modérateur :\n\nhttp://localhost:5000/meeting/signin/moderateur/{meeting.fake_id}/creator/1/hash/{meeting.get_hash(Role.moderator)}\n\n Lien Participant :\n\nhttp://localhost:5000/meeting/signin/invite/{meeting.fake_id}/creator/1/hash/{meeting.get_hash(Role.attendee)}", "guestPolicy": "ALWAYS_ACCEPT", "checksum": mock.ANY, } diff --git a/web/tests/test_api.py b/web/tests/test_api.py index 9b9cc177..f9a898d9 100644 --- a/web/tests/test_api.py +++ b/web/tests/test_api.py @@ -8,11 +8,11 @@ def test_api_meetings_nominal(client_app, user, meeting, iam_token): assert res.json["meetings"] assert res.json["meetings"][0]["name"] == "meeting" assert ( - f"/meeting/signin/{meeting.id}/creator/{user.id}/hash/" + f"/meeting/signin/moderateur/{meeting.id}/creator/{user.id}/hash/" in res.json["meetings"][0]["moderator_url"] ) assert ( - f"/meeting/signin/{meeting.id}/creator/{user.id}/hash/" + f"/meeting/signin/invite/{meeting.id}/creator/{user.id}/hash/" in res.json["meetings"][0]["attendee_url"] )