From b5bfd8fa7993a557ec385e2f82d72aa4fa623797 Mon Sep 17 00:00:00 2001 From: Philipp Kilian Date: Thu, 2 Nov 2023 16:49:39 +0100 Subject: [PATCH 1/6] models: fix value check for empty values --- b3lb/rest/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b3lb/rest/models.py b/b3lb/rest/models.py index 454fc4d..98794c3 100644 --- a/b3lb/rest/models.py +++ b/b3lb/rest/models.py @@ -1258,7 +1258,7 @@ class Parameter(models.Model): def clean_fields(self, exclude=None): if self.mode in [self.SET, self.OVERRIDE]: - if not match(self.PARAMETER_REGEXES[self.parameter], self.value): + if not (self.value and match(self.PARAMETER_REGEXES[self.parameter], self.value)): raise ValidationError(f'Value must have the format "{self.PARAMETER_REGEXES[self.parameter]}"!', params={'value': self.value}) class Meta(object): From 7aceeb15a3be69f946c59e877e52b0da806842d4 Mon Sep 17 00:00:00 2001 From: Philipp Kilian Date: Fri, 3 Nov 2023 14:15:26 +0100 Subject: [PATCH 2/6] models: outsourcing Parameter model configuration --- b3lb/rest/b3lb/{contants.py => constants.py} | 0 b3lb/rest/b3lb/parameters.py | 280 ++++++++++++++ b3lb/rest/classes/api.py | 2 +- b3lb/rest/models.py | 361 +------------------ 4 files changed, 286 insertions(+), 357 deletions(-) rename b3lb/rest/b3lb/{contants.py => constants.py} (100%) create mode 100644 b3lb/rest/b3lb/parameters.py diff --git a/b3lb/rest/b3lb/contants.py b/b3lb/rest/b3lb/constants.py similarity index 100% rename from b3lb/rest/b3lb/contants.py rename to b3lb/rest/b3lb/constants.py diff --git a/b3lb/rest/b3lb/parameters.py b/b3lb/rest/b3lb/parameters.py new file mode 100644 index 0000000..f9d93ad --- /dev/null +++ b/b3lb/rest/b3lb/parameters.py @@ -0,0 +1,280 @@ +############# +# CONSTANTS # +############# + +# MODES +BLOCK = "BLOCK" +SET = "SET" +OVERRIDE = "OVERRIDE" + +MODE_CHOICES = [ + (BLOCK, BLOCK), + (SET, SET), + (OVERRIDE, OVERRIDE) +] + +# Regexes +BOOLEAN_REGEX = r'^(true|false)$' +NUMBER_REGEX = r'^\d+$' +POLICY_REGEX = r'^(ALWAYS_ACCEPT|ALWAYS_DENY|ASK_MODERATOR)$' +COLOR_REGEX = r'^#[a-fA-F0-9]{6}$' +LOCALE_REGEX = r'^[a-z]{2}$' +CAMERA_REGEX = r'^(low-u30|low-u25|low-u20|low-u15|low-u12|low-u8|low|medium|high|hd)$' +URL_REGEX = r"^https?://[\w.-]+(?:\.[\w.-]+)+[\w._~:/?#[\]@!\$&'()*+,;=.%-]+$" +ROLE_REGEX = r'^(VIEWER|MODERATOR)$' +MEETING_LAYOUT_REGEX = r'(CUSTOM_LAYOUT|SMART_LAYOUT|PRESENTATION_FOCUS|VIDEO_FOCUS)$' +AUDIO_BRIDGE_REGEX = r'^(sipjs|kurento|fullaudio)$' +ANY_REGEX = r'.' + +# Create Parameters +ALLOW_MODS_TO_UNMUTE_USERS = "allowModsToUnmuteUsers" +ALLOW_START_STOP_RECORDING = "allowStartStopRecording" +AUTO_START_RECORDING = "autoStartRecording" +BANNER_COLOR = "bannerColor" +BANNER_TEXT = "bannerText" +COPYRIGHT = "copyright" +DISABLED_FEATURES = "disabledFeatures" +DISABLED_FEATURES_EXCLUDED = "disabledFeaturesExclude" +DURATION = "duration" +END_WHEN_NO_MODERATOR = "endWhenNoModerator" +END_WHEN_NO_MODERATOR_DELAY_IN_MINUTES = "endWhenNoModeratorDelayInMinutes" +GROUPS = "groups" +GUEST_POLICY = "guestPolicy" +LEARNING_DASHBOARD_CLEANUP_DELAY_IN_MINUTES = "learningDashboardCleanupDelayInMinutes" +LOCK_SETTINGS_DISABLE_CAM = "lockSettingsDisableCam" +LOCK_SETTINGS_DISABLE_MIC = "lockSettingsDisableMic" +LOCK_SETTINGS_DISABLE_PRIVATE_CHAT = "lockSettingsDisablePrivateChat" +LOCK_SETTINGS_DISABLE_PUBLIC_CHAT = "lockSettingsDisablePublicChat" +LOCK_SETTINGS_DISABLE_NOTE = "lockSettingsDisableNote" +LOCK_SETTINGS_HIDE_VIEWER_CURSOR = "lockSettingsHideViewersCursor" +LOCK_SETTINGS_LOCKED_LAYOUT = "lockSettingsLockedLayout" +LOCK_SETTINGS_LOCK_ON_JOIN = "lockSettingsLockOnJoin" +LOCK_SETTINGS_LOCK_ON_JOIN_CONFIGURABLE = "lockSettingsLockOnJoinConfigurable" +LOGO = "logo" +LOGOUT_URL = "logoutURL" +MAX_PARTICIPANTS = "maxParticipants" +MEETING_CAMERA_CAP = "meetingCameraCap" +MEETING_EXPIRE_IF_NO_USER_JOINED_IN_MINUTES = "meetingExpireIfNoUserJoinedInMinutes" +MEETING_EXPIRE_WHEN_LAST_USER_LEFT_IN_MINUTES = "meetingExpireWhenLastUserLeftInMinutes" +MEETING_KEEP_EVENT = "meetingKeepEvents" +MEETING_LAYOUT = "meetingLayout" +META_FULLAUDIO_BRIDGE = "meta_fullaudio-bridge" +MODERATOR_ONLY_MESSAGE = "moderatorOnlyMessage" +MUTE_ON_START = "muteOnStart" +NOTIFY_RECORDING_IS_ON = "notifyRecordingIsOn" +PRE_UPLOADED_PRESENTATION_OVERRIDE_DEFAULT = "preUploadedPresentationOverrideDefault" +PRESENTATION_UPLOAD_EXTERNAL_URL = "presentationUploadExternalUrl" +PRESENTATION_UPLOAD_EXTERNAL_DESCRIPTION = "presentationUploadExternalDescription" +RECORD = "record" +RECORD_FULL_DURATION_MEDIA = "recordFullDurationMedia" +WEBCAMS_ONLY_FOR_MODERATOR = "webcamsOnlyForModerator" +WELCOME = "welcome" + +# Join Parameters +# see https://docs.bigbluebutton.org/admin/customize.html#passing-custom-parameters-to-the-client-on-join for documentation +# +# some join parameters needs settings.yml defined inputs, see +# https://github.com/bigbluebutton/bigbluebutton/blob/develop/bigbluebutton-html5/private/config/settings.yml +# for possible options +EXCLUDE_FROM_DASHBOARD = "excludeFromDashboard" +ROLE = "role" +USERDATA_BBB_ASK_FOR_FEEDBACK_ON_LOGOUT = "userdata-bbb_ask_for_feedback_on_logout" +USERDATA_BBB_AUTO_JOIN_AUDIO = "userdata-bbb_auto_join_audio" +USERDATA_BBB_AUTO_SHARE_WEBCAM = "userdata-bbb_auto_share_webcam" +USERDATA_BBB_AUTO_SWAP_LAYOUT = "userdata-bbb_auto_swap_layout" +USERDATA_BBB_CLIENT_TITLE = "userdata-bbb_client_title" +USERDATA_BBB_CUSTOM_STYLE = "userdata-bbb_custom_style" +USERDATA_BBB_CUSTOM_STYLE_URL = "userdata-bbb_custom_style_url" +USERDATA_BBB_DISPLAY_BRANDING_AREA = "userdata-bbb_display_branding_area" +USERDATA_BBB_ENABLE_SCREEN_SHARING = "userdata-bbb_enable_screen_sharing" +USERDATA_BBB_ENABLE_VIDEO = "userdata-bbb_enable_video" +USERDATA_BBB_FORCE_RESTORE_PRESENTATION_ON_NEW_EVENTS = "userdata-bbb_force_restore_presentation_on_new_events" +USERDATA_BBB_FORCE_LISTEN_ONLY = "userdata-bbb_force_listen_only" +USERDATA_BBB_HIDE_PRESENTATION = "userdata-bbb_hide_presentation" +USERDATA_BBB_HIDE_PRESENTATION_ON_JOIN = "userdata-bbb_hide_presentation_on_join" +USERDATA_BBB_LISTEN_ONLY_MODE = "userdata-bbb_listen_only_mode" +USERDATA_BBB_MIRROR_OWN_WEBCAM = "userdata-bbb_mirror_own_webcam" +USERDATA_BBB_MULTI_USER_PEN_ONLY = "userdata-bbb_multi_user_pen_only" +USERDATA_BBB_MULTI_USER_TOOLS = "userdata-bbb_multi_user_tools" +USERDATA_BBB_OVERRIDE_DEFAULT_LOCALE = "userdata-bbb_override_default_locale" +USERDATA_BBB_PREFERRED_CAMERA_PROFILE = "userdata-bbb_preferred_camera_profile" +USERDATA_BBB_PRESENTER_TOOLS = "userdata-bbb_presenter_tools" +USERDATA_BBB_RECORD_VIDEO = "userdata-bbb_record_video" +USERDATA_BBB_SHORTCUTS = "userdata-bbb_shortcuts" +USERDATA_BBB_SHOW_PARTICIPANTS_ON_LOGIN = "userdata-bbb_show_participants_on_login" +USERDATA_BBB_SHOW_PUBLIC_CHAT_ON_LOGIN = "userdata-bbb_show_public_chat_on_login" +USERDATA_BBB_SKIP_CHECK_AUDIO = "userdata-bbb_skip_check_audio" +USERDATA_BBB_SKIP_CHECK_AUDIO_ON_FIRST_JOIN = "userdata-bbb_skip_check_audio_on_first_join" +USERDATA_BBB_SKIP_VIDEO_PREVIEW = "userdata-bbb_skip_video_preview" +USERDATA_BBB_SKIP_VIDEO_PREVIEW_ON_FIRST_JOIN = "userdata-bbb_skip_video_preview_on_first_join" +USERDATA_BBB_OUTSIDE_TOGGLE_RECORDING = "userdata-bbb_outside_toggle_recording" +USERDATA_BBB_OUTSIDE_TOGGLE_SELF_VOICE = "userdata-bbb_outside_toggle_self_voice" + +PARAMETERS_CREATE = [ + ALLOW_MODS_TO_UNMUTE_USERS, + ALLOW_START_STOP_RECORDING, + AUTO_START_RECORDING, + BANNER_COLOR, + BANNER_TEXT, + COPYRIGHT, + DISABLED_FEATURES, + DISABLED_FEATURES_EXCLUDED, + DURATION, + END_WHEN_NO_MODERATOR, + END_WHEN_NO_MODERATOR_DELAY_IN_MINUTES, + GROUPS, + GUEST_POLICY, + LEARNING_DASHBOARD_CLEANUP_DELAY_IN_MINUTES, + LOCK_SETTINGS_DISABLE_CAM, + LOCK_SETTINGS_DISABLE_MIC, + LOCK_SETTINGS_DISABLE_PRIVATE_CHAT, + LOCK_SETTINGS_DISABLE_PUBLIC_CHAT, + LOCK_SETTINGS_DISABLE_NOTE, + LOCK_SETTINGS_HIDE_VIEWER_CURSOR, + LOCK_SETTINGS_LOCKED_LAYOUT, + LOCK_SETTINGS_LOCK_ON_JOIN, + LOCK_SETTINGS_LOCK_ON_JOIN_CONFIGURABLE, + LOGO, + LOGOUT_URL, + MAX_PARTICIPANTS, + MEETING_CAMERA_CAP, + MEETING_EXPIRE_IF_NO_USER_JOINED_IN_MINUTES, + MEETING_EXPIRE_WHEN_LAST_USER_LEFT_IN_MINUTES, + MEETING_KEEP_EVENT, + MEETING_LAYOUT, + META_FULLAUDIO_BRIDGE, + MODERATOR_ONLY_MESSAGE, + MUTE_ON_START, + NOTIFY_RECORDING_IS_ON, + PRE_UPLOADED_PRESENTATION_OVERRIDE_DEFAULT, + PRESENTATION_UPLOAD_EXTERNAL_URL, + PRESENTATION_UPLOAD_EXTERNAL_DESCRIPTION, + RECORD, + RECORD_FULL_DURATION_MEDIA, + WEBCAMS_ONLY_FOR_MODERATOR, + WELCOME, +] + +PARAMETERS_JOIN = [ + EXCLUDE_FROM_DASHBOARD, + ROLE, + USERDATA_BBB_ASK_FOR_FEEDBACK_ON_LOGOUT, + USERDATA_BBB_AUTO_JOIN_AUDIO, + USERDATA_BBB_AUTO_SHARE_WEBCAM, + USERDATA_BBB_AUTO_SWAP_LAYOUT, + USERDATA_BBB_CLIENT_TITLE, + USERDATA_BBB_CUSTOM_STYLE, + USERDATA_BBB_CUSTOM_STYLE_URL, + USERDATA_BBB_DISPLAY_BRANDING_AREA, + USERDATA_BBB_ENABLE_SCREEN_SHARING, + USERDATA_BBB_ENABLE_VIDEO, + USERDATA_BBB_FORCE_RESTORE_PRESENTATION_ON_NEW_EVENTS, + USERDATA_BBB_FORCE_LISTEN_ONLY, + USERDATA_BBB_HIDE_PRESENTATION, + USERDATA_BBB_HIDE_PRESENTATION_ON_JOIN, + USERDATA_BBB_LISTEN_ONLY_MODE, + USERDATA_BBB_MIRROR_OWN_WEBCAM, + USERDATA_BBB_MULTI_USER_PEN_ONLY, + USERDATA_BBB_MULTI_USER_TOOLS, + USERDATA_BBB_OVERRIDE_DEFAULT_LOCALE, + USERDATA_BBB_PREFERRED_CAMERA_PROFILE, + USERDATA_BBB_PRESENTER_TOOLS, + USERDATA_BBB_RECORD_VIDEO, + USERDATA_BBB_SHORTCUTS, + USERDATA_BBB_SHOW_PARTICIPANTS_ON_LOGIN, + USERDATA_BBB_SHOW_PUBLIC_CHAT_ON_LOGIN, + USERDATA_BBB_SKIP_CHECK_AUDIO, + USERDATA_BBB_SKIP_CHECK_AUDIO_ON_FIRST_JOIN, + USERDATA_BBB_SKIP_VIDEO_PREVIEW, + USERDATA_BBB_SKIP_VIDEO_PREVIEW_ON_FIRST_JOIN, + USERDATA_BBB_OUTSIDE_TOGGLE_RECORDING, + USERDATA_BBB_OUTSIDE_TOGGLE_SELF_VOICE, +] + +PARAMETER_REGEXES = { + # Create + ALLOW_MODS_TO_UNMUTE_USERS: BOOLEAN_REGEX, + ALLOW_START_STOP_RECORDING: BOOLEAN_REGEX, + AUTO_START_RECORDING: BOOLEAN_REGEX, + BANNER_COLOR: COLOR_REGEX, + BANNER_TEXT: ANY_REGEX, + COPYRIGHT: ANY_REGEX, + DISABLED_FEATURES: ANY_REGEX, + DISABLED_FEATURES_EXCLUDED: ANY_REGEX, + DURATION: NUMBER_REGEX, + END_WHEN_NO_MODERATOR: BOOLEAN_REGEX, + END_WHEN_NO_MODERATOR_DELAY_IN_MINUTES: NUMBER_REGEX, + GROUPS: ANY_REGEX, + GUEST_POLICY: POLICY_REGEX, + LEARNING_DASHBOARD_CLEANUP_DELAY_IN_MINUTES: NUMBER_REGEX, + LOCK_SETTINGS_DISABLE_CAM: BOOLEAN_REGEX, + LOCK_SETTINGS_DISABLE_MIC: BOOLEAN_REGEX, + LOCK_SETTINGS_DISABLE_PRIVATE_CHAT: BOOLEAN_REGEX, + LOCK_SETTINGS_DISABLE_PUBLIC_CHAT: BOOLEAN_REGEX, + LOCK_SETTINGS_DISABLE_NOTE: BOOLEAN_REGEX, + LOCK_SETTINGS_HIDE_VIEWER_CURSOR: BOOLEAN_REGEX, + LOCK_SETTINGS_LOCKED_LAYOUT: BOOLEAN_REGEX, + LOCK_SETTINGS_LOCK_ON_JOIN: BOOLEAN_REGEX, + LOCK_SETTINGS_LOCK_ON_JOIN_CONFIGURABLE: BOOLEAN_REGEX, + LOGO: URL_REGEX, + LOGOUT_URL: URL_REGEX, + MAX_PARTICIPANTS: NUMBER_REGEX, + MEETING_CAMERA_CAP: NUMBER_REGEX, + MEETING_EXPIRE_IF_NO_USER_JOINED_IN_MINUTES: NUMBER_REGEX, + MEETING_EXPIRE_WHEN_LAST_USER_LEFT_IN_MINUTES: NUMBER_REGEX, + MEETING_KEEP_EVENT: BOOLEAN_REGEX, + MEETING_LAYOUT: MEETING_LAYOUT_REGEX, + META_FULLAUDIO_BRIDGE: AUDIO_BRIDGE_REGEX, + MODERATOR_ONLY_MESSAGE: ANY_REGEX, + MUTE_ON_START: BOOLEAN_REGEX, + NOTIFY_RECORDING_IS_ON: BOOLEAN_REGEX, + PRE_UPLOADED_PRESENTATION_OVERRIDE_DEFAULT: BOOLEAN_REGEX, + PRESENTATION_UPLOAD_EXTERNAL_DESCRIPTION: ANY_REGEX, + PRESENTATION_UPLOAD_EXTERNAL_URL: URL_REGEX, + RECORD: BOOLEAN_REGEX, + RECORD_FULL_DURATION_MEDIA: BOOLEAN_REGEX, + WEBCAMS_ONLY_FOR_MODERATOR: BOOLEAN_REGEX, + WELCOME: ANY_REGEX, + + # Join + EXCLUDE_FROM_DASHBOARD: BOOLEAN_REGEX, + ROLE: ROLE_REGEX, + USERDATA_BBB_ASK_FOR_FEEDBACK_ON_LOGOUT: BOOLEAN_REGEX, + USERDATA_BBB_AUTO_JOIN_AUDIO: BOOLEAN_REGEX, + USERDATA_BBB_AUTO_SHARE_WEBCAM: BOOLEAN_REGEX, + USERDATA_BBB_AUTO_SWAP_LAYOUT: BOOLEAN_REGEX, + USERDATA_BBB_CLIENT_TITLE: ANY_REGEX, + USERDATA_BBB_CUSTOM_STYLE: ANY_REGEX, + USERDATA_BBB_CUSTOM_STYLE_URL: URL_REGEX, + USERDATA_BBB_DISPLAY_BRANDING_AREA: BOOLEAN_REGEX, + USERDATA_BBB_ENABLE_SCREEN_SHARING: BOOLEAN_REGEX, + USERDATA_BBB_ENABLE_VIDEO: BOOLEAN_REGEX, + USERDATA_BBB_FORCE_LISTEN_ONLY: BOOLEAN_REGEX, + USERDATA_BBB_FORCE_RESTORE_PRESENTATION_ON_NEW_EVENTS: BOOLEAN_REGEX, + USERDATA_BBB_HIDE_PRESENTATION: BOOLEAN_REGEX, + USERDATA_BBB_HIDE_PRESENTATION_ON_JOIN: BOOLEAN_REGEX, + USERDATA_BBB_LISTEN_ONLY_MODE: BOOLEAN_REGEX, + USERDATA_BBB_MIRROR_OWN_WEBCAM: BOOLEAN_REGEX, + USERDATA_BBB_MULTI_USER_PEN_ONLY: BOOLEAN_REGEX, + USERDATA_BBB_MULTI_USER_TOOLS: ANY_REGEX, + USERDATA_BBB_OUTSIDE_TOGGLE_RECORDING: BOOLEAN_REGEX, + USERDATA_BBB_OUTSIDE_TOGGLE_SELF_VOICE: BOOLEAN_REGEX, + USERDATA_BBB_OVERRIDE_DEFAULT_LOCALE: LOCALE_REGEX, + USERDATA_BBB_PREFERRED_CAMERA_PROFILE: CAMERA_REGEX, + USERDATA_BBB_PRESENTER_TOOLS: ANY_REGEX, + USERDATA_BBB_RECORD_VIDEO: BOOLEAN_REGEX, + USERDATA_BBB_SHORTCUTS: ANY_REGEX, + USERDATA_BBB_SHOW_PARTICIPANTS_ON_LOGIN: BOOLEAN_REGEX, + USERDATA_BBB_SHOW_PUBLIC_CHAT_ON_LOGIN: BOOLEAN_REGEX, + USERDATA_BBB_SKIP_CHECK_AUDIO: BOOLEAN_REGEX, + USERDATA_BBB_SKIP_CHECK_AUDIO_ON_FIRST_JOIN: BOOLEAN_REGEX, + USERDATA_BBB_SKIP_VIDEO_PREVIEW: BOOLEAN_REGEX, + USERDATA_BBB_SKIP_VIDEO_PREVIEW_ON_FIRST_JOIN: BOOLEAN_REGEX +} + +PARAMETER_CHOICES = [] +for parameter in PARAMETERS_CREATE: + PARAMETER_CHOICES.append((parameter, parameter)) + +for parameter in PARAMETERS_JOIN: + PARAMETER_CHOICES.append((parameter, parameter)) diff --git a/b3lb/rest/classes/api.py b/b3lb/rest/classes/api.py index 65c0dfd..6dbd167 100644 --- a/b3lb/rest/classes/api.py +++ b/b3lb/rest/classes/api.py @@ -38,7 +38,7 @@ from uuid import UUID from urllib.parse import urlencode from xmltodict import parse -import rest.b3lb.contants as cst +import rest.b3lb.constants as cst class ClientB3lbRequest: diff --git a/b3lb/rest/models.py b/b3lb/rest/models.py index 98794c3..1649014 100644 --- a/b3lb/rest/models.py +++ b/b3lb/rest/models.py @@ -31,18 +31,17 @@ from math import pow from os.path import join from re import match +from rest.b3lb.parameters import SET, OVERRIDE, MODE_CHOICES, PARAMETER_REGEXES, PARAMETER_CHOICES from rest.b3lb.utils import xml_escape from rest.classes.statistics import MeetingStats from rest.classes.storage import DBStorage from storages.backends.s3boto3 import ClientError, S3Boto3Storage from textwrap import wrap from typing import Any, Dict -import rest.b3lb.contants as cst +import rest.b3lb.constants as cst import uuid as uid - - # # FUNCTIONS # @@ -901,365 +900,15 @@ class MetricAdmin(admin.ModelAdmin): class Parameter(models.Model): - # Create Parameters - ALLOW_MODS_TO_UNMUTE_USERS = "allowModsToUnmuteUsers" - ALLOW_START_STOP_RECORDING = "allowStartStopRecording" - AUTO_START_RECORDING = "autoStartRecording" - BANNER_COLOR = "bannerColor" - BANNER_TEXT = "bannerText" - COPYRIGHT = "copyright" - DISABLED_FEATURES = "disabledFeatures" - DISABLED_FEATURES_EXCLUDED = "disabledFeaturesExclude" - DURATION = "duration" - END_WHEN_NO_MODERATOR = "endWhenNoModerator" - END_WHEN_NO_MODERATOR_DELAY_IN_MINUTES = "endWhenNoModeratorDelayInMinutes" - GROUPS = "groups" - GUEST_POLICY = "guestPolicy" - LEARNING_DASHBOARD_CLEANUP_DELAY_IN_MINUTES = "learningDashboardCleanupDelayInMinutes" - LOCK_SETTINGS_DISABLE_CAM = "lockSettingsDisableCam" - LOCK_SETTINGS_DISABLE_MIC = "lockSettingsDisableMic" - LOCK_SETTINGS_DISABLE_PRIVATE_CHAT = "lockSettingsDisablePrivateChat" - LOCK_SETTINGS_DISABLE_PUBLIC_CHAT = "lockSettingsDisablePublicChat" - LOCK_SETTINGS_DISABLE_NOTE = "lockSettingsDisableNote" - LOCK_SETTINGS_HIDE_VIEWER_CURSOR = "lockSettingsHideViewersCursor" - LOCK_SETTINGS_LOCKED_LAYOUT = "lockSettingsLockedLayout" - LOCK_SETTINGS_LOCK_ON_JOIN = "lockSettingsLockOnJoin" - LOCK_SETTINGS_LOCK_ON_JOIN_CONFIGURABLE = "lockSettingsLockOnJoinConfigurable" - LOGO = "logo" - LOGOUT_URL = "logoutURL" - MAX_PARTICIPANTS = "maxParticipants" - MEETING_CAMERA_CAP = "meetingCameraCap" - MEETING_EXPIRE_IF_NO_USER_JOINED_IN_MINUTES = "meetingExpireIfNoUserJoinedInMinutes" - MEETING_EXPIRE_WHEN_LAST_USER_LEFT_IN_MINUTES = "meetingExpireWhenLastUserLeftInMinutes" - MEETING_KEEP_EVENT = "meetingKeepEvents" - MEETING_LAYOUT = "meetingLayout" - META_FULLAUDIO_BRIDGE = "meta_fullaudio-bridge" - MODERATOR_ONLY_MESSAGE = "moderatorOnlyMessage" - MUTE_ON_START = "muteOnStart" - NOTIFY_RECORDING_IS_ON = "notifyRecordingIsOn" - PRE_UPLOADED_PRESENTATION_OVERRIDE_DEFAULT = "preUploadedPresentationOverrideDefault" - PRESENTATION_UPLOAD_EXTERNAL_URL = "presentationUploadExternalUrl" - PRESENTATION_UPLOAD_EXTERNAL_DESCRIPTION = "presentationUploadExternalDescription" - RECORD = "record" - RECORD_FULL_DURATION_MEDIA = "recordFullDurationMedia" - WEBCAMS_ONLY_FOR_MODERATOR = "webcamsOnlyForModerator" - WELCOME = "welcome" - - # Join Parameters - # see https://docs.bigbluebutton.org/admin/customize.html#passing-custom-parameters-to-the-client-on-join for documentation - # - # some join parameters needs settings.yml defined inputs, see - # https://github.com/bigbluebutton/bigbluebutton/blob/develop/bigbluebutton-html5/private/config/settings.yml - # for possible options - EXCLUDE_FROM_DASHBOARD = "excludeFromDashboard" - ROLE = "role" - USERDATA_BBB_ASK_FOR_FEEDBACK_ON_LOGOUT = "userdata-bbb_ask_for_feedback_on_logout" - USERDATA_BBB_AUTO_JOIN_AUDIO = "userdata-bbb_auto_join_audio" - USERDATA_BBB_AUTO_SHARE_WEBCAM = "userdata-bbb_auto_share_webcam" - USERDATA_BBB_AUTO_SWAP_LAYOUT = "userdata-bbb_auto_swap_layout" - USERDATA_BBB_CLIENT_TITLE = "userdata-bbb_client_title" - USERDATA_BBB_CUSTOM_STYLE = "userdata-bbb_custom_style" - USERDATA_BBB_CUSTOM_STYLE_URL = "userdata-bbb_custom_style_url" - USERDATA_BBB_DISPLAY_BRANDING_AREA = "userdata-bbb_display_branding_area" - USERDATA_BBB_ENABLE_SCREEN_SHARING = "userdata-bbb_enable_screen_sharing" - USERDATA_BBB_ENABLE_VIDEO = "userdata-bbb_enable_video" - USERDATA_BBB_FORCE_RESTORE_PRESENTATION_ON_NEW_EVENTS = "userdata-bbb_force_restore_presentation_on_new_events" - USERDATA_BBB_FORCE_LISTEN_ONLY = "userdata-bbb_force_listen_only" - USERDATA_BBB_HIDE_PRESENTATION = "userdata-bbb_hide_presentation" - USERDATA_BBB_HIDE_PRESENTATION_ON_JOIN = "userdata-bbb_hide_presentation_on_join" - USERDATA_BBB_LISTEN_ONLY_MODE = "userdata-bbb_listen_only_mode" - USERDATA_BBB_MIRROR_OWN_WEBCAM = "userdata-bbb_mirror_own_webcam" - USERDATA_BBB_MULTI_USER_PEN_ONLY = "userdata-bbb_multi_user_pen_only" - USERDATA_BBB_MULTI_USER_TOOLS = "userdata-bbb_multi_user_tools" - USERDATA_BBB_OVERRIDE_DEFAULT_LOCALE = "userdata-bbb_override_default_locale" - USERDATA_BBB_PREFERRED_CAMERA_PROFILE = "userdata-bbb_preferred_camera_profile" - USERDATA_BBB_PRESENTER_TOOLS = "userdata-bbb_presenter_tools" - USERDATA_BBB_RECORD_VIDEO = "userdata-bbb_record_video" - USERDATA_BBB_SHORTCUTS = "userdata-bbb_shortcuts" - USERDATA_BBB_SHOW_PARTICIPANTS_ON_LOGIN = "userdata-bbb_show_participants_on_login" - USERDATA_BBB_SHOW_PUBLIC_CHAT_ON_LOGIN = "userdata-bbb_show_public_chat_on_login" - USERDATA_BBB_SKIP_CHECK_AUDIO = "userdata-bbb_skip_check_audio" - USERDATA_BBB_SKIP_CHECK_AUDIO_ON_FIRST_JOIN = "userdata-bbb_skip_check_audio_on_first_join" - USERDATA_BBB_SKIP_VIDEO_PREVIEW = "userdata-bbb_skip_video_preview" - USERDATA_BBB_SKIP_VIDEO_PREVIEW_ON_FIRST_JOIN = "userdata-bbb_skip_video_preview_on_first_join" - USERDATA_BBB_OUTSIDE_TOGGLE_RECORDING = "userdata-bbb_outside_toggle_recording" - USERDATA_BBB_OUTSIDE_TOGGLE_SELF_VOICE = "userdata-bbb_outside_toggle_self_voice" - - # Modes - BLOCK = "BLOCK" - SET = "SET" - OVERRIDE = "OVERRIDE" - - PARAMETER_CHOICES = ( - # Create - (ALLOW_MODS_TO_UNMUTE_USERS, ALLOW_MODS_TO_UNMUTE_USERS), - (ALLOW_START_STOP_RECORDING, ALLOW_START_STOP_RECORDING), - (AUTO_START_RECORDING, AUTO_START_RECORDING), - (BANNER_COLOR, BANNER_COLOR), - (BANNER_TEXT, BANNER_TEXT), - (COPYRIGHT, COPYRIGHT), - (DISABLED_FEATURES, DISABLED_FEATURES), - (DISABLED_FEATURES_EXCLUDED, DISABLED_FEATURES_EXCLUDED), - (DURATION, DURATION), - (END_WHEN_NO_MODERATOR, END_WHEN_NO_MODERATOR), - (END_WHEN_NO_MODERATOR_DELAY_IN_MINUTES, END_WHEN_NO_MODERATOR_DELAY_IN_MINUTES), - (GROUPS, GROUPS), - (GUEST_POLICY, GUEST_POLICY), - (LEARNING_DASHBOARD_CLEANUP_DELAY_IN_MINUTES, LEARNING_DASHBOARD_CLEANUP_DELAY_IN_MINUTES), - (LOCK_SETTINGS_DISABLE_CAM, LOCK_SETTINGS_DISABLE_CAM), - (LOCK_SETTINGS_DISABLE_MIC, LOCK_SETTINGS_DISABLE_MIC), - (LOCK_SETTINGS_DISABLE_PRIVATE_CHAT, LOCK_SETTINGS_DISABLE_PRIVATE_CHAT), - (LOCK_SETTINGS_DISABLE_PUBLIC_CHAT, LOCK_SETTINGS_DISABLE_PUBLIC_CHAT), - (LOCK_SETTINGS_DISABLE_NOTE, LOCK_SETTINGS_DISABLE_NOTE), - (LOCK_SETTINGS_HIDE_VIEWER_CURSOR, LOCK_SETTINGS_HIDE_VIEWER_CURSOR), - (LOCK_SETTINGS_LOCK_ON_JOIN, LOCK_SETTINGS_LOCK_ON_JOIN), - (LOCK_SETTINGS_LOCK_ON_JOIN_CONFIGURABLE, LOCK_SETTINGS_LOCK_ON_JOIN_CONFIGURABLE), - (LOCK_SETTINGS_LOCKED_LAYOUT, LOCK_SETTINGS_LOCKED_LAYOUT), - (LOGO, LOGO), - (LOGOUT_URL, LOGOUT_URL), - (MAX_PARTICIPANTS, MAX_PARTICIPANTS), - (MEETING_CAMERA_CAP, MEETING_CAMERA_CAP), - (MEETING_EXPIRE_IF_NO_USER_JOINED_IN_MINUTES, MEETING_EXPIRE_IF_NO_USER_JOINED_IN_MINUTES), - (MEETING_EXPIRE_WHEN_LAST_USER_LEFT_IN_MINUTES, MEETING_EXPIRE_WHEN_LAST_USER_LEFT_IN_MINUTES), - (MEETING_KEEP_EVENT, MEETING_KEEP_EVENT), - (MEETING_LAYOUT, MEETING_LAYOUT), - (META_FULLAUDIO_BRIDGE, META_FULLAUDIO_BRIDGE), - (MODERATOR_ONLY_MESSAGE, MODERATOR_ONLY_MESSAGE), - (MUTE_ON_START, MUTE_ON_START), - (NOTIFY_RECORDING_IS_ON, NOTIFY_RECORDING_IS_ON), - (PRE_UPLOADED_PRESENTATION_OVERRIDE_DEFAULT, PRE_UPLOADED_PRESENTATION_OVERRIDE_DEFAULT), - (PRESENTATION_UPLOAD_EXTERNAL_DESCRIPTION, PRESENTATION_UPLOAD_EXTERNAL_DESCRIPTION), - (PRESENTATION_UPLOAD_EXTERNAL_URL, PRESENTATION_UPLOAD_EXTERNAL_URL), - (RECORD, RECORD), - (RECORD_FULL_DURATION_MEDIA, RECORD_FULL_DURATION_MEDIA), - (WEBCAMS_ONLY_FOR_MODERATOR, WEBCAMS_ONLY_FOR_MODERATOR), - (WELCOME, WELCOME), - - # Join - (EXCLUDE_FROM_DASHBOARD, EXCLUDE_FROM_DASHBOARD), - (ROLE, ROLE), - (USERDATA_BBB_ASK_FOR_FEEDBACK_ON_LOGOUT, USERDATA_BBB_ASK_FOR_FEEDBACK_ON_LOGOUT), - (USERDATA_BBB_AUTO_JOIN_AUDIO, USERDATA_BBB_AUTO_JOIN_AUDIO), - (USERDATA_BBB_AUTO_SHARE_WEBCAM, USERDATA_BBB_AUTO_SHARE_WEBCAM), - (USERDATA_BBB_AUTO_SWAP_LAYOUT, USERDATA_BBB_AUTO_SWAP_LAYOUT), - (USERDATA_BBB_CLIENT_TITLE, USERDATA_BBB_CLIENT_TITLE), - (USERDATA_BBB_CUSTOM_STYLE, USERDATA_BBB_CUSTOM_STYLE), - (USERDATA_BBB_CUSTOM_STYLE_URL, USERDATA_BBB_CUSTOM_STYLE_URL), - (USERDATA_BBB_DISPLAY_BRANDING_AREA, USERDATA_BBB_DISPLAY_BRANDING_AREA), - (USERDATA_BBB_ENABLE_SCREEN_SHARING, USERDATA_BBB_ENABLE_SCREEN_SHARING), - (USERDATA_BBB_ENABLE_VIDEO, USERDATA_BBB_ENABLE_VIDEO), - (USERDATA_BBB_FORCE_LISTEN_ONLY, USERDATA_BBB_FORCE_LISTEN_ONLY), - (USERDATA_BBB_FORCE_RESTORE_PRESENTATION_ON_NEW_EVENTS, USERDATA_BBB_FORCE_RESTORE_PRESENTATION_ON_NEW_EVENTS), - (USERDATA_BBB_HIDE_PRESENTATION, USERDATA_BBB_HIDE_PRESENTATION), - (USERDATA_BBB_HIDE_PRESENTATION_ON_JOIN, USERDATA_BBB_HIDE_PRESENTATION_ON_JOIN), - (USERDATA_BBB_LISTEN_ONLY_MODE, USERDATA_BBB_LISTEN_ONLY_MODE), - (USERDATA_BBB_MIRROR_OWN_WEBCAM, USERDATA_BBB_MIRROR_OWN_WEBCAM), - (USERDATA_BBB_MULTI_USER_PEN_ONLY, USERDATA_BBB_MULTI_USER_PEN_ONLY), - (USERDATA_BBB_MULTI_USER_TOOLS, USERDATA_BBB_MULTI_USER_TOOLS), - (USERDATA_BBB_OUTSIDE_TOGGLE_RECORDING, USERDATA_BBB_OUTSIDE_TOGGLE_RECORDING), - (USERDATA_BBB_OUTSIDE_TOGGLE_SELF_VOICE, USERDATA_BBB_OUTSIDE_TOGGLE_SELF_VOICE), - (USERDATA_BBB_OVERRIDE_DEFAULT_LOCALE, USERDATA_BBB_OVERRIDE_DEFAULT_LOCALE), - (USERDATA_BBB_PREFERRED_CAMERA_PROFILE, USERDATA_BBB_PREFERRED_CAMERA_PROFILE), - (USERDATA_BBB_PRESENTER_TOOLS, USERDATA_BBB_PRESENTER_TOOLS), - (USERDATA_BBB_RECORD_VIDEO, USERDATA_BBB_RECORD_VIDEO), - (USERDATA_BBB_SHORTCUTS, USERDATA_BBB_SHORTCUTS), - (USERDATA_BBB_SHOW_PARTICIPANTS_ON_LOGIN, USERDATA_BBB_SHOW_PARTICIPANTS_ON_LOGIN), - (USERDATA_BBB_SHOW_PUBLIC_CHAT_ON_LOGIN, USERDATA_BBB_SHOW_PUBLIC_CHAT_ON_LOGIN), - (USERDATA_BBB_SKIP_CHECK_AUDIO, USERDATA_BBB_SKIP_CHECK_AUDIO), - (USERDATA_BBB_SKIP_CHECK_AUDIO_ON_FIRST_JOIN, USERDATA_BBB_SKIP_CHECK_AUDIO_ON_FIRST_JOIN), - (USERDATA_BBB_SKIP_VIDEO_PREVIEW, USERDATA_BBB_SKIP_VIDEO_PREVIEW), - (USERDATA_BBB_SKIP_VIDEO_PREVIEW_ON_FIRST_JOIN, USERDATA_BBB_SKIP_VIDEO_PREVIEW_ON_FIRST_JOIN) - ) - - MODE_CHOICES = [ - (BLOCK, BLOCK), - (SET, SET), - (OVERRIDE, OVERRIDE) - ] - - BOOLEAN_REGEX = r'^(true|false)$' - NUMBER_REGEX = r'^\d+$' - POLICY_REGEX = r'^(ALWAYS_ACCEPT|ALWAYS_DENY|ASK_MODERATOR)$' - COLOR_REGEX = r'^#[a-fA-F0-9]{6}$' - LOCALE_REGEX = r'^[a-z]{2}$' - CAMERA_REGEX = r'^(low-u30|low-u25|low-u20|low-u15|low-u12|low-u8|low|medium|high|hd)$' - URL_REGEX = r"^https?://[\w.-]+(?:\.[\w.-]+)+[\w._~:/?#[\]@!\$&'()*+,;=.%-]+$" - ROLE_REGEX = r'^(VIEWER|MODERATOR)$' - MEETING_LAYOUT_REGEX = r'(CUSTOM_LAYOUT|SMART_LAYOUT|PRESENTATION_FOCUS|VIDEO_FOCUS)$' - AUDIO_BRIDGE_REGEX = r'^(sipjs|kurento|fullaudio)$' - ANY_REGEX = r'.' - - PARAMETER_REGEXES = { - # Create - ALLOW_MODS_TO_UNMUTE_USERS: BOOLEAN_REGEX, - ALLOW_START_STOP_RECORDING: BOOLEAN_REGEX, - AUTO_START_RECORDING: BOOLEAN_REGEX, - BANNER_COLOR: COLOR_REGEX, - BANNER_TEXT: ANY_REGEX, - COPYRIGHT: ANY_REGEX, - DISABLED_FEATURES: ANY_REGEX, - DISABLED_FEATURES_EXCLUDED: ANY_REGEX, - DURATION: NUMBER_REGEX, - END_WHEN_NO_MODERATOR: BOOLEAN_REGEX, - END_WHEN_NO_MODERATOR_DELAY_IN_MINUTES: NUMBER_REGEX, - GROUPS: ANY_REGEX, - GUEST_POLICY: POLICY_REGEX, - LEARNING_DASHBOARD_CLEANUP_DELAY_IN_MINUTES: NUMBER_REGEX, - LOCK_SETTINGS_DISABLE_CAM: BOOLEAN_REGEX, - LOCK_SETTINGS_DISABLE_MIC: BOOLEAN_REGEX, - LOCK_SETTINGS_DISABLE_PRIVATE_CHAT: BOOLEAN_REGEX, - LOCK_SETTINGS_DISABLE_PUBLIC_CHAT: BOOLEAN_REGEX, - LOCK_SETTINGS_DISABLE_NOTE: BOOLEAN_REGEX, - LOCK_SETTINGS_HIDE_VIEWER_CURSOR: BOOLEAN_REGEX, - LOCK_SETTINGS_LOCKED_LAYOUT: BOOLEAN_REGEX, - LOCK_SETTINGS_LOCK_ON_JOIN: BOOLEAN_REGEX, - LOCK_SETTINGS_LOCK_ON_JOIN_CONFIGURABLE: BOOLEAN_REGEX, - LOGO: URL_REGEX, - LOGOUT_URL: URL_REGEX, - MAX_PARTICIPANTS: NUMBER_REGEX, - MEETING_CAMERA_CAP: NUMBER_REGEX, - MEETING_EXPIRE_IF_NO_USER_JOINED_IN_MINUTES: NUMBER_REGEX, - MEETING_EXPIRE_WHEN_LAST_USER_LEFT_IN_MINUTES: NUMBER_REGEX, - MEETING_KEEP_EVENT: BOOLEAN_REGEX, - MEETING_LAYOUT: MEETING_LAYOUT_REGEX, - META_FULLAUDIO_BRIDGE: AUDIO_BRIDGE_REGEX, - MODERATOR_ONLY_MESSAGE: ANY_REGEX, - MUTE_ON_START: BOOLEAN_REGEX, - NOTIFY_RECORDING_IS_ON: BOOLEAN_REGEX, - PRE_UPLOADED_PRESENTATION_OVERRIDE_DEFAULT: BOOLEAN_REGEX, - PRESENTATION_UPLOAD_EXTERNAL_DESCRIPTION: ANY_REGEX, - PRESENTATION_UPLOAD_EXTERNAL_URL: URL_REGEX, - RECORD: BOOLEAN_REGEX, - RECORD_FULL_DURATION_MEDIA: BOOLEAN_REGEX, - WEBCAMS_ONLY_FOR_MODERATOR: BOOLEAN_REGEX, - WELCOME: ANY_REGEX, - - # Join - EXCLUDE_FROM_DASHBOARD: BOOLEAN_REGEX, - ROLE: ROLE_REGEX, - USERDATA_BBB_ASK_FOR_FEEDBACK_ON_LOGOUT: BOOLEAN_REGEX, - USERDATA_BBB_AUTO_JOIN_AUDIO: BOOLEAN_REGEX, - USERDATA_BBB_AUTO_SHARE_WEBCAM: BOOLEAN_REGEX, - USERDATA_BBB_AUTO_SWAP_LAYOUT: BOOLEAN_REGEX, - USERDATA_BBB_CLIENT_TITLE: ANY_REGEX, - USERDATA_BBB_CUSTOM_STYLE: ANY_REGEX, - USERDATA_BBB_CUSTOM_STYLE_URL: URL_REGEX, - USERDATA_BBB_DISPLAY_BRANDING_AREA: BOOLEAN_REGEX, - USERDATA_BBB_ENABLE_SCREEN_SHARING: BOOLEAN_REGEX, - USERDATA_BBB_ENABLE_VIDEO: BOOLEAN_REGEX, - USERDATA_BBB_FORCE_LISTEN_ONLY: BOOLEAN_REGEX, - USERDATA_BBB_FORCE_RESTORE_PRESENTATION_ON_NEW_EVENTS: BOOLEAN_REGEX, - USERDATA_BBB_HIDE_PRESENTATION: BOOLEAN_REGEX, - USERDATA_BBB_HIDE_PRESENTATION_ON_JOIN: BOOLEAN_REGEX, - USERDATA_BBB_LISTEN_ONLY_MODE: BOOLEAN_REGEX, - USERDATA_BBB_MIRROR_OWN_WEBCAM: BOOLEAN_REGEX, - USERDATA_BBB_MULTI_USER_PEN_ONLY: BOOLEAN_REGEX, - USERDATA_BBB_MULTI_USER_TOOLS: ANY_REGEX, - USERDATA_BBB_OUTSIDE_TOGGLE_RECORDING: BOOLEAN_REGEX, - USERDATA_BBB_OUTSIDE_TOGGLE_SELF_VOICE: BOOLEAN_REGEX, - USERDATA_BBB_OVERRIDE_DEFAULT_LOCALE: LOCALE_REGEX, - USERDATA_BBB_PREFERRED_CAMERA_PROFILE: CAMERA_REGEX, - USERDATA_BBB_PRESENTER_TOOLS: ANY_REGEX, - USERDATA_BBB_RECORD_VIDEO: BOOLEAN_REGEX, - USERDATA_BBB_SHORTCUTS: ANY_REGEX, - USERDATA_BBB_SHOW_PARTICIPANTS_ON_LOGIN: BOOLEAN_REGEX, - USERDATA_BBB_SHOW_PUBLIC_CHAT_ON_LOGIN: BOOLEAN_REGEX, - USERDATA_BBB_SKIP_CHECK_AUDIO: BOOLEAN_REGEX, - USERDATA_BBB_SKIP_CHECK_AUDIO_ON_FIRST_JOIN: BOOLEAN_REGEX, - USERDATA_BBB_SKIP_VIDEO_PREVIEW: BOOLEAN_REGEX, - USERDATA_BBB_SKIP_VIDEO_PREVIEW_ON_FIRST_JOIN: BOOLEAN_REGEX - } - - PARAMETERS_CREATE = [ - ALLOW_MODS_TO_UNMUTE_USERS, - ALLOW_START_STOP_RECORDING, - AUTO_START_RECORDING, - BANNER_COLOR, - BANNER_TEXT, - COPYRIGHT, - DISABLED_FEATURES, - DISABLED_FEATURES_EXCLUDED, - DURATION, - END_WHEN_NO_MODERATOR, - END_WHEN_NO_MODERATOR_DELAY_IN_MINUTES, - GROUPS, - GUEST_POLICY, - LEARNING_DASHBOARD_CLEANUP_DELAY_IN_MINUTES, - LOCK_SETTINGS_DISABLE_CAM, - LOCK_SETTINGS_DISABLE_MIC, - LOCK_SETTINGS_DISABLE_PRIVATE_CHAT, - LOCK_SETTINGS_DISABLE_PUBLIC_CHAT, - LOCK_SETTINGS_DISABLE_NOTE, - LOCK_SETTINGS_HIDE_VIEWER_CURSOR, - LOCK_SETTINGS_LOCK_ON_JOIN, - LOCK_SETTINGS_LOCK_ON_JOIN_CONFIGURABLE, - LOCK_SETTINGS_LOCKED_LAYOUT, - LOGO, - LOGOUT_URL, - MAX_PARTICIPANTS, - META_FULLAUDIO_BRIDGE, - MEETING_CAMERA_CAP, - MEETING_EXPIRE_IF_NO_USER_JOINED_IN_MINUTES, - MEETING_EXPIRE_WHEN_LAST_USER_LEFT_IN_MINUTES, - MEETING_KEEP_EVENT, - MEETING_LAYOUT, - MODERATOR_ONLY_MESSAGE, - MUTE_ON_START, - NOTIFY_RECORDING_IS_ON, - PRE_UPLOADED_PRESENTATION_OVERRIDE_DEFAULT, - PRESENTATION_UPLOAD_EXTERNAL_DESCRIPTION, - PRESENTATION_UPLOAD_EXTERNAL_URL, - RECORD, - RECORD_FULL_DURATION_MEDIA, - WEBCAMS_ONLY_FOR_MODERATOR, - WELCOME - ] - - PARAMETERS_JOIN = [ - EXCLUDE_FROM_DASHBOARD, - ROLE, - USERDATA_BBB_ASK_FOR_FEEDBACK_ON_LOGOUT, - USERDATA_BBB_AUTO_JOIN_AUDIO, - USERDATA_BBB_AUTO_SHARE_WEBCAM, - USERDATA_BBB_AUTO_SWAP_LAYOUT, - USERDATA_BBB_CLIENT_TITLE, - USERDATA_BBB_CUSTOM_STYLE, - USERDATA_BBB_CUSTOM_STYLE_URL, - USERDATA_BBB_DISPLAY_BRANDING_AREA, - USERDATA_BBB_ENABLE_SCREEN_SHARING, - USERDATA_BBB_ENABLE_VIDEO, - USERDATA_BBB_FORCE_LISTEN_ONLY, - USERDATA_BBB_FORCE_RESTORE_PRESENTATION_ON_NEW_EVENTS, - USERDATA_BBB_HIDE_PRESENTATION, - USERDATA_BBB_HIDE_PRESENTATION_ON_JOIN, - USERDATA_BBB_MIRROR_OWN_WEBCAM, - USERDATA_BBB_MULTI_USER_PEN_ONLY, - USERDATA_BBB_MULTI_USER_TOOLS, - USERDATA_BBB_OUTSIDE_TOGGLE_SELF_VOICE, - USERDATA_BBB_OUTSIDE_TOGGLE_RECORDING, - USERDATA_BBB_OVERRIDE_DEFAULT_LOCALE, - USERDATA_BBB_PREFERRED_CAMERA_PROFILE, - USERDATA_BBB_PRESENTER_TOOLS, - USERDATA_BBB_LISTEN_ONLY_MODE, - USERDATA_BBB_RECORD_VIDEO, - USERDATA_BBB_SHORTCUTS, - USERDATA_BBB_SHOW_PARTICIPANTS_ON_LOGIN, - USERDATA_BBB_SHOW_PUBLIC_CHAT_ON_LOGIN, - USERDATA_BBB_SKIP_CHECK_AUDIO, - USERDATA_BBB_SKIP_CHECK_AUDIO_ON_FIRST_JOIN, - USERDATA_BBB_SKIP_VIDEO_PREVIEW, - USERDATA_BBB_SKIP_VIDEO_PREVIEW_ON_FIRST_JOIN - ] - mode = models.CharField(max_length=10, choices=MODE_CHOICES) parameter = models.CharField(max_length=64, choices=PARAMETER_CHOICES) tenant = models.ForeignKey(Tenant, on_delete=models.CASCADE) value = models.CharField(max_length=250, blank=True, null=True) def clean_fields(self, exclude=None): - if self.mode in [self.SET, self.OVERRIDE]: - if not (self.value and match(self.PARAMETER_REGEXES[self.parameter], self.value)): - raise ValidationError(f'Value must have the format "{self.PARAMETER_REGEXES[self.parameter]}"!', params={'value': self.value}) + if self.mode in [SET, OVERRIDE]: + if not (self.value and match(PARAMETER_REGEXES[self.parameter], self.value)): + raise ValidationError(f'Value must have the format "{PARAMETER_REGEXES[self.parameter]}"!', params={'value': self.value}) class Meta(object): constraints = [models.UniqueConstraint(fields=['parameter', 'tenant'], name="unique_parameter")] From 36ce559f092baaff4cb9f5445f8c12e0b516a35d Mon Sep 17 00:00:00 2001 From: Philipp Kilian Date: Fri, 3 Nov 2023 14:22:26 +0100 Subject: [PATCH 3/6] api: update for outsourced Parameter model constants --- b3lb/rest/classes/api.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/b3lb/rest/classes/api.py b/b3lb/rest/classes/api.py index 6dbd167..eeed071 100644 --- a/b3lb/rest/classes/api.py +++ b/b3lb/rest/classes/api.py @@ -32,6 +32,7 @@ from requests import get from requests.exceptions import RequestException from rest.b3lb.metrics import incr_metric, update_create_metrics +from rest.b3lb.parameters import ALLOW_START_STOP_RECORDING, AUTO_START_RECORDING, BLOCK, LOGO, OVERRIDE, PARAMETERS_CREATE, PARAMETERS_JOIN, RECORD, SET, USERDATA_BBB_CUSTOM_STYLE_URL from rest.b3lb.utils import get_checksum from rest.models import ClusterGroupRelation, Meeting, Metric, Node, Parameter, Record, RecordSet, Secret, SecretMeetingList, SecretMetricsList, Stats from typing import Any, Dict, List, Literal, Union @@ -328,32 +329,32 @@ def check_checksum(self) -> bool: def check_parameters(self, meeting: Meeting = None, created: bool = False): parameters = Parameter.objects.filter(tenant=self.secret.tenant) if self.endpoint == "join": - endpoint_parameters = Parameter.PARAMETERS_JOIN + endpoint_parameters = PARAMETERS_JOIN elif self.endpoint == "create": - endpoint_parameters = Parameter.PARAMETERS_CREATE + endpoint_parameters = PARAMETERS_CREATE else: endpoint_parameters = [] for parameter in parameters: if parameter.parameter in endpoint_parameters: if parameter.parameter in self.parameters: - if parameter.mode == Parameter.BLOCK: + if parameter.mode == BLOCK: self.parameters.pop(parameter.parameter) - elif parameter.mode == Parameter.OVERRIDE: + elif parameter.mode == OVERRIDE: self.parameters[parameter.parameter] = parameter.value - elif parameter.mode in [Parameter.SET, Parameter.OVERRIDE]: + elif parameter.mode in [SET, OVERRIDE]: self.parameters[parameter.parameter] = parameter.value - if self.endpoint == "join" and Parameter.USERDATA_BBB_CUSTOM_STYLE_URL not in self.parameters and hasattr(self.secret.tenant, 'asset') and self.secret.tenant.asset.custom_css: - self.parameters[Parameter.USERDATA_BBB_CUSTOM_STYLE_URL] = self.secret.tenant.asset.custom_css_url + if self.endpoint == "join" and USERDATA_BBB_CUSTOM_STYLE_URL not in self.parameters and hasattr(self.secret.tenant, 'asset') and self.secret.tenant.asset.custom_css: + self.parameters[USERDATA_BBB_CUSTOM_STYLE_URL] = self.secret.tenant.asset.custom_css_url elif self.endpoint == "create": self.parameters.pop("dialNumber", None) self.parameters.pop("voiceBridge", None) # check for custom logo - if Parameter.LOGO not in self.parameters and hasattr(self.secret.tenant, 'asset') and self.secret.tenant.asset.logo: - self.parameters[Parameter.LOGO] = self.secret.tenant.asset.logo_url + if LOGO not in self.parameters and hasattr(self.secret.tenant, 'asset') and self.secret.tenant.asset.logo: + self.parameters[LOGO] = self.secret.tenant.asset.logo_url # check for custom slide if self.request.method == "GET" and hasattr(self.secret.tenant, 'asset') and self.secret.tenant.asset.slide: @@ -371,7 +372,7 @@ def check_parameters(self, meeting: Meeting = None, created: bool = False): self.parameters[f"meta_{settings.B3LB_RECORD_META_DATA_TAG}"] = record_set.nonce else: # record aren't enabled -> suppress any record related parameter - for param in [Parameter.RECORD, Parameter.ALLOW_START_STOP_RECORDING, Parameter.AUTO_START_RECORDING]: + for param in [RECORD, ALLOW_START_STOP_RECORDING, AUTO_START_RECORDING]: self.parameters[param] = "false" self.parameters["meta_endCallbackUrl"] = f"https://{settings.B3LB_API_BASE_DOMAIN}/b3lb/b/meeting/end?nonce={meeting.nonce}" From 3b05c31401c8828bb18a6465f7c45ea0cbb6282a Mon Sep 17 00:00:00 2001 From: Philipp Kilian Date: Fri, 3 Nov 2023 14:52:39 +0100 Subject: [PATCH 4/6] parameters: add parameters for BBB API 2.7 --- b3lb/rest/b3lb/parameters.py | 12 ++++++++++++ .../0015_alter_parameter_parameter.py | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 b3lb/rest/migrations/0015_alter_parameter_parameter.py diff --git a/b3lb/rest/b3lb/parameters.py b/b3lb/rest/b3lb/parameters.py index f9d93ad..6e86ae5 100644 --- a/b3lb/rest/b3lb/parameters.py +++ b/b3lb/rest/b3lb/parameters.py @@ -62,6 +62,8 @@ MODERATOR_ONLY_MESSAGE = "moderatorOnlyMessage" MUTE_ON_START = "muteOnStart" NOTIFY_RECORDING_IS_ON = "notifyRecordingIsOn" +PRE_UPLOADED_PRESENTATION = "preUploadedPresentation" +PRE_UPLOADED_PRESENTATION_NAME = "preUploadedPresentationName" PRE_UPLOADED_PRESENTATION_OVERRIDE_DEFAULT = "preUploadedPresentationOverrideDefault" PRESENTATION_UPLOAD_EXTERNAL_URL = "presentationUploadExternalUrl" PRESENTATION_UPLOAD_EXTERNAL_DESCRIPTION = "presentationUploadExternalDescription" @@ -76,6 +78,7 @@ # some join parameters needs settings.yml defined inputs, see # https://github.com/bigbluebutton/bigbluebutton/blob/develop/bigbluebutton-html5/private/config/settings.yml # for possible options +ERROR_REDIRECT_URL = "errorRedirectUrl" EXCLUDE_FROM_DASHBOARD = "excludeFromDashboard" ROLE = "role" USERDATA_BBB_ASK_FOR_FEEDBACK_ON_LOGOUT = "userdata-bbb_ask_for_feedback_on_logout" @@ -90,6 +93,7 @@ USERDATA_BBB_ENABLE_VIDEO = "userdata-bbb_enable_video" USERDATA_BBB_FORCE_RESTORE_PRESENTATION_ON_NEW_EVENTS = "userdata-bbb_force_restore_presentation_on_new_events" USERDATA_BBB_FORCE_LISTEN_ONLY = "userdata-bbb_force_listen_only" +USERDATA_BBB_FULL_AUDIO_BRIDGE = "userdata-bbb_fullaudio_bridge" USERDATA_BBB_HIDE_PRESENTATION = "userdata-bbb_hide_presentation" USERDATA_BBB_HIDE_PRESENTATION_ON_JOIN = "userdata-bbb_hide_presentation_on_join" USERDATA_BBB_LISTEN_ONLY_MODE = "userdata-bbb_listen_only_mode" @@ -146,6 +150,8 @@ MODERATOR_ONLY_MESSAGE, MUTE_ON_START, NOTIFY_RECORDING_IS_ON, + PRE_UPLOADED_PRESENTATION, + PRE_UPLOADED_PRESENTATION_NAME, PRE_UPLOADED_PRESENTATION_OVERRIDE_DEFAULT, PRESENTATION_UPLOAD_EXTERNAL_URL, PRESENTATION_UPLOAD_EXTERNAL_DESCRIPTION, @@ -156,6 +162,7 @@ ] PARAMETERS_JOIN = [ + ERROR_REDIRECT_URL, EXCLUDE_FROM_DASHBOARD, ROLE, USERDATA_BBB_ASK_FOR_FEEDBACK_ON_LOGOUT, @@ -170,6 +177,7 @@ USERDATA_BBB_ENABLE_VIDEO, USERDATA_BBB_FORCE_RESTORE_PRESENTATION_ON_NEW_EVENTS, USERDATA_BBB_FORCE_LISTEN_ONLY, + USERDATA_BBB_FULL_AUDIO_BRIDGE, USERDATA_BBB_HIDE_PRESENTATION, USERDATA_BBB_HIDE_PRESENTATION_ON_JOIN, USERDATA_BBB_LISTEN_ONLY_MODE, @@ -228,6 +236,8 @@ MODERATOR_ONLY_MESSAGE: ANY_REGEX, MUTE_ON_START: BOOLEAN_REGEX, NOTIFY_RECORDING_IS_ON: BOOLEAN_REGEX, + PRE_UPLOADED_PRESENTATION: URL_REGEX, + PRE_UPLOADED_PRESENTATION_NAME: ANY_REGEX, PRE_UPLOADED_PRESENTATION_OVERRIDE_DEFAULT: BOOLEAN_REGEX, PRESENTATION_UPLOAD_EXTERNAL_DESCRIPTION: ANY_REGEX, PRESENTATION_UPLOAD_EXTERNAL_URL: URL_REGEX, @@ -237,6 +247,7 @@ WELCOME: ANY_REGEX, # Join + ERROR_REDIRECT_URL: URL_REGEX, EXCLUDE_FROM_DASHBOARD: BOOLEAN_REGEX, ROLE: ROLE_REGEX, USERDATA_BBB_ASK_FOR_FEEDBACK_ON_LOGOUT: BOOLEAN_REGEX, @@ -251,6 +262,7 @@ USERDATA_BBB_ENABLE_VIDEO: BOOLEAN_REGEX, USERDATA_BBB_FORCE_LISTEN_ONLY: BOOLEAN_REGEX, USERDATA_BBB_FORCE_RESTORE_PRESENTATION_ON_NEW_EVENTS: BOOLEAN_REGEX, + USERDATA_BBB_FULL_AUDIO_BRIDGE: BOOLEAN_REGEX, USERDATA_BBB_HIDE_PRESENTATION: BOOLEAN_REGEX, USERDATA_BBB_HIDE_PRESENTATION_ON_JOIN: BOOLEAN_REGEX, USERDATA_BBB_LISTEN_ONLY_MODE: BOOLEAN_REGEX, diff --git a/b3lb/rest/migrations/0015_alter_parameter_parameter.py b/b3lb/rest/migrations/0015_alter_parameter_parameter.py new file mode 100644 index 0000000..60999d6 --- /dev/null +++ b/b3lb/rest/migrations/0015_alter_parameter_parameter.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.19 on 2023-11-03 13:51 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('rest', '0014_remove_clustergroup_sha_function'), + ] + + operations = [ + migrations.AlterField( + model_name='parameter', + name='parameter', + field=models.CharField(choices=[('allowModsToUnmuteUsers', 'allowModsToUnmuteUsers'), ('allowStartStopRecording', 'allowStartStopRecording'), ('autoStartRecording', 'autoStartRecording'), ('bannerColor', 'bannerColor'), ('bannerText', 'bannerText'), ('copyright', 'copyright'), ('disabledFeatures', 'disabledFeatures'), ('disabledFeaturesExclude', 'disabledFeaturesExclude'), ('duration', 'duration'), ('endWhenNoModerator', 'endWhenNoModerator'), ('endWhenNoModeratorDelayInMinutes', 'endWhenNoModeratorDelayInMinutes'), ('groups', 'groups'), ('guestPolicy', 'guestPolicy'), ('learningDashboardCleanupDelayInMinutes', 'learningDashboardCleanupDelayInMinutes'), ('lockSettingsDisableCam', 'lockSettingsDisableCam'), ('lockSettingsDisableMic', 'lockSettingsDisableMic'), ('lockSettingsDisablePrivateChat', 'lockSettingsDisablePrivateChat'), ('lockSettingsDisablePublicChat', 'lockSettingsDisablePublicChat'), ('lockSettingsDisableNote', 'lockSettingsDisableNote'), ('lockSettingsHideViewersCursor', 'lockSettingsHideViewersCursor'), ('lockSettingsLockedLayout', 'lockSettingsLockedLayout'), ('lockSettingsLockOnJoin', 'lockSettingsLockOnJoin'), ('lockSettingsLockOnJoinConfigurable', 'lockSettingsLockOnJoinConfigurable'), ('logo', 'logo'), ('logoutURL', 'logoutURL'), ('maxParticipants', 'maxParticipants'), ('meetingCameraCap', 'meetingCameraCap'), ('meetingExpireIfNoUserJoinedInMinutes', 'meetingExpireIfNoUserJoinedInMinutes'), ('meetingExpireWhenLastUserLeftInMinutes', 'meetingExpireWhenLastUserLeftInMinutes'), ('meetingKeepEvents', 'meetingKeepEvents'), ('meetingLayout', 'meetingLayout'), ('meta_fullaudio-bridge', 'meta_fullaudio-bridge'), ('moderatorOnlyMessage', 'moderatorOnlyMessage'), ('muteOnStart', 'muteOnStart'), ('notifyRecordingIsOn', 'notifyRecordingIsOn'), ('preUploadedPresentation', 'preUploadedPresentation'), ('preUploadedPresentationName', 'preUploadedPresentationName'), ('preUploadedPresentationOverrideDefault', 'preUploadedPresentationOverrideDefault'), ('presentationUploadExternalUrl', 'presentationUploadExternalUrl'), ('presentationUploadExternalDescription', 'presentationUploadExternalDescription'), ('record', 'record'), ('recordFullDurationMedia', 'recordFullDurationMedia'), ('webcamsOnlyForModerator', 'webcamsOnlyForModerator'), ('welcome', 'welcome'), ('errorRedirectUrl', 'errorRedirectUrl'), ('excludeFromDashboard', 'excludeFromDashboard'), ('role', 'role'), ('userdata-bbb_ask_for_feedback_on_logout', 'userdata-bbb_ask_for_feedback_on_logout'), ('userdata-bbb_auto_join_audio', 'userdata-bbb_auto_join_audio'), ('userdata-bbb_auto_share_webcam', 'userdata-bbb_auto_share_webcam'), ('userdata-bbb_auto_swap_layout', 'userdata-bbb_auto_swap_layout'), ('userdata-bbb_client_title', 'userdata-bbb_client_title'), ('userdata-bbb_custom_style', 'userdata-bbb_custom_style'), ('userdata-bbb_custom_style_url', 'userdata-bbb_custom_style_url'), ('userdata-bbb_display_branding_area', 'userdata-bbb_display_branding_area'), ('userdata-bbb_enable_screen_sharing', 'userdata-bbb_enable_screen_sharing'), ('userdata-bbb_enable_video', 'userdata-bbb_enable_video'), ('userdata-bbb_force_restore_presentation_on_new_events', 'userdata-bbb_force_restore_presentation_on_new_events'), ('userdata-bbb_force_listen_only', 'userdata-bbb_force_listen_only'), ('userdata-bbb_fullaudio_bridge', 'userdata-bbb_fullaudio_bridge'), ('userdata-bbb_hide_presentation', 'userdata-bbb_hide_presentation'), ('userdata-bbb_hide_presentation_on_join', 'userdata-bbb_hide_presentation_on_join'), ('userdata-bbb_listen_only_mode', 'userdata-bbb_listen_only_mode'), ('userdata-bbb_mirror_own_webcam', 'userdata-bbb_mirror_own_webcam'), ('userdata-bbb_multi_user_pen_only', 'userdata-bbb_multi_user_pen_only'), ('userdata-bbb_multi_user_tools', 'userdata-bbb_multi_user_tools'), ('userdata-bbb_override_default_locale', 'userdata-bbb_override_default_locale'), ('userdata-bbb_preferred_camera_profile', 'userdata-bbb_preferred_camera_profile'), ('userdata-bbb_presenter_tools', 'userdata-bbb_presenter_tools'), ('userdata-bbb_record_video', 'userdata-bbb_record_video'), ('userdata-bbb_shortcuts', 'userdata-bbb_shortcuts'), ('userdata-bbb_show_participants_on_login', 'userdata-bbb_show_participants_on_login'), ('userdata-bbb_show_public_chat_on_login', 'userdata-bbb_show_public_chat_on_login'), ('userdata-bbb_skip_check_audio', 'userdata-bbb_skip_check_audio'), ('userdata-bbb_skip_check_audio_on_first_join', 'userdata-bbb_skip_check_audio_on_first_join'), ('userdata-bbb_skip_video_preview', 'userdata-bbb_skip_video_preview'), ('userdata-bbb_skip_video_preview_on_first_join', 'userdata-bbb_skip_video_preview_on_first_join'), ('userdata-bbb_outside_toggle_recording', 'userdata-bbb_outside_toggle_recording'), ('userdata-bbb_outside_toggle_self_voice', 'userdata-bbb_outside_toggle_self_voice')], max_length=64), + ), + ] From e7bdb606d506a6db6198dc7ae396aaab6176de80 Mon Sep 17 00:00:00 2001 From: Philipp Kilian Date: Fri, 3 Nov 2023 16:21:03 +0100 Subject: [PATCH 5/6] requirements: update dependency requirements --- b3lb/requirements.txt | 20 ++++++++++---------- b3lb/rest/models.py | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/b3lb/requirements.txt b/b3lb/requirements.txt index 9d465a8..dfa06f5 100644 --- a/b3lb/requirements.txt +++ b/b3lb/requirements.txt @@ -1,21 +1,21 @@ # b3lb v3.1 - Delay update to Django 4.x because of dependencies -Django==3.2.19 -PyGObject==3.44.1 -aiohttp==3.8.4 -boto3==1.26.163 +Django==3.2.23 +PyGObject==3.46.0 +aiohttp==3.8.6 +boto3==1.28.77 django-extensions==3.2.3 -celery==5.3.1 +celery==5.3.4 celery-singleton==0.3.1 -django-cacheops==7.0.1 +django-cacheops==7.0.2 django-db-file-storage==0.5.5 django-celery-admin==0.1 django-celery-beat==2.5.0 django-celery-results==2.5.1 -django-environ==0.10.0 -django-redis==5.3.0 -django-storages==1.13.2 +django-environ==0.11.2 +django-redis==5.4.0 +django-storages==1.14.2 intervaltree==3.1.0 psycopg2cffi==2.9.0 requests==2.31.0 -uvicorn[standard]==0.22.0 +uvicorn[standard]==0.23.2 xmltodict==0.13.0 \ No newline at end of file diff --git a/b3lb/rest/models.py b/b3lb/rest/models.py index 1649014..7727763 100644 --- a/b3lb/rest/models.py +++ b/b3lb/rest/models.py @@ -35,7 +35,7 @@ from rest.b3lb.utils import xml_escape from rest.classes.statistics import MeetingStats from rest.classes.storage import DBStorage -from storages.backends.s3boto3 import ClientError, S3Boto3Storage +from storages.backends.s3 import ClientError, S3Storage from textwrap import wrap from typing import Any, Dict import rest.b3lb.constants as cst @@ -53,7 +53,7 @@ def get_storage(): if settings.B3LB_RECORD_STORAGE == "local": used_storage = FileSystemStorage() elif settings.B3LB_RECORD_STORAGE == "s3": - used_storage = S3Boto3Storage() + used_storage = S3Storage() used_storage.access_key = settings.B3LB_S3_ACCESS_KEY used_storage.secret_key = settings.B3LB_S3_SECRET_KEY used_storage.endpoint_url = settings.B3LB_S3_ENDPOINT_URL From c84e64c826cc727b504a96ab2b389d8f707675a8 Mon Sep 17 00:00:00 2001 From: Philipp Kilian Date: Tue, 14 May 2024 11:28:03 +0200 Subject: [PATCH 6/6] task: fix import of constants --- b3lb/rest/task/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b3lb/rest/task/core.py b/b3lb/rest/task/core.py index f41a0ca..79d71b7 100644 --- a/b3lb/rest/task/core.py +++ b/b3lb/rest/task/core.py @@ -23,7 +23,7 @@ from django.utils import timezone from json import dumps from requests import get -from rest.b3lb.contants import RETURN_STRING_GET_MEETINGS_NO_MEETINGS +from rest.b3lb.constants import RETURN_STRING_GET_MEETINGS_NO_MEETINGS from rest.b3lb.metrics import incr_metric, set_metric from rest.b3lb.utils import xml_escape from rest.classes.checks import NodeCheck