From a2a63ba5a5a5276672e3edd643fc0a6258f88fd6 Mon Sep 17 00:00:00 2001
From: Samuel Couillard <43917914+scouillard@users.noreply.github.com>
Date: Mon, 31 Jul 2023 16:25:31 -0400
Subject: [PATCH] Fix oversight in Role migration (#5358)

---
 app/controllers/api/v1/migrations/external_controller.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/controllers/api/v1/migrations/external_controller.rb b/app/controllers/api/v1/migrations/external_controller.rb
index 12730a61..6abf1025 100644
--- a/app/controllers/api/v1/migrations/external_controller.rb
+++ b/app/controllers/api/v1/migrations/external_controller.rb
@@ -48,7 +48,7 @@ module Api
           role_hash = role_params.to_h
 
           # Returns an error if the provider does not exist
-          if role_hash[:provider] != 'greenlight' && Tenant.find_by(provider: role_hash[:provider]).nil?
+          unless role_hash[:provider] == 'greenlight' || Tenant.exists?(name: role_hash[:provider])
             return render_error(status: :bad_request, errors: 'Provider does not exist')
           end
 
-- 
GitLab