From ed1d7e6ac0800be24493e7fc066c3c4dd2ca6bfb Mon Sep 17 00:00:00 2001
From: Samuel Couillard <43917914+scouillard@users.noreply.github.com>
Date: Fri, 7 Jul 2023 09:49:26 -0400
Subject: [PATCH] Add ldap and google to provider whitelist for rooms migration
 (#5315)

---
 app/controllers/api/v1/migrations/external_controller.rb | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/app/controllers/api/v1/migrations/external_controller.rb b/app/controllers/api/v1/migrations/external_controller.rb
index b106ef20..12730a61 100644
--- a/app/controllers/api/v1/migrations/external_controller.rb
+++ b/app/controllers/api/v1/migrations/external_controller.rb
@@ -114,9 +114,13 @@ module Api
         #                    shared_users_emails: [ <list of shared users emails> ] }}
         # Returns: { data: Array[serializable objects] , errors: Array[String] }
         # Does: Creates a Room and its RoomMeetingOptions.
+        # rubocop:disable Metrics/CyclomaticComplexity
         def create_room
           room_hash = room_params.to_h
 
+          # Re-write LDAP and Google to greenlight
+          room_hash[:provider] = %w[greenlight ldap google].include?(room_hash[:provider]) ? 'greenlight' : room_hash[:provider]
+
           unless room_hash[:provider] == 'greenlight' || Tenant.exists?(name: room_hash[:provider])
             return render_error(status: :bad_request, errors: 'Provider does not exist')
           end
@@ -165,6 +169,7 @@ module Api
 
           render_data status: :created
         end
+        # rubocop:enable Metrics/CyclomaticComplexity
 
         # POST /api/v1/migrations/site_settings.json
         # Expects: { settings: { site_settings: { :PrimaryColor, :PrimaryColorLight, :PrimaryColorDark,
-- 
GitLab