Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply meta_server-tag from default/override create parameters early in create #1066

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/controllers/bigbluebutton_api_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ def get_meetings_disabled
def create
params.require(:meetingID)

apply_config_server_tag(params)
begin
# Check if meeting is already running
meeting = Meeting.find(params[:meetingID], @tenant&.id)
Expand Down
21 changes: 19 additions & 2 deletions app/controllers/concerns/api_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,18 @@ def add_additional_params(action, bbb_params)
else
[{}, {}]
end
# Server tag is handled separately in create call
default.delete(:'meta_server-tag')
override.delete(:'meta_server-tag')

final_params = default&.merge(final_params)

case action
when 'create'
# Merge with the default (bbb_params takes precedence)
final_params = Rails.configuration.x.default_create_params.merge(final_params)
final_params = Rails.configuration.x.default_create_params.except(:'meta_server-tag').merge(final_params)
# Merge with the override (override takes precedence)
final_params.merge!(Rails.configuration.x.override_create_params)
final_params.merge!(Rails.configuration.x.override_create_params.except(:'meta_server-tag'))
when 'join'
# Merge with the default (bbb_params takes precedence)
final_params = Rails.configuration.x.default_join_params.merge(final_params)
Expand All @@ -238,4 +241,18 @@ def add_additional_params(action, bbb_params)

final_params
end

# early handling of server tag in default/override create settings
def apply_config_server_tag(params)
default = Rails.configuration.x.default_create_params
override = Rails.configuration.x.override_create_params
default_tenant, override_tenant = TenantSetting.defaults_and_overrides(@tenant&.id)

params[:'meta_server-tag'] =
override_tenant[:'meta_server-tag'].presence ||
override[:'meta_server-tag'].presence ||
params[:'meta_server-tag'].presence ||
default_tenant[:'meta_server-tag'].presence ||
default[:'meta_server-tag'].presence
end
end
Loading