diff --git a/app/controllers/api/v1/server_tags_controller.rb b/app/controllers/api/v1/server_tags_controller.rb index f6d2d6795a..30142c42f4 100644 --- a/app/controllers/api/v1/server_tags_controller.rb +++ b/app/controllers/api/v1/server_tags_controller.rb @@ -20,13 +20,13 @@ module Api module V1 class ServerTagsController < ApiController # GET /api/v1/server_tags.json - # Returns a list of all allowed tags for the current user + # Returns a list of all allowed tags&names for the current user def index - tags = Rails.configuration.server_tag_names + tag_names = Rails.configuration.server_tag_names tag_roles = Rails.configuration.server_tag_roles - tags.delete_if { |tag, _| tag_roles.key?(tag) && tag_roles[tag].exclude?(current_user.role_id) } + tag_names.delete_if { |tag, _| tag_roles.key?(tag) && tag_roles[tag].exclude?(current_user.role_id) } - render_data data: tags, status: :ok + render_data data: tag_names, status: :ok end end end diff --git a/app/services/meeting_starter.rb b/app/services/meeting_starter.rb index e75681cf9b..a8618df4e2 100644 --- a/app/services/meeting_starter.rb +++ b/app/services/meeting_starter.rb @@ -77,10 +77,15 @@ def computed_options(access_code:) def handle_server_tag(meeting_options:) if meeting_options['serverTag'].present? + tag_names = Rails.configuration.server_tag_names + tag_roles = Rails.configuration.server_tag_roles tag = meeting_options.delete('serverTag') tag_required = meeting_options.delete('serverTagRequired') - tag_param = tag_required == 'true' ? "#{tag} !" : tag - meeting_options.store('meta_server-tag', tag_param) if Rails.configuration.server_tag_names.key?(tag) + + if tag_names.key?(tag) && !(tag_roles.key?(tag) && tag_roles[tag].exclude?(@current_user.role_id)) + tag_param = tag_required == 'true' ? "#{tag} !" : tag + meeting_options.store('meta_server-tag', tag_param) + end else meeting_options.delete('serverTag') meeting_options.delete('serverTagRequired')