mirror of
https://github.com/suitenumerique/meet.git
synced 2026-10-11 23:52:00 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b86ac35dc6 | |||
| f182474ed9 | |||
| c075db25a4 | |||
| c0dfd88776 | |||
| 94d2b80c17 | |||
| bd2dfcae80 | |||
| 0b4a83c92e |
@@ -10,11 +10,13 @@ and this project adheres to
|
|||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
- ✨(helm) import environment variables from Secrets and ConfigMaps
|
||||||
- 🔒(backend) throttle meeting link generation
|
- 🔒(backend) throttle meeting link generation
|
||||||
- 🔒️(backend) add a daily cap on room creation
|
- 🔒️(backend) add a daily cap on room creation
|
||||||
- 🔧(summary) add setting to control Sentry traces sampling rate
|
- 🔧(summary) add setting to control Sentry traces sampling rate
|
||||||
- ✨(frontend) let signed-out visitors start a meeting
|
- ✨(frontend) let signed-out visitors start a meeting
|
||||||
- ✨(backend) expose `allow_unregistered_rooms` in the frontend configuration
|
- ✨(backend) expose `allow_unregistered_rooms` in the frontend configuration
|
||||||
|
- ✨(backend) authenticate external API calls with Menshen exchanged tokens
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
@@ -31,6 +33,9 @@ and this project adheres to
|
|||||||
- 🐛(summary) disable default S3 checksums for GCS-compatible storage
|
- 🐛(summary) disable default S3 checksums for GCS-compatible storage
|
||||||
- 🔒️(summary) redact meeting content from Sentry events
|
- 🔒️(summary) redact meeting content from Sentry events
|
||||||
- 🐛(frontend) hide tooltips until they have a computed placement
|
- 🐛(frontend) hide tooltips until they have a computed placement
|
||||||
|
- 🐛(brevo) use django-lasuite for marketing management
|
||||||
|
- ♿️(frontend) expose loading state to assistive technology
|
||||||
|
- 🐛(frontend) honour Keep hand raised when picture-in-picture is open
|
||||||
|
|
||||||
## [1.33.0] - 2026-09-30
|
## [1.33.0] - 2026-09-30
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/m/suitenumerique/meet"/>
|
<img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/m/suitenumerique/meet"/>
|
||||||
<img alt="GitHub closed issues" src="https://img.shields.io/github/issues-closed/suitenumerique/meet"/>
|
<img alt="GitHub closed issues" src="https://img.shields.io/github/issues-closed/suitenumerique/meet"/>
|
||||||
<a href="https://github.com/suitenumerique/meet/blob/main/LICENSE">
|
<a href="https://github.com/suitenumerique/meet/blob/main/LICENSE">
|
||||||
<img alt="GitHub closed issues" src="https://img.shields.io/github/license/suitenumerique/meet"/>
|
<img alt="GitHub license" src="https://img.shields.io/github/license/suitenumerique/meet"/>
|
||||||
</a>
|
</a>
|
||||||
<a href="https://digitalpublicgoods.net/r/la-suite-meet-simple-video-conferencing">
|
<a href="https://digitalpublicgoods.net/r/la-suite-meet-simple-video-conferencing">
|
||||||
<img src="https://img.shields.io/badge/Verified-DPG-3333AB?logo=data:image/svg%2bxml;base64,PHN2ZyB3aWR0aD0iMzEiIGhlaWdodD0iMzMiIHZpZXdCb3g9IjAgMCAzMSAzMyIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTE0LjIwMDggMjEuMzY3OEwxMC4xNzM2IDE4LjAxMjRMMTEuNTIxOSAxNi40MDAzTDEzLjk5MjggMTguNDU5TDE5LjYyNjkgMTIuMjExMUwyMS4xOTA5IDEzLjYxNkwxNC4yMDA4IDIxLjM2NzhaTTI0LjYyNDEgOS4zNTEyN0wyNC44MDcxIDMuMDcyOTdMMTguODgxIDUuMTg2NjJMMTUuMzMxNCAtMi4zMzA4MmUtMDVMMTEuNzgyMSA1LjE4NjYyTDUuODU2MDEgMy4wNzI5N0w2LjAzOTA2IDkuMzUxMjdMMCAxMS4xMTc3TDMuODQ1MjEgMTYuMDg5NUwwIDIxLjA2MTJMNi4wMzkwNiAyMi44Mjc3TDUuODU2MDEgMjkuMTA2TDExLjc4MjEgMjYuOTkyM0wxNS4zMzE0IDMyLjE3OUwxOC44ODEgMjYuOTkyM0wyNC44MDcxIDI5LjEwNkwyNC42MjQxIDIyLjgyNzdMMzAuNjYzMSAyMS4wNjEyTDI2LjgxNzYgMTYuMDg5NUwzMC42NjMxIDExLjExNzdMMjQuNjI0MSA5LjM1MTI3WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==" alt="DPG Badge"/>
|
<img src="https://img.shields.io/badge/Verified-DPG-3333AB?logo=data:image/svg%2bxml;base64,PHN2ZyB3aWR0aD0iMzEiIGhlaWdodD0iMzMiIHZpZXdCb3g9IjAgMCAzMSAzMyIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTE0LjIwMDggMjEuMzY3OEwxMC4xNzM2IDE4LjAxMjRMMTEuNTIxOSAxNi40MDAzTDEzLjk5MjggMTguNDU5TDE5LjYyNjkgMTIuMjExMUwyMS4xOTA5IDEzLjYxNkwxNC4yMDA4IDIxLjM2NzhaTTI0LjYyNDEgOS4zNTEyN0wyNC44MDcxIDMuMDcyOTdMMTguODgxIDUuMTg2NjJMMTUuMzMxNCAtMi4zMzA4MmUtMDVMMTEuNzgyMSA1LjE4NjYyTDUuODU2MDEgMy4wNzI5N0w2LjAzOTA2IDkuMzUxMjdMMCAxMS4xMTc3TDMuODQ1MjEgMTYuMDg5NUwwIDIxLjA2MTJMNi4wMzkwNiAyMi44Mjc3TDUuODU2MDEgMjkuMTA2TDExLjc4MjEgMjYuOTkyM0wxNS4zMzE0IDMyLjE3OUwxOC44ODEgMjYuOTkyM0wyNC44MDcxIDI5LjEwNkwyNC42MjQxIDIyLjgyNzdMMzAuNjYzMSAyMS4wNjEyTDI2LjgxNzYgMTYuMDg5NUwzMC42NjMxIDExLjExNzdMMjQuNjI0MSA5LjM1MTI3WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==" alt="DPG Badge"/>
|
||||||
@@ -49,8 +49,8 @@ Powered by [LiveKit](https://livekit.io/), La Suite Meet offers Zoom-level perfo
|
|||||||
- Telephony integration
|
- Telephony integration
|
||||||
- Secure participation with robust authentication and access control
|
- Secure participation with robust authentication and access control
|
||||||
- Customizable frontend style
|
- Customizable frontend style
|
||||||
- LiveKit Advances features including :
|
- LiveKit advanced features including:
|
||||||
- speaker detection
|
- speaker detection
|
||||||
- simulcast
|
- simulcast
|
||||||
- end-to-end optimizations
|
- end-to-end optimizations
|
||||||
- selective subscription
|
- selective subscription
|
||||||
|
|||||||
@@ -1,26 +1,19 @@
|
|||||||
"""Authentication Backends for the Meet core app."""
|
"""Authentication Backends for the Meet core app."""
|
||||||
|
|
||||||
import contextlib
|
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.exceptions import (
|
from django.core.exceptions import (
|
||||||
ImproperlyConfigured,
|
|
||||||
SuspiciousOperation,
|
SuspiciousOperation,
|
||||||
ValidationError,
|
ValidationError,
|
||||||
)
|
)
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
|
from lasuite.marketing.tasks import create_or_update_contact
|
||||||
from lasuite.oidc_login.backends import (
|
from lasuite.oidc_login.backends import (
|
||||||
OIDCAuthenticationBackend as LaSuiteOIDCAuthenticationBackend,
|
OIDCAuthenticationBackend as LaSuiteOIDCAuthenticationBackend,
|
||||||
)
|
)
|
||||||
from rest_framework.authentication import SessionAuthentication
|
from rest_framework.authentication import SessionAuthentication
|
||||||
|
|
||||||
from core.models import User
|
from core.models import User
|
||||||
from core.services.marketing import (
|
|
||||||
ContactCreationError,
|
|
||||||
ContactData,
|
|
||||||
get_marketing_service,
|
|
||||||
)
|
|
||||||
from core.validators import sub_validator
|
from core.validators import sub_validator
|
||||||
|
|
||||||
|
|
||||||
@@ -67,25 +60,15 @@ class OIDCAuthenticationBackend(LaSuiteOIDCAuthenticationBackend):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def signup_to_marketing_email(email):
|
def signup_to_marketing_email(email):
|
||||||
"""Pragmatic approach to newsletter signup during authentication flow.
|
"""Add the user to the newsletter list on sign-in.
|
||||||
|
|
||||||
Details:
|
Uses the team's standard Brevo integration, dispatching the contact
|
||||||
1. Uses a very short timeout (1s) to prevent blocking the auth process
|
creation/update as an asynchronous task to keep authentication fast.
|
||||||
2. Silently fails if the marketing service is down/slow to prioritize user experience
|
|
||||||
3. Trade-off: May miss some signups but ensures auth flow remains fast
|
|
||||||
|
|
||||||
Note: For a more robust solution, consider using Async task processing (Celery/Django-Q)
|
|
||||||
"""
|
"""
|
||||||
with contextlib.suppress(
|
create_or_update_contact.delay(
|
||||||
ContactCreationError, ImproperlyConfigured, ImportError
|
email=email,
|
||||||
):
|
attributes={"VISIO_SOURCE": ["SIGNIN"]},
|
||||||
marketing_service = get_marketing_service()
|
)
|
||||||
contact_data = ContactData(
|
|
||||||
email=email, attributes={"VISIO_SOURCE": ["SIGNIN"]}
|
|
||||||
)
|
|
||||||
marketing_service.create_contact(
|
|
||||||
contact_data, timeout=settings.BREVO_API_TIMEOUT
|
|
||||||
)
|
|
||||||
|
|
||||||
def get_existing_user(self, sub, email):
|
def get_existing_user(self, sub, email):
|
||||||
"""Fetch existing user by sub or email."""
|
"""Fetch existing user by sub or email."""
|
||||||
|
|||||||
@@ -4,21 +4,51 @@
|
|||||||
# ruff: noqa: PLR0913
|
# ruff: noqa: PLR0913
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
from dataclasses import asdict
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.core.exceptions import SuspiciousOperation
|
from django.core.exceptions import SuspiciousOperation
|
||||||
|
|
||||||
|
import requests
|
||||||
from lasuite.oidc_resource_server.backend import ResourceServerBackend as LaSuiteBackend
|
from lasuite.oidc_resource_server.backend import ResourceServerBackend as LaSuiteBackend
|
||||||
|
from menshen_client import Configuration, IntrospectionRequest, TokenExchangeClient
|
||||||
|
from menshen_client.exceptions import ResponseParsingError
|
||||||
from rest_framework import authentication, exceptions
|
from rest_framework import authentication, exceptions
|
||||||
|
|
||||||
from core.models import Application
|
from core.models import Application, ApplicationScope
|
||||||
from core.services import jwt_token
|
from core.services import jwt_token
|
||||||
|
|
||||||
User = get_user_model()
|
User = get_user_model()
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
def get_bearer_token(request):
|
||||||
|
"""Extract the bearer token from the Authorization header.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Token string, or None if the request carries no bearer token
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
AuthenticationFailed: If the Authorization header is malformed
|
||||||
|
"""
|
||||||
|
|
||||||
|
auth_header = authentication.get_authorization_header(request).split()
|
||||||
|
|
||||||
|
if not auth_header or auth_header[0].lower() != b"bearer":
|
||||||
|
return None
|
||||||
|
|
||||||
|
if len(auth_header) != 2:
|
||||||
|
logger.warning("Invalid token header format")
|
||||||
|
raise exceptions.AuthenticationFailed("Invalid token header.")
|
||||||
|
|
||||||
|
try:
|
||||||
|
return auth_header[1].decode("utf-8")
|
||||||
|
except UnicodeError as e:
|
||||||
|
logger.warning("Token decode error: %s", e)
|
||||||
|
raise exceptions.AuthenticationFailed("Invalid token encoding.") from e
|
||||||
|
|
||||||
|
|
||||||
class BaseJWTAuthentication(authentication.BaseAuthentication):
|
class BaseJWTAuthentication(authentication.BaseAuthentication):
|
||||||
"""Base JWT authentication class."""
|
"""Base JWT authentication class."""
|
||||||
|
|
||||||
@@ -71,22 +101,12 @@ class BaseJWTAuthentication(authentication.BaseAuthentication):
|
|||||||
if not self.is_enabled:
|
if not self.is_enabled:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
auth_header = authentication.get_authorization_header(request).split()
|
token = get_bearer_token(request)
|
||||||
|
|
||||||
if not auth_header or auth_header[0].lower() != b"bearer":
|
if token is None:
|
||||||
# Defer to next authentication backend
|
# Defer to next authentication backend
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if len(auth_header) != 2:
|
|
||||||
logger.warning("Invalid token header format")
|
|
||||||
raise exceptions.AuthenticationFailed("Invalid token header.")
|
|
||||||
|
|
||||||
try:
|
|
||||||
token = auth_header[1].decode("utf-8")
|
|
||||||
except UnicodeError as e:
|
|
||||||
logger.warning("Token decode error: %s", e)
|
|
||||||
raise exceptions.AuthenticationFailed("Invalid token encoding.") from e
|
|
||||||
|
|
||||||
return self.authenticate_credentials(token)
|
return self.authenticate_credentials(token)
|
||||||
|
|
||||||
def decode_jwt(self, token):
|
def decode_jwt(self, token):
|
||||||
@@ -252,6 +272,139 @@ class AddonsJWTAuthentication(BaseJWTAuthentication):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# Menshen grants scopes following La Suite's "service:resource:action" convention.
|
||||||
|
# Map them to the scopes expected by the external API permissions.
|
||||||
|
MENSHEN_SCOPES_MAPPING = {
|
||||||
|
"meet:room:create": ApplicationScope.ROOMS_CREATE,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class MenshenAuthentication(authentication.BaseAuthentication):
|
||||||
|
"""Authentication for tokens exchanged through Menshen.
|
||||||
|
|
||||||
|
Menshen is La Suite's OAuth 2.0 token exchange server (RFC 8693): another service
|
||||||
|
exchanges its user's access token for a token targeting Meet, then calls the external
|
||||||
|
API on behalf of that user. Tokens are validated by introspection (RFC 7662). Menshen
|
||||||
|
only reports a token as active when Meet is among its audiences.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
"""Initialize the Menshen client from Django settings."""
|
||||||
|
|
||||||
|
super().__init__()
|
||||||
|
|
||||||
|
self._client = None
|
||||||
|
|
||||||
|
if not settings.MENSHEN_ENABLED:
|
||||||
|
return
|
||||||
|
|
||||||
|
self._client = TokenExchangeClient(
|
||||||
|
config=Configuration(
|
||||||
|
client_id=settings.MENSHEN_CLIENT_ID,
|
||||||
|
client_secret=settings.MENSHEN_CLIENT_SECRET,
|
||||||
|
server_root_url=settings.MENSHEN_SERVER_URL,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
def authenticate(self, request):
|
||||||
|
"""Introspect the bearer token with Menshen.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Tuple of (user, payload) if the token is active, None otherwise
|
||||||
|
"""
|
||||||
|
|
||||||
|
if self._client is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
token = get_bearer_token(request)
|
||||||
|
|
||||||
|
if token is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
payload = self.introspect(token)
|
||||||
|
|
||||||
|
if not payload.get("active"):
|
||||||
|
# Not a Menshen token, or an expired or revoked one: defer to next
|
||||||
|
# authentication backend
|
||||||
|
return None
|
||||||
|
|
||||||
|
user = self.get_user(payload)
|
||||||
|
|
||||||
|
scopes = payload.get("scope") or ""
|
||||||
|
payload["scope"] = [
|
||||||
|
MENSHEN_SCOPES_MAPPING[scope]
|
||||||
|
for scope in scopes.split()
|
||||||
|
if scope in MENSHEN_SCOPES_MAPPING
|
||||||
|
]
|
||||||
|
|
||||||
|
return (user, payload)
|
||||||
|
|
||||||
|
def introspect(self, token):
|
||||||
|
"""Submit the token to Menshen's introspection endpoint.
|
||||||
|
|
||||||
|
Errors are reported as an inactive token, so a Menshen outage doesn't
|
||||||
|
prevent the next authentication backends from running.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
token: Bearer token string
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Introspection response dict
|
||||||
|
"""
|
||||||
|
|
||||||
|
try:
|
||||||
|
response = self._client.introspect(IntrospectionRequest(token=token))
|
||||||
|
except (requests.RequestException, ResponseParsingError) as e:
|
||||||
|
logger.warning("Menshen introspection failed: %s", e)
|
||||||
|
return {"active": False}
|
||||||
|
|
||||||
|
# Permission classes expect a dict payload in request.auth
|
||||||
|
return asdict(response)
|
||||||
|
|
||||||
|
def get_user(self, payload):
|
||||||
|
"""Retrieve or create the user from the introspection response.
|
||||||
|
|
||||||
|
Menshen forwards the `sub` and `email` of the subject token, as introspected
|
||||||
|
with the OIDC provider.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
payload: Introspection response dict
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
User instance
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
AuthenticationFailed: If user not found or inactive
|
||||||
|
"""
|
||||||
|
|
||||||
|
sub = payload.get("sub")
|
||||||
|
|
||||||
|
if not sub:
|
||||||
|
logger.warning("Missing 'sub' in Menshen introspection response")
|
||||||
|
raise exceptions.AuthenticationFailed("Invalid token claims.")
|
||||||
|
|
||||||
|
try:
|
||||||
|
user = User.objects.get(sub=sub)
|
||||||
|
except User.DoesNotExist as e:
|
||||||
|
if not settings.OIDC_CREATE_USER:
|
||||||
|
logger.warning("User not found: %s", sub)
|
||||||
|
raise exceptions.AuthenticationFailed("User not found.") from e
|
||||||
|
|
||||||
|
user = User(sub=sub, email=payload.get("email"))
|
||||||
|
user.set_unusable_password()
|
||||||
|
user.save()
|
||||||
|
|
||||||
|
if not user.is_active:
|
||||||
|
logger.warning("Inactive user attempted authentication: %s", user.pk)
|
||||||
|
raise exceptions.AuthenticationFailed("User account is disabled.")
|
||||||
|
|
||||||
|
return user
|
||||||
|
|
||||||
|
def authenticate_header(self, request):
|
||||||
|
"""Return authentication scheme for WWW-Authenticate header."""
|
||||||
|
return "Bearer"
|
||||||
|
|
||||||
|
|
||||||
class ResourceServerBackend(LaSuiteBackend):
|
class ResourceServerBackend(LaSuiteBackend):
|
||||||
"""OIDC Resource Server backend for user creation and retrieval."""
|
"""OIDC Resource Server backend for user creation and retrieval."""
|
||||||
|
|
||||||
|
|||||||
@@ -166,6 +166,7 @@ class RoomViewSet(
|
|||||||
authentication_classes = [
|
authentication_classes = [
|
||||||
authentication.ApplicationJWTAuthentication,
|
authentication.ApplicationJWTAuthentication,
|
||||||
authentication.AddonsJWTAuthentication,
|
authentication.AddonsJWTAuthentication,
|
||||||
|
authentication.MenshenAuthentication,
|
||||||
ResourceServerAuthentication,
|
ResourceServerAuthentication,
|
||||||
]
|
]
|
||||||
permission_classes = [
|
permission_classes = [
|
||||||
|
|||||||
@@ -1,138 +0,0 @@
|
|||||||
"""Marketing service in charge of pushing data for marketing automation."""
|
|
||||||
|
|
||||||
import logging
|
|
||||||
from dataclasses import dataclass
|
|
||||||
from functools import lru_cache
|
|
||||||
from typing import Dict, List, Optional, Protocol
|
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
|
||||||
from django.utils.module_loading import import_string
|
|
||||||
|
|
||||||
import brevo_python
|
|
||||||
import urllib3
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class ContactCreationError(Exception):
|
|
||||||
"""Raised when the contact creation fails."""
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class ContactData:
|
|
||||||
"""Contact data for marketing service integration."""
|
|
||||||
|
|
||||||
email: str
|
|
||||||
attributes: Optional[Dict[str, str]] = None
|
|
||||||
list_ids: Optional[List[int]] = None
|
|
||||||
update_enabled: bool = True
|
|
||||||
|
|
||||||
|
|
||||||
class MarketingServiceProtocol(Protocol):
|
|
||||||
"""Interface for marketing automation service integrations."""
|
|
||||||
|
|
||||||
def create_contact(
|
|
||||||
self, contact_data: ContactData, timeout: Optional[int] = None
|
|
||||||
) -> dict:
|
|
||||||
"""Create or update a contact.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
contact_data: Contact information and attributes
|
|
||||||
timeout: API request timeout in seconds
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: Service response
|
|
||||||
|
|
||||||
Raises:
|
|
||||||
ContactCreationError: If contact creation fails
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
class BrevoMarketingService:
|
|
||||||
"""Brevo marketing automation integration.
|
|
||||||
|
|
||||||
Handles:
|
|
||||||
- Contact management and segmentation
|
|
||||||
- Marketing campaigns and automation
|
|
||||||
- Email communications
|
|
||||||
|
|
||||||
Configuration via Django settings:
|
|
||||||
- BREVO_API_KEY: API authentication
|
|
||||||
- BREVO_API_CONTACT_LIST_IDS: Default contact lists
|
|
||||||
- BREVO_API_CONTACT_ATTRIBUTES: Default contact attributes
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
"""Initialize Brevo (ex-sendinblue) marketing service."""
|
|
||||||
|
|
||||||
if not settings.BREVO_API_KEY:
|
|
||||||
raise ImproperlyConfigured("Brevo API key is required")
|
|
||||||
|
|
||||||
configuration = brevo_python.Configuration()
|
|
||||||
configuration.api_key["api-key"] = settings.BREVO_API_KEY
|
|
||||||
|
|
||||||
self._api_client = brevo_python.ApiClient(configuration)
|
|
||||||
|
|
||||||
def create_contact(self, contact_data: ContactData, timeout=None) -> dict:
|
|
||||||
"""Create or update a Brevo contact.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
contact_data: Contact information and attributes
|
|
||||||
timeout: API request timeout in seconds
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: Brevo API response
|
|
||||||
|
|
||||||
Raises:
|
|
||||||
ContactCreationError: If contact creation fails
|
|
||||||
ImproperlyConfigured: If required settings are missing
|
|
||||||
|
|
||||||
Note:
|
|
||||||
Contact attributes must be pre-configured in Brevo.
|
|
||||||
Changes to attributes can impact existing workflows.
|
|
||||||
"""
|
|
||||||
|
|
||||||
if not settings.BREVO_API_CONTACT_LIST_IDS:
|
|
||||||
raise ImproperlyConfigured(
|
|
||||||
"Default Brevo List IDs must be configured in settings."
|
|
||||||
)
|
|
||||||
|
|
||||||
contact_api = brevo_python.ContactsApi(self._api_client)
|
|
||||||
|
|
||||||
attributes = {
|
|
||||||
**settings.BREVO_API_CONTACT_ATTRIBUTES,
|
|
||||||
**(contact_data.attributes or {}),
|
|
||||||
}
|
|
||||||
|
|
||||||
list_ids = (contact_data.list_ids or []) + settings.BREVO_API_CONTACT_LIST_IDS
|
|
||||||
|
|
||||||
contact = brevo_python.CreateContact(
|
|
||||||
email=contact_data.email,
|
|
||||||
attributes=attributes,
|
|
||||||
list_ids=list_ids,
|
|
||||||
update_enabled=contact_data.update_enabled,
|
|
||||||
)
|
|
||||||
|
|
||||||
api_configurations = {}
|
|
||||||
|
|
||||||
if timeout is not None:
|
|
||||||
api_configurations["_request_timeout"] = timeout
|
|
||||||
|
|
||||||
try:
|
|
||||||
response = contact_api.create_contact(contact, **api_configurations)
|
|
||||||
except (
|
|
||||||
brevo_python.rest.ApiException,
|
|
||||||
urllib3.exceptions.ReadTimeoutError,
|
|
||||||
) as err:
|
|
||||||
logger.warning("Failed to create contact in Brevo", exc_info=True)
|
|
||||||
raise ContactCreationError("Failed to create contact in Brevo") from err
|
|
||||||
|
|
||||||
return response
|
|
||||||
|
|
||||||
|
|
||||||
@lru_cache(maxsize=1)
|
|
||||||
def get_marketing_service() -> MarketingServiceProtocol:
|
|
||||||
"""Return cached instance of configured marketing service."""
|
|
||||||
marketing_service_cls = import_string(settings.MARKETING_SERVICE_CLASS)
|
|
||||||
return marketing_service_cls()
|
|
||||||
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
from django.core.exceptions import ImproperlyConfigured, SuspiciousOperation
|
from django.core.exceptions import SuspiciousOperation
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
from lasuite.marketing.tasks import create_or_update_contact
|
||||||
|
|
||||||
from core import models
|
from core import models
|
||||||
from core.authentication.backends import OIDCAuthenticationBackend
|
from core.authentication.backends import OIDCAuthenticationBackend
|
||||||
from core.factories import UserFactory
|
from core.factories import UserFactory
|
||||||
from core.services import marketing
|
|
||||||
|
|
||||||
pytestmark = pytest.mark.django_db
|
pytestmark = pytest.mark.django_db
|
||||||
|
|
||||||
@@ -606,8 +606,8 @@ def test_marketing_signup_existing_user(
|
|||||||
mock_signup.assert_not_called()
|
mock_signup.assert_not_called()
|
||||||
|
|
||||||
|
|
||||||
@mock.patch("core.authentication.backends.get_marketing_service")
|
@mock.patch.object(create_or_update_contact, "delay")
|
||||||
def test_signup_to_marketing_email_success(mock_marketing):
|
def test_signup_to_marketing_email_success(mock_create_or_update_contact):
|
||||||
"""Test successful marketing signup."""
|
"""Test successful marketing signup."""
|
||||||
|
|
||||||
email = "test@example.com"
|
email = "test@example.com"
|
||||||
@@ -616,46 +616,6 @@ def test_signup_to_marketing_email_success(mock_marketing):
|
|||||||
OIDCAuthenticationBackend.signup_to_marketing_email(email)
|
OIDCAuthenticationBackend.signup_to_marketing_email(email)
|
||||||
|
|
||||||
# Verify service interaction
|
# Verify service interaction
|
||||||
mock_service = mock_marketing.return_value
|
mock_create_or_update_contact.assert_called_once_with(
|
||||||
mock_service.create_contact.assert_called_once()
|
email=email, attributes={"VISIO_SOURCE": ["SIGNIN"]}
|
||||||
|
)
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
|
||||||
"error",
|
|
||||||
[
|
|
||||||
ImportError,
|
|
||||||
ImproperlyConfigured,
|
|
||||||
],
|
|
||||||
)
|
|
||||||
@mock.patch("core.authentication.backends.get_marketing_service")
|
|
||||||
def test_marketing_signup_handles_service_initialization_errors(
|
|
||||||
mock_marketing, error, settings
|
|
||||||
):
|
|
||||||
"""Tests errors that occur when trying to get/initialize the marketing service."""
|
|
||||||
settings.SIGNUP_NEW_USER_TO_MARKETING_EMAIL = True
|
|
||||||
|
|
||||||
mock_marketing.side_effect = error
|
|
||||||
|
|
||||||
# Should not raise any exception
|
|
||||||
OIDCAuthenticationBackend.signup_to_marketing_email("test@example.com")
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
|
||||||
"error",
|
|
||||||
[
|
|
||||||
marketing.ContactCreationError,
|
|
||||||
ImproperlyConfigured,
|
|
||||||
ImportError,
|
|
||||||
],
|
|
||||||
)
|
|
||||||
@mock.patch("core.authentication.backends.get_marketing_service")
|
|
||||||
def test_marketing_signup_handles_contact_creation_errors(
|
|
||||||
mock_marketing, error, settings
|
|
||||||
):
|
|
||||||
"""Tests errors that occur during the contact creation process."""
|
|
||||||
|
|
||||||
settings.SIGNUP_NEW_USER_TO_MARKETING_EMAIL = True
|
|
||||||
mock_marketing.return_value.create_contact.side_effect = error
|
|
||||||
|
|
||||||
# Should not raise any exception
|
|
||||||
OIDCAuthenticationBackend.signup_to_marketing_email("test@example.com")
|
|
||||||
|
|||||||
@@ -1,212 +0,0 @@
|
|||||||
"""
|
|
||||||
Test marketing services.
|
|
||||||
"""
|
|
||||||
|
|
||||||
# pylint: disable=W0621,W0613
|
|
||||||
|
|
||||||
from unittest import mock
|
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
|
||||||
|
|
||||||
import brevo_python
|
|
||||||
import pytest
|
|
||||||
import urllib3
|
|
||||||
|
|
||||||
from core.services.marketing import (
|
|
||||||
BrevoMarketingService,
|
|
||||||
ContactCreationError,
|
|
||||||
ContactData,
|
|
||||||
get_marketing_service,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_init_missing_api_key(settings):
|
|
||||||
"""Test initialization with missing API key."""
|
|
||||||
settings.BREVO_API_KEY = None
|
|
||||||
with pytest.raises(ImproperlyConfigured, match="Brevo API key is required"):
|
|
||||||
BrevoMarketingService()
|
|
||||||
|
|
||||||
|
|
||||||
def test_create_contact_missing_list_ids(settings):
|
|
||||||
"""Test contact creation with missing list IDs."""
|
|
||||||
|
|
||||||
settings.BREVO_API_KEY = "test-api-key"
|
|
||||||
settings.BREVO_API_CONTACT_LIST_IDS = None
|
|
||||||
settings.BREVO_API_CONTACT_ATTRIBUTES = {"source": "test"}
|
|
||||||
|
|
||||||
valid_contact_data = ContactData(
|
|
||||||
email="test@example.com",
|
|
||||||
attributes={"first_name": "Test"},
|
|
||||||
list_ids=[1, 2],
|
|
||||||
update_enabled=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
brevo_service = BrevoMarketingService()
|
|
||||||
|
|
||||||
with pytest.raises(
|
|
||||||
ImproperlyConfigured, match="Default Brevo List IDs must be configured"
|
|
||||||
):
|
|
||||||
brevo_service.create_contact(valid_contact_data)
|
|
||||||
|
|
||||||
|
|
||||||
@mock.patch("brevo_python.ContactsApi")
|
|
||||||
def test_create_contact_success(mock_contact_api):
|
|
||||||
"""Test successful contact creation."""
|
|
||||||
|
|
||||||
mock_api = mock_contact_api.return_value
|
|
||||||
|
|
||||||
settings.BREVO_API_KEY = "test-api-key"
|
|
||||||
settings.BREVO_API_CONTACT_LIST_IDS = [1, 2, 3, 4]
|
|
||||||
settings.BREVO_API_CONTACT_ATTRIBUTES = {"source": "test"}
|
|
||||||
|
|
||||||
valid_contact_data = ContactData(
|
|
||||||
email="test@example.com",
|
|
||||||
attributes={"first_name": "Test"},
|
|
||||||
list_ids=[1, 2],
|
|
||||||
update_enabled=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
brevo_service = BrevoMarketingService()
|
|
||||||
|
|
||||||
mock_api.create_contact.return_value = {"id": "test-id"}
|
|
||||||
response = brevo_service.create_contact(valid_contact_data)
|
|
||||||
|
|
||||||
assert response == {"id": "test-id"}
|
|
||||||
|
|
||||||
mock_api.create_contact.assert_called_once()
|
|
||||||
contact_arg = mock_api.create_contact.call_args[0][0]
|
|
||||||
assert contact_arg.email == "test@example.com"
|
|
||||||
assert contact_arg.attributes == {
|
|
||||||
**settings.BREVO_API_CONTACT_ATTRIBUTES,
|
|
||||||
**valid_contact_data.attributes,
|
|
||||||
}
|
|
||||||
assert set(contact_arg.list_ids) == {1, 2, 3, 4}
|
|
||||||
assert contact_arg.update_enabled is True
|
|
||||||
|
|
||||||
|
|
||||||
@mock.patch("brevo_python.ContactsApi")
|
|
||||||
def test_create_contact_with_timeout(mock_contact_api):
|
|
||||||
"""Test contact creation with timeout."""
|
|
||||||
|
|
||||||
mock_api = mock_contact_api.return_value
|
|
||||||
|
|
||||||
settings.BREVO_API_KEY = "test-api-key"
|
|
||||||
settings.BREVO_API_CONTACT_LIST_IDS = [1, 2, 3, 4]
|
|
||||||
settings.BREVO_API_CONTACT_ATTRIBUTES = {"source": "test"}
|
|
||||||
|
|
||||||
valid_contact_data = ContactData(
|
|
||||||
email="test@example.com",
|
|
||||||
attributes={"first_name": "Test"},
|
|
||||||
list_ids=[1, 2],
|
|
||||||
update_enabled=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
brevo_service = BrevoMarketingService()
|
|
||||||
brevo_service.create_contact(valid_contact_data, timeout=30)
|
|
||||||
|
|
||||||
mock_api.create_contact.assert_called_once()
|
|
||||||
assert mock_api.create_contact.call_args[1]["_request_timeout"] == 30
|
|
||||||
|
|
||||||
|
|
||||||
@mock.patch("brevo_python.ContactsApi")
|
|
||||||
def test_create_contact_api_error(mock_contact_api):
|
|
||||||
"""Test contact creation API error handling."""
|
|
||||||
|
|
||||||
mock_api = mock_contact_api.return_value
|
|
||||||
|
|
||||||
settings.BREVO_API_KEY = "test-api-key"
|
|
||||||
settings.BREVO_API_CONTACT_LIST_IDS = [1, 2, 3, 4]
|
|
||||||
settings.BREVO_API_CONTACT_ATTRIBUTES = {"source": "test"}
|
|
||||||
|
|
||||||
valid_contact_data = ContactData(
|
|
||||||
email="test@example.com",
|
|
||||||
attributes={"first_name": "Test"},
|
|
||||||
list_ids=[1, 2],
|
|
||||||
update_enabled=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
brevo_service = BrevoMarketingService()
|
|
||||||
|
|
||||||
mock_api.create_contact.side_effect = brevo_python.rest.ApiException()
|
|
||||||
|
|
||||||
with pytest.raises(ContactCreationError, match="Failed to create contact in Brevo"):
|
|
||||||
brevo_service.create_contact(valid_contact_data)
|
|
||||||
|
|
||||||
|
|
||||||
@mock.patch("brevo_python.ContactsApi")
|
|
||||||
def test_create_contact_timeout_error(mock_contact_api):
|
|
||||||
"""Test contact creation timeout error handling."""
|
|
||||||
|
|
||||||
mock_api = mock_contact_api.return_value
|
|
||||||
settings.BREVO_API_KEY = "test-api-key"
|
|
||||||
settings.BREVO_API_CONTACT_LIST_IDS = [1, 2, 3, 4]
|
|
||||||
settings.BREVO_API_CONTACT_ATTRIBUTES = {"source": "test"}
|
|
||||||
|
|
||||||
valid_contact_data = ContactData(
|
|
||||||
email="test@example.com",
|
|
||||||
attributes={"first_name": "Test"},
|
|
||||||
list_ids=[1, 2],
|
|
||||||
update_enabled=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
brevo_service = BrevoMarketingService()
|
|
||||||
|
|
||||||
mock_api.create_contact.side_effect = urllib3.exceptions.ReadTimeoutError(
|
|
||||||
pool=mock.Mock(),
|
|
||||||
url="https://api.brevo.com/v3/endpoint",
|
|
||||||
message="HTTPSConnectionPool(host='api.brevo.com', port=443): Read timed out.",
|
|
||||||
)
|
|
||||||
|
|
||||||
with pytest.raises(ContactCreationError, match="Failed to create contact in Brevo"):
|
|
||||||
brevo_service.create_contact(valid_contact_data)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def clear_marketing_cache():
|
|
||||||
"""Clear marketing service cache between tests."""
|
|
||||||
get_marketing_service.cache_clear()
|
|
||||||
yield
|
|
||||||
get_marketing_service.cache_clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_get_marketing_service_caching(clear_marketing_cache):
|
|
||||||
"""Test marketing service caching behavior."""
|
|
||||||
settings.BREVO_API_KEY = "test-api-key"
|
|
||||||
settings.MARKETING_SERVICE_CLASS = "core.services.marketing.BrevoMarketingService"
|
|
||||||
|
|
||||||
service1 = get_marketing_service()
|
|
||||||
service2 = get_marketing_service()
|
|
||||||
|
|
||||||
assert service1 is service2
|
|
||||||
assert isinstance(service1, BrevoMarketingService)
|
|
||||||
|
|
||||||
|
|
||||||
def test_get_marketing_service_invalid_class(clear_marketing_cache):
|
|
||||||
"""Test handling of invalid service class."""
|
|
||||||
settings.MARKETING_SERVICE_CLASS = "invalid.service.path"
|
|
||||||
|
|
||||||
with pytest.raises(ImportError):
|
|
||||||
get_marketing_service()
|
|
||||||
|
|
||||||
|
|
||||||
@mock.patch("core.services.marketing.import_string")
|
|
||||||
def test_service_instantiation_called_once(mock_import_string, clear_marketing_cache):
|
|
||||||
"""Test service class is instantiated only once."""
|
|
||||||
|
|
||||||
settings.BREVO_API_KEY = "test-api-key"
|
|
||||||
settings.MARKETING_SERVICE_CLASS = "core.services.marketing.BrevoMarketingService"
|
|
||||||
get_marketing_service.cache_clear()
|
|
||||||
|
|
||||||
mock_service_cls = mock.Mock()
|
|
||||||
mock_service_instance = mock.Mock()
|
|
||||||
mock_service_cls.return_value = mock_service_instance
|
|
||||||
mock_import_string.return_value = mock_service_cls
|
|
||||||
|
|
||||||
service1 = get_marketing_service()
|
|
||||||
service2 = get_marketing_service()
|
|
||||||
|
|
||||||
mock_import_string.assert_called_once_with(settings.MARKETING_SERVICE_CLASS)
|
|
||||||
mock_service_cls.assert_called_once()
|
|
||||||
assert service1 is service2
|
|
||||||
assert service1 is mock_service_instance
|
|
||||||
@@ -0,0 +1,209 @@
|
|||||||
|
"""Tests for the external API MenshenAuthentication."""
|
||||||
|
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
import responses
|
||||||
|
from lasuite.oidc_resource_server.authentication import ResourceServerAuthentication
|
||||||
|
from rest_framework.test import APIClient
|
||||||
|
|
||||||
|
from core.factories import UserFactory
|
||||||
|
from core.models import RoleChoices, Room, User
|
||||||
|
|
||||||
|
pytestmark = pytest.mark.django_db
|
||||||
|
|
||||||
|
SERVER_URL = "https://menshen.example.com"
|
||||||
|
INTROSPECTION_ENDPOINT = f"{SERVER_URL}/auth/token/introspect/"
|
||||||
|
TOKEN = "menshen-exchanged-token"
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def menshen_settings(settings):
|
||||||
|
"""Enable Menshen authentication."""
|
||||||
|
settings.MENSHEN_ENABLED = True
|
||||||
|
settings.MENSHEN_SERVER_URL = SERVER_URL
|
||||||
|
settings.MENSHEN_CLIENT_ID = "meet"
|
||||||
|
settings.MENSHEN_CLIENT_SECRET = "meet-secret"
|
||||||
|
|
||||||
|
|
||||||
|
def _introspection(sub, scope="meet:room:create", **overrides):
|
||||||
|
return {
|
||||||
|
"active": True,
|
||||||
|
"sub": sub,
|
||||||
|
"email": "user@example.com",
|
||||||
|
"scope": scope,
|
||||||
|
"aud": "meet",
|
||||||
|
"client_id": "menshen",
|
||||||
|
**overrides,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def _create_room():
|
||||||
|
client = APIClient()
|
||||||
|
client.credentials(HTTP_AUTHORIZATION=f"Bearer {TOKEN}")
|
||||||
|
return client.post("/external-api/v1.0/rooms/", {}, format="json")
|
||||||
|
|
||||||
|
|
||||||
|
@responses.activate
|
||||||
|
def test_menshen_active_token():
|
||||||
|
"""An active token with a mapped scope should create a room owned by the user."""
|
||||||
|
|
||||||
|
user = UserFactory()
|
||||||
|
|
||||||
|
# Catch and mock external HTTP requests
|
||||||
|
responses.add(
|
||||||
|
responses.POST,
|
||||||
|
INTROSPECTION_ENDPOINT,
|
||||||
|
json=_introspection(user.sub),
|
||||||
|
match=[responses.matchers.urlencoded_params_matcher({"token": TOKEN})],
|
||||||
|
)
|
||||||
|
|
||||||
|
response = _create_room()
|
||||||
|
|
||||||
|
assert response.status_code == 201
|
||||||
|
room = Room.objects.get(id=response.data["id"])
|
||||||
|
assert room.get_role(user) == RoleChoices.OWNER
|
||||||
|
assert responses.calls[0].request.headers["Authorization"].startswith("Basic ")
|
||||||
|
|
||||||
|
|
||||||
|
@responses.activate
|
||||||
|
@mock.patch.object(ResourceServerAuthentication, "authenticate", return_value=None)
|
||||||
|
def test_menshen_disabled(mock_rs_authenticate, settings):
|
||||||
|
"""Menshen should not be called when disabled."""
|
||||||
|
|
||||||
|
settings.MENSHEN_ENABLED = False
|
||||||
|
|
||||||
|
response = _create_room()
|
||||||
|
|
||||||
|
assert response.status_code == 401
|
||||||
|
assert len(responses.calls) == 0
|
||||||
|
mock_rs_authenticate.assert_called_once()
|
||||||
|
|
||||||
|
|
||||||
|
@responses.activate
|
||||||
|
@mock.patch.object(ResourceServerAuthentication, "authenticate", return_value=None)
|
||||||
|
def test_menshen_inactive_token_defers(mock_rs_authenticate):
|
||||||
|
"""An inactive token should defer to the next authentication backend."""
|
||||||
|
|
||||||
|
user = UserFactory()
|
||||||
|
|
||||||
|
responses.add(
|
||||||
|
responses.POST,
|
||||||
|
INTROSPECTION_ENDPOINT,
|
||||||
|
json=_introspection(user.sub, scope="meet:room:create", active=False),
|
||||||
|
)
|
||||||
|
|
||||||
|
response = _create_room()
|
||||||
|
|
||||||
|
assert response.status_code == 401
|
||||||
|
mock_rs_authenticate.assert_called_once()
|
||||||
|
|
||||||
|
|
||||||
|
@responses.activate
|
||||||
|
@mock.patch.object(ResourceServerAuthentication, "authenticate", return_value=None)
|
||||||
|
def test_menshen_error_defers(mock_rs_authenticate):
|
||||||
|
"""A Menshen error should defer to the next authentication backend."""
|
||||||
|
|
||||||
|
responses.add(responses.POST, INTROSPECTION_ENDPOINT, status=500)
|
||||||
|
|
||||||
|
response = _create_room()
|
||||||
|
|
||||||
|
assert response.status_code == 401
|
||||||
|
mock_rs_authenticate.assert_called_once()
|
||||||
|
|
||||||
|
|
||||||
|
@responses.activate
|
||||||
|
@mock.patch.object(ResourceServerAuthentication, "authenticate", return_value=None)
|
||||||
|
def test_menshen_unparsable_response_defers(mock_rs_authenticate):
|
||||||
|
"""A response the client can't parse should defer to the next backend."""
|
||||||
|
|
||||||
|
responses.add(
|
||||||
|
responses.POST,
|
||||||
|
INTROSPECTION_ENDPOINT,
|
||||||
|
json={"active": True, "unexpected": "field"},
|
||||||
|
)
|
||||||
|
|
||||||
|
response = _create_room()
|
||||||
|
|
||||||
|
assert response.status_code == 401
|
||||||
|
mock_rs_authenticate.assert_called_once()
|
||||||
|
|
||||||
|
|
||||||
|
@responses.activate
|
||||||
|
def test_menshen_unmapped_scope():
|
||||||
|
"""Scopes granted for other services or other Meet actions should not grant access."""
|
||||||
|
|
||||||
|
user = UserFactory()
|
||||||
|
|
||||||
|
responses.add(
|
||||||
|
responses.POST,
|
||||||
|
INTROSPECTION_ENDPOINT,
|
||||||
|
json=_introspection(user.sub, scope="drive:item:create meet:room:list"),
|
||||||
|
)
|
||||||
|
|
||||||
|
response = _create_room()
|
||||||
|
|
||||||
|
assert response.status_code == 403
|
||||||
|
assert "insufficient permissions." in str(response.data).lower()
|
||||||
|
assert not Room.objects.exists()
|
||||||
|
|
||||||
|
|
||||||
|
@responses.activate
|
||||||
|
def test_menshen_missing_sub():
|
||||||
|
"""An active token without sub should be rejected."""
|
||||||
|
|
||||||
|
responses.add(responses.POST, INTROSPECTION_ENDPOINT, json=_introspection(None))
|
||||||
|
|
||||||
|
response = _create_room()
|
||||||
|
|
||||||
|
assert response.status_code == 401
|
||||||
|
assert "invalid token claims." in str(response.data).lower()
|
||||||
|
|
||||||
|
|
||||||
|
@responses.activate
|
||||||
|
def test_menshen_inactive_user():
|
||||||
|
"""An active token for an inactive user should be rejected."""
|
||||||
|
|
||||||
|
user = UserFactory(is_active=False)
|
||||||
|
|
||||||
|
responses.add(responses.POST, INTROSPECTION_ENDPOINT, json=_introspection(user.sub))
|
||||||
|
|
||||||
|
response = _create_room()
|
||||||
|
|
||||||
|
assert response.status_code == 401
|
||||||
|
assert "user account is disabled." in str(response.data).lower()
|
||||||
|
|
||||||
|
|
||||||
|
@responses.activate
|
||||||
|
def test_menshen_unknown_user_created(settings):
|
||||||
|
"""An unknown sub should create a user when OIDC_CREATE_USER is set."""
|
||||||
|
|
||||||
|
settings.OIDC_CREATE_USER = True
|
||||||
|
|
||||||
|
responses.add(
|
||||||
|
responses.POST, INTROSPECTION_ENDPOINT, json=_introspection("new-sub")
|
||||||
|
)
|
||||||
|
|
||||||
|
response = _create_room()
|
||||||
|
|
||||||
|
assert response.status_code == 201
|
||||||
|
user = User.objects.get(sub="new-sub")
|
||||||
|
assert user.email == "user@example.com"
|
||||||
|
assert user.is_active is True
|
||||||
|
|
||||||
|
|
||||||
|
@responses.activate
|
||||||
|
def test_menshen_unknown_user_not_created(settings):
|
||||||
|
"""An unknown sub should be rejected when OIDC_CREATE_USER is unset."""
|
||||||
|
|
||||||
|
settings.OIDC_CREATE_USER = False
|
||||||
|
|
||||||
|
responses.add(
|
||||||
|
responses.POST, INTROSPECTION_ENDPOINT, json=_introspection("new-sub")
|
||||||
|
)
|
||||||
|
|
||||||
|
response = _create_room()
|
||||||
|
|
||||||
|
assert response.status_code == 401
|
||||||
|
assert "user not found." in str(response.data).lower()
|
||||||
|
assert not User.objects.filter(sub="new-sub").exists()
|
||||||
@@ -702,6 +702,20 @@ class Base(Configuration):
|
|||||||
default=None, environ_name="OIDC_RS_SCOPES_PREFIX", environ_prefix=None
|
default=None, environ_name="OIDC_RS_SCOPES_PREFIX", environ_prefix=None
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Menshen, La Suite's OAuth 2.0 token exchange server
|
||||||
|
MENSHEN_ENABLED = values.BooleanValue(
|
||||||
|
False, environ_name="MENSHEN_ENABLED", environ_prefix=None
|
||||||
|
)
|
||||||
|
MENSHEN_SERVER_URL = values.Value(
|
||||||
|
None, environ_name="MENSHEN_SERVER_URL", environ_prefix=None
|
||||||
|
)
|
||||||
|
MENSHEN_CLIENT_ID = values.Value(
|
||||||
|
None, environ_name="MENSHEN_CLIENT_ID", environ_prefix=None
|
||||||
|
)
|
||||||
|
MENSHEN_CLIENT_SECRET = SecretFileValue(
|
||||||
|
None, environ_name="MENSHEN_CLIENT_SECRET", environ_prefix=None
|
||||||
|
)
|
||||||
|
|
||||||
# Video conference configuration
|
# Video conference configuration
|
||||||
LIVEKIT_CONFIGURATION = {
|
LIVEKIT_CONFIGURATION = {
|
||||||
"api_key": SecretFileValue(environ_name="LIVEKIT_API_KEY", environ_prefix=None),
|
"api_key": SecretFileValue(environ_name="LIVEKIT_API_KEY", environ_prefix=None),
|
||||||
@@ -938,24 +952,18 @@ class Base(Configuration):
|
|||||||
environ_name="SIGNUP_NEW_USER_TO_MARKETING_EMAIL",
|
environ_name="SIGNUP_NEW_USER_TO_MARKETING_EMAIL",
|
||||||
environ_prefix=None,
|
environ_prefix=None,
|
||||||
)
|
)
|
||||||
MARKETING_SERVICE_CLASS = values.Value(
|
LASUITE_MARKETING = {
|
||||||
"core.services.marketing.BrevoMarketingService",
|
"BACKEND": values.Value(
|
||||||
environ_name="MARKETING_SERVICE_CLASS",
|
"lasuite.marketing.backends.dummy.DummyBackend",
|
||||||
environ_prefix=None,
|
environ_name="LASUITE_MARKETING_BACKEND",
|
||||||
)
|
environ_prefix=None,
|
||||||
BREVO_API_KEY = SecretFileValue(
|
),
|
||||||
None, environ_name="BREVO_API_KEY", environ_prefix=None
|
"PARAMETERS": values.DictValue(
|
||||||
)
|
default={},
|
||||||
BREVO_API_CONTACT_LIST_IDS = values.ListValue(
|
environ_name="LASUITE_MARKETING_PARAMETERS",
|
||||||
[],
|
environ_prefix=None,
|
||||||
environ_name="BREVO_API_CONTACT_LIST_IDS",
|
),
|
||||||
environ_prefix=None,
|
}
|
||||||
converter=int,
|
|
||||||
)
|
|
||||||
BREVO_API_CONTACT_ATTRIBUTES = values.DictValue({"VISIO_USER": True})
|
|
||||||
BREVO_API_TIMEOUT = values.PositiveIntegerValue(
|
|
||||||
1, environ_name="BREVO_API_TIMEOUT", environ_prefix=None
|
|
||||||
)
|
|
||||||
|
|
||||||
# Lobby configurations
|
# Lobby configurations
|
||||||
PRESENCE_KEY_PREFIX = values.Value(
|
PRESENCE_KEY_PREFIX = values.Value(
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ dependencies = [
|
|||||||
"gunicorn==26.2.0",
|
"gunicorn==26.2.0",
|
||||||
"jsonschema==4.26.0",
|
"jsonschema==4.26.0",
|
||||||
"markdown==3.10.3",
|
"markdown==3.10.3",
|
||||||
|
"menshen-client==0.1.0",
|
||||||
"nested-multipart-parser==1.6.0",
|
"nested-multipart-parser==1.6.0",
|
||||||
"posthog==7.44.0",
|
"posthog==7.44.0",
|
||||||
"psycopg[binary]==3.3.4",
|
"psycopg[binary]==3.3.4",
|
||||||
|
|||||||
Generated
+14
@@ -1327,6 +1327,7 @@ dependencies = [
|
|||||||
{ name = "jsonschema" },
|
{ name = "jsonschema" },
|
||||||
{ name = "livekit-api" },
|
{ name = "livekit-api" },
|
||||||
{ name = "markdown" },
|
{ name = "markdown" },
|
||||||
|
{ name = "menshen-client" },
|
||||||
{ name = "mozilla-django-oidc" },
|
{ name = "mozilla-django-oidc" },
|
||||||
{ name = "nested-multipart-parser" },
|
{ name = "nested-multipart-parser" },
|
||||||
{ name = "phonenumbers" },
|
{ name = "phonenumbers" },
|
||||||
@@ -1392,6 +1393,7 @@ requires-dist = [
|
|||||||
{ name = "jsonschema", specifier = "==4.26.0" },
|
{ name = "jsonschema", specifier = "==4.26.0" },
|
||||||
{ name = "livekit-api", specifier = "==1.2.0" },
|
{ name = "livekit-api", specifier = "==1.2.0" },
|
||||||
{ name = "markdown", specifier = "==3.10.3" },
|
{ name = "markdown", specifier = "==3.10.3" },
|
||||||
|
{ name = "menshen-client", specifier = "==0.1.0" },
|
||||||
{ name = "mozilla-django-oidc", specifier = "==5.0.2" },
|
{ name = "mozilla-django-oidc", specifier = "==5.0.2" },
|
||||||
{ name = "nested-multipart-parser", specifier = "==1.6.0" },
|
{ name = "nested-multipart-parser", specifier = "==1.6.0" },
|
||||||
{ name = "phonenumbers", specifier = "==9.0.37" },
|
{ name = "phonenumbers", specifier = "==9.0.37" },
|
||||||
@@ -1428,6 +1430,18 @@ dev = [
|
|||||||
{ name = "types-requests", specifier = "==2.33.0.20260712" },
|
{ name = "types-requests", specifier = "==2.33.0.20260712" },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "menshen-client"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "requests" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/53/d5/c2be400c190efe26b70e5c60dd9d9ab279ece3b51de457abc184a238c727/menshen_client-0.1.0.tar.gz", hash = "sha256:21fe48788e860c7f2e103787ce0827981e9059146cf7bdb9ac1a8778acb9ff77", size = 6219, upload-time = "2026-09-21T21:04:01.677Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d6/bf/11d15da4852b8344eb9f30861bd15a8f1d931ff4232d9b7de18fce09fd3c/menshen_client-0.1.0-py3-none-any.whl", hash = "sha256:d0dfb351812bb93620a4796e0f0ce1a40e8ec859dc8de2a1f50ae7f306d4d29a", size = 7040, upload-time = "2026-09-21T21:04:00.433Z" },
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mozilla-django-oidc"
|
name = "mozilla-django-oidc"
|
||||||
version = "5.0.2"
|
version = "5.0.2"
|
||||||
|
|||||||
@@ -19,7 +19,9 @@ export const LoadingScreen = ({
|
|||||||
<Screen layout={layout} header={header} footer={footer}>
|
<Screen layout={layout} header={header} footer={footer}>
|
||||||
<CenteredContent>
|
<CenteredContent>
|
||||||
<Center>
|
<Center>
|
||||||
<p>{t('loading')}</p>
|
<p role="status" aria-live="polite">
|
||||||
|
{t('loading')}
|
||||||
|
</p>
|
||||||
</Center>
|
</Center>
|
||||||
</CenteredContent>
|
</CenteredContent>
|
||||||
</Screen>
|
</Screen>
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import { useIsSpeaking, useRoomContext } from '@livekit/components-react'
|
||||||
|
import { useEffect, useState } from 'react'
|
||||||
|
import { useRaisedHand } from '@/features/rooms/livekit/hooks/useRaisedHand'
|
||||||
|
import {
|
||||||
|
closeLowerHandToasts,
|
||||||
|
showLowerHandToast,
|
||||||
|
} from '@/features/notifications/utils'
|
||||||
|
|
||||||
|
const SPEAKING_DETECTION_DELAY = 3000
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Offers to lower the local participant's raised hand after
|
||||||
|
* SPEAKING_DETECTION_DELAY of speaking. Mount it once: each copy runs its own
|
||||||
|
* timer and shows its own toast.
|
||||||
|
*/
|
||||||
|
export const LowerHandOnSpeaking = () => {
|
||||||
|
const room = useRoomContext()
|
||||||
|
const { isHandRaised, lowerHand } = useRaisedHand({
|
||||||
|
participant: room.localParticipant,
|
||||||
|
})
|
||||||
|
const isSpeaking = useIsSpeaking(room.localParticipant)
|
||||||
|
const [hasOffered, setHasOffered] = useState(false)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (isHandRaised) return
|
||||||
|
setHasOffered(false)
|
||||||
|
closeLowerHandToasts()
|
||||||
|
}, [isHandRaised])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!isSpeaking || !isHandRaised || hasOffered) return
|
||||||
|
|
||||||
|
const timer = setTimeout(() => {
|
||||||
|
setHasOffered(true)
|
||||||
|
showLowerHandToast(room.localParticipant, lowerHand)
|
||||||
|
}, SPEAKING_DETECTION_DELAY)
|
||||||
|
|
||||||
|
return () => clearTimeout(timer)
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [isSpeaking, isHandRaised, hasOffered])
|
||||||
|
|
||||||
|
return null
|
||||||
|
}
|
||||||
@@ -2,19 +2,12 @@ import { useTranslation } from 'react-i18next'
|
|||||||
import { RiHand } from '@remixicon/react'
|
import { RiHand } from '@remixicon/react'
|
||||||
import { ToggleButton } from '@/primitives'
|
import { ToggleButton } from '@/primitives'
|
||||||
import { css } from '@/styled-system/css'
|
import { css } from '@/styled-system/css'
|
||||||
import { useIsSpeaking, useRoomContext } from '@livekit/components-react'
|
import { useRoomContext } from '@livekit/components-react'
|
||||||
import { useRaisedHand } from '@/features/rooms/livekit/hooks/useRaisedHand'
|
import { useRaisedHand } from '@/features/rooms/livekit/hooks/useRaisedHand'
|
||||||
import { useEffect, useRef, useState } from 'react'
|
|
||||||
import {
|
|
||||||
closeLowerHandToasts,
|
|
||||||
showLowerHandToast,
|
|
||||||
} from '@/features/notifications/utils'
|
|
||||||
import { useRegisterKeyboardShortcut } from '@/features/shortcuts/useRegisterKeyboardShortcut'
|
import { useRegisterKeyboardShortcut } from '@/features/shortcuts/useRegisterKeyboardShortcut'
|
||||||
import { type ButtonRecipeProps } from '@/primitives/buttonRecipe'
|
import { type ButtonRecipeProps } from '@/primitives/buttonRecipe'
|
||||||
import { ToggleButtonProps } from '@/primitives/ToggleButton'
|
import { ToggleButtonProps } from '@/primitives/ToggleButton'
|
||||||
|
|
||||||
const SPEAKING_DETECTION_DELAY = 3000
|
|
||||||
|
|
||||||
type Props = Pick<NonNullable<ButtonRecipeProps>, 'variant'> & ToggleButtonProps
|
type Props = Pick<NonNullable<ButtonRecipeProps>, 'variant'> & ToggleButtonProps
|
||||||
|
|
||||||
export const HandToggle = ({
|
export const HandToggle = ({
|
||||||
@@ -25,64 +18,15 @@ export const HandToggle = ({
|
|||||||
const { t } = useTranslation('rooms', { keyPrefix: 'controls.hand' })
|
const { t } = useTranslation('rooms', { keyPrefix: 'controls.hand' })
|
||||||
|
|
||||||
const room = useRoomContext()
|
const room = useRoomContext()
|
||||||
const { isHandRaised, toggleRaisedHand, lowerHand } = useRaisedHand({
|
const { isHandRaised, toggleRaisedHand } = useRaisedHand({
|
||||||
participant: room.localParticipant,
|
participant: room.localParticipant,
|
||||||
})
|
})
|
||||||
|
|
||||||
const isSpeaking = useIsSpeaking(room.localParticipant)
|
|
||||||
const speakingTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)
|
|
||||||
const [hasShownToast, setHasShownToast] = useState(false)
|
|
||||||
|
|
||||||
const resetToastState = () => {
|
|
||||||
setHasShownToast(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (isHandRaised) return
|
|
||||||
closeLowerHandToasts()
|
|
||||||
}, [isHandRaised])
|
|
||||||
|
|
||||||
const handleToggle = () => {
|
|
||||||
toggleRaisedHand()
|
|
||||||
resetToastState()
|
|
||||||
}
|
|
||||||
|
|
||||||
useRegisterKeyboardShortcut({
|
useRegisterKeyboardShortcut({
|
||||||
id: 'raise-hand',
|
id: 'raise-hand',
|
||||||
handler: handleToggle,
|
handler: toggleRaisedHand,
|
||||||
})
|
})
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const shouldShowToast = isSpeaking && isHandRaised && !hasShownToast
|
|
||||||
|
|
||||||
if (shouldShowToast && !speakingTimerRef.current) {
|
|
||||||
speakingTimerRef.current = setTimeout(() => {
|
|
||||||
speakingTimerRef.current = null
|
|
||||||
setHasShownToast(true)
|
|
||||||
const onClose = () => {
|
|
||||||
lowerHand()
|
|
||||||
resetToastState()
|
|
||||||
}
|
|
||||||
showLowerHandToast(room.localParticipant, onClose)
|
|
||||||
}, SPEAKING_DETECTION_DELAY)
|
|
||||||
}
|
|
||||||
if ((!isSpeaking || !isHandRaised) && speakingTimerRef.current) {
|
|
||||||
clearTimeout(speakingTimerRef.current)
|
|
||||||
speakingTimerRef.current = null
|
|
||||||
}
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [isSpeaking, isHandRaised, hasShownToast, lowerHand])
|
|
||||||
|
|
||||||
// Clear any pending timer on unmount
|
|
||||||
useEffect(() => {
|
|
||||||
return () => {
|
|
||||||
if (speakingTimerRef.current) {
|
|
||||||
clearTimeout(speakingTimerRef.current)
|
|
||||||
speakingTimerRef.current = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
const tooltipLabel = isHandRaised ? 'lower' : 'raise'
|
const tooltipLabel = isHandRaised ? 'lower' : 'raise'
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -100,7 +44,7 @@ export const HandToggle = ({
|
|||||||
tooltip={t(tooltipLabel)}
|
tooltip={t(tooltipLabel)}
|
||||||
isSelected={isHandRaised}
|
isSelected={isHandRaised}
|
||||||
onPress={(e) => {
|
onPress={(e) => {
|
||||||
handleToggle()
|
toggleRaisedHand()
|
||||||
onPress?.(e)
|
onPress?.(e)
|
||||||
}}
|
}}
|
||||||
data-attr={`controls-hand-${tooltipLabel}`}
|
data-attr={`controls-hand-${tooltipLabel}`}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import { PinAnnouncer } from '@/features/layout/components/PinAnnouncer'
|
|||||||
import { ChatProvider } from '@/features/chat/components/ChatProvider'
|
import { ChatProvider } from '@/features/chat/components/ChatProvider'
|
||||||
import { SyncDevicePreferences } from '@/features/rooms/livekit/components/SyncDevicePreferences'
|
import { SyncDevicePreferences } from '@/features/rooms/livekit/components/SyncDevicePreferences'
|
||||||
import { RoomSilentMicDetector } from '@/features/rooms/components/SilentMicDetector'
|
import { RoomSilentMicDetector } from '@/features/rooms/components/SilentMicDetector'
|
||||||
|
import { LowerHandOnSpeaking } from '@/features/rooms/livekit/components/LowerHandOnSpeaking'
|
||||||
import { LobbyProvider } from '@/features/rooms/components/LobbyProvider'
|
import { LobbyProvider } from '@/features/rooms/components/LobbyProvider'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -119,6 +120,7 @@ export function VideoConference({ ...props }: VideoConferenceProps) {
|
|||||||
<ConnectionObserver />
|
<ConnectionObserver />
|
||||||
<SyncDevicePreferences />
|
<SyncDevicePreferences />
|
||||||
<RoomSilentMicDetector />
|
<RoomSilentMicDetector />
|
||||||
|
<LowerHandOnSpeaking />
|
||||||
<MediaStateObserver />
|
<MediaStateObserver />
|
||||||
<ChatProvider />
|
<ChatProvider />
|
||||||
<LobbyProvider />
|
<LobbyProvider />
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ spec:
|
|||||||
args:
|
args:
|
||||||
{{- toYaml . | nindent 12 }}
|
{{- toYaml . | nindent 12 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- with .Values.agentMetadata.envFrom }}
|
||||||
|
envFrom:
|
||||||
|
{{- toYaml . | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
env:
|
env:
|
||||||
{{- if $envVars }}
|
{{- if $envVars }}
|
||||||
{{- $envVars | indent 12 }}
|
{{- $envVars | indent 12 }}
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ spec:
|
|||||||
args:
|
args:
|
||||||
{{- toYaml . | nindent 12 }}
|
{{- toYaml . | nindent 12 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- with .Values.agentSubtitles.envFrom }}
|
||||||
|
envFrom:
|
||||||
|
{{- toYaml . | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
env:
|
env:
|
||||||
{{- if $envVars }}
|
{{- if $envVars }}
|
||||||
{{- $envVars | indent 12 }}
|
{{- $envVars | indent 12 }}
|
||||||
|
|||||||
@@ -41,6 +41,10 @@ items:
|
|||||||
imagePullPolicy: {{ ($.Values.backend.image | default dict).pullPolicy | default $.Values.image.pullPolicy }}
|
imagePullPolicy: {{ ($.Values.backend.image | default dict).pullPolicy | default $.Values.image.pullPolicy }}
|
||||||
args:
|
args:
|
||||||
{{- toYaml .command | nindent 22 }}
|
{{- toYaml .command | nindent 22 }}
|
||||||
|
{{- with $.Values.backend.envFrom }}
|
||||||
|
envFrom:
|
||||||
|
{{- toYaml . | nindent 20 }}
|
||||||
|
{{- end }}
|
||||||
env:
|
env:
|
||||||
{{- if $envVars}}
|
{{- if $envVars}}
|
||||||
{{- $envVars | indent 22 }}
|
{{- $envVars | indent 22 }}
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ spec:
|
|||||||
args:
|
args:
|
||||||
{{- toYaml . | nindent 12 }}
|
{{- toYaml . | nindent 12 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- with .Values.backend.envFrom }}
|
||||||
|
envFrom:
|
||||||
|
{{- toYaml . | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
env:
|
env:
|
||||||
{{- if $envVars }}
|
{{- if $envVars }}
|
||||||
{{- $envVars | indent 12 }}
|
{{- $envVars | indent 12 }}
|
||||||
|
|||||||
@@ -49,6 +49,10 @@ spec:
|
|||||||
args:
|
args:
|
||||||
{{- toYaml . | nindent 12 }}
|
{{- toYaml . | nindent 12 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- with .Values.backend.envFrom }}
|
||||||
|
envFrom:
|
||||||
|
{{- toYaml . | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
env:
|
env:
|
||||||
{{- if $envVars }}
|
{{- if $envVars }}
|
||||||
{{- $envVars | indent 12 }}
|
{{- $envVars | indent 12 }}
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ spec:
|
|||||||
args:
|
args:
|
||||||
{{- toYaml . | nindent 12 }}
|
{{- toYaml . | nindent 12 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- with .Values.backend.envFrom }}
|
||||||
|
envFrom:
|
||||||
|
{{- toYaml . | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
env:
|
env:
|
||||||
{{- if $envVars }}
|
{{- if $envVars }}
|
||||||
{{- $envVars | indent 12 }}
|
{{- $envVars | indent 12 }}
|
||||||
|
|||||||
@@ -49,6 +49,10 @@ spec:
|
|||||||
args:
|
args:
|
||||||
{{- toYaml . | nindent 12 }}
|
{{- toYaml . | nindent 12 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- with .Values.backend.envFrom }}
|
||||||
|
envFrom:
|
||||||
|
{{- toYaml . | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
env:
|
env:
|
||||||
{{- if $envVars }}
|
{{- if $envVars }}
|
||||||
{{- $envVars | indent 12 }}
|
{{- $envVars | indent 12 }}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
{{- $envVars := include "meet.env.transformDict" (mergeOverwrite (default dict .Values.backend.envVars) (default dict .Values.celeryBackend.envVars)) -}}
|
{{- $envVars := include "meet.env.transformDict" (mergeOverwrite (default dict .Values.backend.envVars) (default dict .Values.celeryBackend.envVars)) -}}
|
||||||
|
{{- $envFrom := concat (default (list) .Values.backend.envFrom) (default (list) .Values.celeryBackend.envFrom) -}}
|
||||||
{{- $fullName := include "meet.celeryBackend.fullname" . -}}
|
{{- $fullName := include "meet.celeryBackend.fullname" . -}}
|
||||||
{{- $component := "celery-backend" -}}
|
{{- $component := "celery-backend" -}}
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
@@ -50,6 +51,10 @@ spec:
|
|||||||
args:
|
args:
|
||||||
{{- toYaml . | nindent 12 }}
|
{{- toYaml . | nindent 12 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- with $envFrom }}
|
||||||
|
envFrom:
|
||||||
|
{{- toYaml . | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
env:
|
env:
|
||||||
{{- if $envVars }}
|
{{- if $envVars }}
|
||||||
{{- $envVars | indent 12 }}
|
{{- $envVars | indent 12 }}
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ spec:
|
|||||||
args:
|
args:
|
||||||
{{- toYaml . | nindent 12 }}
|
{{- toYaml . | nindent 12 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- with .Values.celerySummarize.envFrom }}
|
||||||
|
envFrom:
|
||||||
|
{{- toYaml . | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
env:
|
env:
|
||||||
{{- if $envVars }}
|
{{- if $envVars }}
|
||||||
{{- $envVars | indent 12 }}
|
{{- $envVars | indent 12 }}
|
||||||
|
|||||||
@@ -46,6 +46,10 @@ spec:
|
|||||||
args:
|
args:
|
||||||
{{- toYaml . | nindent 12 }}
|
{{- toYaml . | nindent 12 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- with .Values.celerySummaryBackend.envFrom }}
|
||||||
|
envFrom:
|
||||||
|
{{- toYaml . | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
env:
|
env:
|
||||||
{{- if $envVars }}
|
{{- if $envVars }}
|
||||||
{{- $envVars | indent 12 }}
|
{{- $envVars | indent 12 }}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
{{- $sharedEnvVars := default (dict) .Values.celeryTranscribe.envVars -}}
|
{{- $sharedEnvVars := default (dict) .Values.celeryTranscribe.envVars -}}
|
||||||
|
{{- $sharedEnvFrom := default (list) .Values.celeryTranscribe.envFrom -}}
|
||||||
{{- $component := "celery-transcribe" -}}
|
{{- $component := "celery-transcribe" -}}
|
||||||
|
|
||||||
{{- range $idx, $instance := .Values.celeryTranscribe.instances }}
|
{{- range $idx, $instance := .Values.celeryTranscribe.instances }}
|
||||||
@@ -6,6 +7,8 @@
|
|||||||
{{- $fullName := printf "%s-%s" (include "meet.celeryTranscribe.fullname" $) $instance.name }}
|
{{- $fullName := printf "%s-%s" (include "meet.celeryTranscribe.fullname" $) $instance.name }}
|
||||||
{{- $extraInstanceEnvVars := default (dict) $instance.extraEnvVars -}}
|
{{- $extraInstanceEnvVars := default (dict) $instance.extraEnvVars -}}
|
||||||
{{- $mergedInstanceEnvVars := merge $extraInstanceEnvVars $sharedEnvVars -}}
|
{{- $mergedInstanceEnvVars := merge $extraInstanceEnvVars $sharedEnvVars -}}
|
||||||
|
{{- $extraInstanceEnvFrom := default (list) $instance.extraEnvFrom -}}
|
||||||
|
{{- $envFrom := concat $sharedEnvFrom $extraInstanceEnvFrom -}}
|
||||||
{{- $fakeInstanceObjectForEnvHelper := dict "envVars" $mergedInstanceEnvVars -}}
|
{{- $fakeInstanceObjectForEnvHelper := dict "envVars" $mergedInstanceEnvVars -}}
|
||||||
{{- $envVars := include "meet.common.env" (list . $fakeInstanceObjectForEnvHelper) -}}
|
{{- $envVars := include "meet.common.env" (list . $fakeInstanceObjectForEnvHelper) -}}
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
@@ -60,6 +63,10 @@ spec:
|
|||||||
args:
|
args:
|
||||||
{{- toYaml . | nindent 12 }}
|
{{- toYaml . | nindent 12 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- with $envFrom }}
|
||||||
|
envFrom:
|
||||||
|
{{- toYaml . | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
env:
|
env:
|
||||||
{{- if $envVars }}
|
{{- if $envVars }}
|
||||||
{{- $envVars | indent 12 }}
|
{{- $envVars | indent 12 }}
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ spec:
|
|||||||
args:
|
args:
|
||||||
{{- toYaml . | nindent 12 }}
|
{{- toYaml . | nindent 12 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- with .Values.frontend.envFrom }}
|
||||||
|
envFrom:
|
||||||
|
{{- toYaml . | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
env:
|
env:
|
||||||
{{- if $envVars }}
|
{{- if $envVars }}
|
||||||
{{- $envVars | indent 12 }}
|
{{- $envVars | indent 12 }}
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ spec:
|
|||||||
args:
|
args:
|
||||||
{{- toYaml . | nindent 12 }}
|
{{- toYaml . | nindent 12 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- with .Values.summary.envFrom }}
|
||||||
|
envFrom:
|
||||||
|
{{- toYaml . | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
env:
|
env:
|
||||||
{{- if $envVars }}
|
{{- if $envVars }}
|
||||||
{{- $envVars | indent 12 }}
|
{{- $envVars | indent 12 }}
|
||||||
|
|||||||
@@ -232,6 +232,9 @@ backend:
|
|||||||
envVars:
|
envVars:
|
||||||
<<: *commonEnvVars
|
<<: *commonEnvVars
|
||||||
|
|
||||||
|
## @param backend.envFrom Import environment variables from ConfigMaps or Secrets
|
||||||
|
envFrom: []
|
||||||
|
|
||||||
## @param backend.podAnnotations Annotations to add to the backend Pod
|
## @param backend.podAnnotations Annotations to add to the backend Pod
|
||||||
podAnnotations: {}
|
podAnnotations: {}
|
||||||
|
|
||||||
@@ -433,6 +436,9 @@ frontend:
|
|||||||
envVars:
|
envVars:
|
||||||
<<: *commonEnvVars
|
<<: *commonEnvVars
|
||||||
|
|
||||||
|
## @param frontend.envFrom Import environment variables from ConfigMaps or Secrets
|
||||||
|
envFrom: []
|
||||||
|
|
||||||
## @param frontend.podAnnotations Annotations to add to the frontend Pod
|
## @param frontend.podAnnotations Annotations to add to the frontend Pod
|
||||||
podAnnotations: {}
|
podAnnotations: {}
|
||||||
|
|
||||||
@@ -624,6 +630,9 @@ summary:
|
|||||||
envVars:
|
envVars:
|
||||||
<<: *commonEnvVars
|
<<: *commonEnvVars
|
||||||
|
|
||||||
|
## @param summary.envFrom Import environment variables from ConfigMaps or Secrets
|
||||||
|
envFrom: []
|
||||||
|
|
||||||
## @param summary.podAnnotations Annotations to add to the summary Pod
|
## @param summary.podAnnotations Annotations to add to the summary Pod
|
||||||
podAnnotations: {}
|
podAnnotations: {}
|
||||||
|
|
||||||
@@ -751,6 +760,9 @@ celeryBackend:
|
|||||||
envVars:
|
envVars:
|
||||||
<<: *commonEnvVars
|
<<: *commonEnvVars
|
||||||
|
|
||||||
|
## @param celeryBackend.envFrom Import additional environment variables from ConfigMaps or Secrets
|
||||||
|
envFrom: []
|
||||||
|
|
||||||
## @param celeryBackend.podAnnotations Annotations to add to the celeryBackend Pod
|
## @param celeryBackend.podAnnotations Annotations to add to the celeryBackend Pod
|
||||||
podAnnotations: {}
|
podAnnotations: {}
|
||||||
|
|
||||||
@@ -863,6 +875,9 @@ celeryTranscribe:
|
|||||||
envVars:
|
envVars:
|
||||||
<<: *commonEnvVars
|
<<: *commonEnvVars
|
||||||
|
|
||||||
|
## @param celeryTranscribe.envFrom Import environment variables from ConfigMaps or Secrets
|
||||||
|
envFrom: []
|
||||||
|
|
||||||
## @param celeryTranscribe.podAnnotations Annotations to add to the celeryTranscribe Pod
|
## @param celeryTranscribe.podAnnotations Annotations to add to the celeryTranscribe Pod
|
||||||
podAnnotations: {}
|
podAnnotations: {}
|
||||||
|
|
||||||
@@ -923,6 +938,7 @@ celeryTranscribe:
|
|||||||
## @extra celeryTranscribe.instances[].name Unique name suffix for the instance (used in the Deployment name and pod labels)
|
## @extra celeryTranscribe.instances[].name Unique name suffix for the instance (used in the Deployment name and pod labels)
|
||||||
## @extra celeryTranscribe.instances[].replicas Override the number of replicas for this specific instance
|
## @extra celeryTranscribe.instances[].replicas Override the number of replicas for this specific instance
|
||||||
## @extra celeryTranscribe.instances[].extraEnvVars Additional environment variables for this specific instance (same structure as envVars)
|
## @extra celeryTranscribe.instances[].extraEnvVars Additional environment variables for this specific instance (same structure as envVars)
|
||||||
|
## @extra celeryTranscribe.instances[].extraEnvFrom Additional ConfigMap or Secret environment sources for this specific instance
|
||||||
## @extra celeryTranscribe.instances[].command Override the container command for this specific instance
|
## @extra celeryTranscribe.instances[].command Override the container command for this specific instance
|
||||||
## @extra celeryTranscribe.instances[].args Override the container args for this specific instance
|
## @extra celeryTranscribe.instances[].args Override the container args for this specific instance
|
||||||
## @extra celeryTranscribe.instances[].resources Override resource requirements for this specific instance
|
## @extra celeryTranscribe.instances[].resources Override resource requirements for this specific instance
|
||||||
@@ -933,6 +949,7 @@ celeryTranscribe:
|
|||||||
instances:
|
instances:
|
||||||
- name: default
|
- name: default
|
||||||
extraEnvVars: {}
|
extraEnvVars: {}
|
||||||
|
extraEnvFrom: []
|
||||||
|
|
||||||
## @section celerySummarize
|
## @section celerySummarize
|
||||||
|
|
||||||
@@ -990,6 +1007,9 @@ celerySummarize:
|
|||||||
envVars:
|
envVars:
|
||||||
<<: *commonEnvVars
|
<<: *commonEnvVars
|
||||||
|
|
||||||
|
## @param celerySummarize.envFrom Import environment variables from ConfigMaps or Secrets
|
||||||
|
envFrom: []
|
||||||
|
|
||||||
## @param celerySummarize.podAnnotations Annotations to add to the celerySummarize Pod
|
## @param celerySummarize.podAnnotations Annotations to add to the celerySummarize Pod
|
||||||
podAnnotations: {}
|
podAnnotations: {}
|
||||||
|
|
||||||
@@ -1099,6 +1119,9 @@ celerySummaryBackend:
|
|||||||
envVars:
|
envVars:
|
||||||
<<: *commonEnvVars
|
<<: *commonEnvVars
|
||||||
|
|
||||||
|
## @param celerySummaryBackend.envFrom Import environment variables from ConfigMaps or Secrets
|
||||||
|
envFrom: []
|
||||||
|
|
||||||
## @param celerySummaryBackend.podAnnotations Annotations to add to the celerySummaryBackend Pod
|
## @param celerySummaryBackend.podAnnotations Annotations to add to the celerySummaryBackend Pod
|
||||||
podAnnotations: {}
|
podAnnotations: {}
|
||||||
|
|
||||||
@@ -1206,6 +1229,9 @@ agentMetadata:
|
|||||||
envVars:
|
envVars:
|
||||||
<<: *commonEnvVars
|
<<: *commonEnvVars
|
||||||
|
|
||||||
|
## @param agentMetadata.envFrom Import environment variables from ConfigMaps or Secrets
|
||||||
|
envFrom: []
|
||||||
|
|
||||||
## @param agentMetadata.podAnnotations Annotations to add to the agentMetadata Pod
|
## @param agentMetadata.podAnnotations Annotations to add to the agentMetadata Pod
|
||||||
podAnnotations: {}
|
podAnnotations: {}
|
||||||
|
|
||||||
@@ -1297,6 +1323,9 @@ agentSubtitles:
|
|||||||
# are NOT supported by the LiveKit Deepgram plugin in streaming mode.
|
# are NOT supported by the LiveKit Deepgram plugin in streaming mode.
|
||||||
# Use language="multi" for automatic multilingual support (10 languages).
|
# Use language="multi" for automatic multilingual support (10 languages).
|
||||||
|
|
||||||
|
## @param agentSubtitles.envFrom Import environment variables from ConfigMaps or Secrets
|
||||||
|
envFrom: []
|
||||||
|
|
||||||
## @param agentSubtitles.podAnnotations Annotations to add to the agentSubtitles Pod
|
## @param agentSubtitles.podAnnotations Annotations to add to the agentSubtitles Pod
|
||||||
podAnnotations: {}
|
podAnnotations: {}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user