diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8f96426a..9ae09ecb 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -78,8 +78,6 @@ module ApplicationHelper def allow_greenlight_accounts? return Rails.configuration.allow_user_signup unless Rails.configuration.loadbalanced_configuration return false unless @user_domain && !@user_domain.empty? && Rails.configuration.allow_user_signup - # No need to retrieve the provider info if the provider is whitelisted - return true if launcher_allow_user_signup_whitelisted?(@user_domain) # Proceed with retrieving the provider info begin provider_info = retrieve_provider_info(@user_domain, 'api2', 'getUserGreenlightCredentials') diff --git a/app/models/user.rb b/app/models/user.rb index 8588587e..06534269 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -200,9 +200,8 @@ class User < ApplicationRecord def greenlight_account? return true unless provider # For testing cases when provider is set to null - return provider == "greenlight" unless Rails.configuration.loadbalanced_configuration - # No need to retrive the provider info if the provider is whitelisted - return true if launcher_allow_user_signup_whitelisted?(provider) + return true if provider == "greenlight" + return false unless Rails.configuration.loadbalanced_configuration # Proceed with fetching the provider info provider_info = retrieve_provider_info(provider, 'api2', 'getUserGreenlightCredentials') provider_info['provider'] == 'greenlight' diff --git a/config/application.rb b/config/application.rb index feb3bea2..b5c75c82 100644 --- a/config/application.rb +++ b/config/application.rb @@ -66,7 +66,6 @@ module Greenlight config.loadbalancer_endpoint = ENV["LOADBALANCER_ENDPOINT"] config.loadbalancer_secret = ENV["LOADBALANCER_SECRET"] config.launcher_secret = ENV["LAUNCHER_SECRET"] - config.launcher_allow_user_signup = ENV["LAUNCHER_ALLOW_GREENLIGHT_ACCOUNTS"] # Fix endpoint format if required. config.loadbalancer_endpoint += "/" unless config.bigbluebutton_endpoint.ends_with?("/") diff --git a/lib/bbb_api.rb b/lib/bbb_api.rb index d6b12fd2..46f9bdfd 100644 --- a/lib/bbb_api.rb +++ b/lib/bbb_api.rb @@ -73,10 +73,4 @@ module BbbApi def remove_slash(s) s.nil? ? nil : s.chomp("/") end - - def launcher_allow_user_signup_whitelisted?(provider) - return false unless Rails.configuration.launcher_allow_user_signup - whitelist = Rails.configuration.launcher_allow_user_signup.split(',') - whitelist.include?(provider) - end end diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 49e9fbd1..24c8cd0d 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -65,20 +65,9 @@ describe ApplicationHelper do expect(helper.allow_greenlight_accounts?).to eql(false) end - it "allows if user_domain is white listed" do - allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true) - allow(Rails.configuration).to receive(:allow_user_signup).and_return(true) - allow(helper).to receive(:launcher_allow_user_signup_whitelisted?).and_return(true) - - @user_domain = "provider1" - - expect(helper.allow_greenlight_accounts?).to eql(true) - end - it "allows if user provider is set to greenlight" do allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true) allow(Rails.configuration).to receive(:allow_user_signup).and_return(true) - allow(helper).to receive(:launcher_allow_user_signup_whitelisted?).and_return(false) allow(helper).to receive(:retrieve_provider_info).and_return("provider" => "greenlight") @user_domain = "provider1" @@ -89,7 +78,6 @@ describe ApplicationHelper do it "doesnt allow if user provider is not set to greenlight" do allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true) allow(Rails.configuration).to receive(:allow_user_signup).and_return(true) - allow(helper).to receive(:launcher_allow_user_signup_whitelisted?).and_return(false) allow(helper).to receive(:retrieve_provider_info).and_return("provider" => "google") @user_domain = "provider1"