mirror of
https://github.com/suitenumerique/meet.git
synced 2026-07-29 05:09:16 +00:00
✨(backend) expose is_authenticated in the LiveKit token
Include the is_authenticated flag on the user in the LiveKit token and participant metadata. The frontend needs this information (used in the next commit) to know whether it can offer to promote a user with access to the room admin.
This commit is contained in:
@@ -12,7 +12,7 @@ import pytest
|
||||
from rest_framework.test import APIClient
|
||||
|
||||
from ...factories import RoomFactory, UserFactory, UserResourceAccessFactory
|
||||
from ...models import RoomAccessLevel, RoleChoices
|
||||
from ...models import RoleChoices, RoomAccessLevel
|
||||
|
||||
pytestmark = pytest.mark.django_db
|
||||
|
||||
|
||||
@@ -129,7 +129,11 @@ def generate_token(
|
||||
.with_identity(identity)
|
||||
.with_name(display_name)
|
||||
.with_attributes(
|
||||
{"color": color, "room_role": role }
|
||||
{
|
||||
"color": color,
|
||||
"room_role": role,
|
||||
"is_authenticated": "true" if user.is_authenticated else "false",
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import type { Participant } from 'livekit-client'
|
||||
|
||||
export const getParticipantIsAuthenticated = (
|
||||
participant: Participant
|
||||
): boolean => {
|
||||
const isAuthenticated = participant.attributes?.is_authenticated
|
||||
return isAuthenticated == 'true'
|
||||
}
|
||||
Reference in New Issue
Block a user