Skip to content

Commit

Permalink
feat: role appears in the invitation urls
Browse files Browse the repository at this point in the history
fixes #93
  • Loading branch information
azmeuk committed Mar 27, 2024
1 parent dda100a commit 53c838e
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 11 deletions.
8 changes: 7 additions & 1 deletion web/b3desk/endpoints/join.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/<role:role>/<meeting_fake_id>/creator/<user:creator>/hash/<h>"
)
@bp.route("/meeting/signin/<meeting_fake_id>/creator/<user:creator>/hash/<h>")
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:
Expand Down
1 change: 1 addition & 0 deletions web/b3desk/models/meetings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand Down
6 changes: 3 additions & 3 deletions web/b3desk/models/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@


class Role(Enum):
attendee = "attendee"
moderator = "moderator"
authenticated = "authenticated"
attendee = "invité"
moderator = "modérateur"
authenticated = "authentifié"
2 changes: 1 addition & 1 deletion web/tests/meeting/test_join.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
8 changes: 4 additions & 4 deletions web/tests/meeting/test_meeting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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,
}
Expand Down
4 changes: 2 additions & 2 deletions web/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
)

Expand Down

0 comments on commit 53c838e

Please sign in to comment.