Skip to content

Commit 3af318f

Browse files
committed
Changed Specific Email Domain Sign Up to Allowed Domains
- changed all instances of previous name to AllowedDomains
1 parent ddcc607 commit 3af318f

File tree

13 files changed

+61
-33
lines changed

13 files changed

+61
-33
lines changed

Gemfile.lock

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,3 +551,9 @@ DEPENDENCIES
551551
web-console (>= 4.2.1)
552552
webdrivers
553553
webmock
554+
555+
RUBY VERSION
556+
ruby 3.1.0p0
557+
558+
BUNDLED WITH
559+
2.3.3

app/assets/locales/en.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,9 @@
320320
"invite": "Join by Invitation",
321321
"approval": "Approve/Decline"
322322
},
323-
"specific_email_domain_signup": "Specific Email Domain Signup",
324-
"specific_email_domain_signup_description": "Allow specific email domains to sign up. Format must be: @test.com,domain.com",
325-
"enter_domain_signup_rule" : "Enter a specific domain signup rule"
323+
"allowed_domains": "Allow Specific Email Domains",
324+
"allowed_domains_signup_description": "Allow specific email domains to sign up. Format must be: @test.com,domain.com",
325+
"enter_allowed_domains_rule" : "Enter the allowed domains"
326326
}
327327
},
328328
"room_configuration": {
@@ -424,7 +424,7 @@
424424
"helpcenter_updated": "The help center link has been updated.",
425425
"terms_of_service_updated": "The terms of service have been updated.",
426426
"maintenance_updated": "The maintenance banner has been updated.",
427-
"specific_email_domain_signup_updated": "The specific email domain sign up has been updated"
427+
"allowed_domains_signup_updated": "The specific email domain sign up has been updated"
428428
},
429429
"recording": {
430430
"recording_visibility_updated": "The recording visibility has been updated.",

app/controllers/api/v1/users_controller.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,10 @@ def valid_invite_token
189189
end
190190

191191
def valid_domain?
192-
specific_domain_emails = SettingGetter.new(setting_name: 'SpecificEmailDomainSignUp', provider: current_provider).call
193-
return true if specific_domain_emails.blank?
192+
allowed_domains_emails = SettingGetter.new(setting_name: 'AllowedDomains', provider: current_provider).call
193+
return true if allowed_domains_emails.blank?
194194

195-
domains = specific_domain_emails.split(',')
195+
domains = allowed_domains_emails.split(',')
196196
domains.each do |domain|
197197
return true if create_user_params[:email].end_with?(domain)
198198
end

app/controllers/external_controller.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,10 @@ def build_user_info(credentials)
168168
end
169169

170170
def valid_domain?(email)
171-
specific_domain_emails = SettingGetter.new(setting_name: 'SpecificEmailDomainSignUp', provider: current_provider).call
172-
return true if specific_domain_emails.blank?
171+
allowed_domain_emails = SettingGetter.new(setting_name: 'AllowedDomains', provider: current_provider).call
172+
return true if allowed_domain_emails.blank?
173173

174-
domains = specific_domain_emails.split(',')
174+
domains = allowed_domain_emails.split(',')
175175
domains.each do |domain|
176176
return true if email.end_with?(domain)
177177
end

app/javascript/components/admin/site_settings/registration/Registration.jsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ import useRoles from '../../../../hooks/queries/admin/roles/useRoles';
2828
export default function Registration() {
2929
const { t } = useTranslation();
3030
const { data: env } = useEnv();
31-
const { data: siteSettings } = useSiteSettings(['RoleMapping', 'DefaultRole', 'ResyncOnLogin', 'RegistrationMethod', 'SpecificEmailDomainSignUp']);
31+
const { data: siteSettings } = useSiteSettings(['RoleMapping', 'DefaultRole', 'ResyncOnLogin', 'RegistrationMethod', 'AllowedDomains']);
3232
const { data: roles } = useRoles();
3333
const updateRegistrationMethod = useUpdateSiteSetting('RegistrationMethod');
3434
const updateDefaultRole = useUpdateSiteSetting('DefaultRole');
3535
const updateRoleMapping = useUpdateSiteSetting('RoleMapping');
36-
const updateDomainSignUp = useUpdateSiteSetting('SpecificEmailDomainSignUp');
36+
const updateDomainSignUp = useUpdateSiteSetting('AllowedDomains');
3737

3838
return (
3939
<>
@@ -102,13 +102,12 @@ export default function Registration() {
102102
</Row>
103103

104104
<Row className="mb-3">
105-
<strong> {t('admin.site_settings.registration.specific_email_domain_signup')} </strong>
106-
<p className="text-muted">{t('admin.site_settings.registration.specific_email_domain_signup_description')}</p>
105+
<strong> {t('admin.site_settings.registration.allowed_domains')} </strong>
106+
<p className="text-muted">{t('admin.site_settings.registration.allowed_domains_signup_description')}</p>
107107
<Stack direction="horizontal">
108108
<input
109109
className="form-control"
110-
// TODO add proper placeholder and defultValue
111-
placeholder={t('admin.site_settings.registration.enter_domain_signup_rule')}
110+
placeholder={t('admin.site_settings.registration.enter_allowed_domains_rule')}
112111
/>
113112
<Button
114113
variant="brand"

app/javascript/hooks/mutations/admin/site_settings/useUpdateSiteSetting.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ export default function useUpdateSiteSetting(name) {
6363
case 'Maintenance':
6464
toast.success(t('toast.success.site_settings.maintenance_updated'));
6565
break;
66-
case 'SpecificEmailDomainSignUp':
67-
toast.success(t('toast.success.site_settings.specific_email_domain_signup_updated'));
66+
case 'AllowedDomains':
67+
toast.success(t('toast.success.site_settings.allowed_domains_signup_updated'));
6868
break;
6969
default:
7070
toast.success(t('toast.success.site_settings.site_setting_updated'));

app/services/tenant_setup.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def create_site_settings
5757
{ setting: Setting.find_by(name: 'DefaultRecordingVisibility'), provider: @provider, value: 'Published' },
5858
{ setting: Setting.find_by(name: 'Maintenance'), provider: @provider, value: '' },
5959
{ setting: Setting.find_by(name: 'SessionTimeout'), provider: @provider, value: '1' },
60-
{ setting: Setting.find_by(name: 'SpecificEmailDomainSignUp'), value: '', provider: @provider }
60+
{ setting: Setting.find_by(name: 'AllowedDomains'), value: '', provider: @provider }
6161
]
6262
end
6363

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# frozen_string_literal: true
2+
3+
class AddAllowedDomainsToSiteSettings < ActiveRecord::Migration[7.1]
4+
def up
5+
setting = Setting.find_or_create_by(name: 'AllowedDomains')
6+
7+
SiteSetting.create!(setting:, value: '', provider: 'greenlight') unless SiteSetting.exists?(setting:, provider: 'greenlight')
8+
9+
Tenant.find_each do |tenant|
10+
SiteSetting.create!(setting:, value: '', provider: tenant.name) unless SiteSetting.exists?(setting:, provider: tenant.name)
11+
end
12+
end
13+
14+
def down
15+
Tenant.find_each do |tenant|
16+
SiteSetting.find_by(setting: Setting.find_by(name: 'Maintenance'), provider: tenant.name)&.destroy
17+
end
18+
19+
SiteSetting.find_by(setting: Setting.find_by(name: 'Maintenance'), provider: 'greenlight')&.destroy
20+
21+
Setting.find_by(name: 'AllowedDomains')&.destroy
22+
end
23+
end

db/data_schema.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
DataMigrate::Data.define(version: 20240806205559)
1+
DataMigrate::Data.define(version: 20240812210436)

db/schema.rb

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/controllers/admin/tenants_controller_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def create_settings_permissions_meetingoptions
146146
Setting.find_or_create_by(name: 'HelpCenter')
147147
Setting.find_or_create_by(name: 'Maintenance')
148148
Setting.find_or_create_by(name: 'SessionTimeout')
149-
Setting.find_or_create_by(name: 'SpecificEmailDomainSignUp')
149+
Setting.find_or_create_by(name: 'AllowedDomains')
150150

151151
Permission.find_or_create_by(name: 'CreateRoom')
152152
Permission.find_or_create_by(name: 'ManageUsers')

spec/controllers/external_controller_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,11 +337,11 @@
337337
end
338338
end
339339

340-
context 'Specific Email Domain Signup' do
340+
context 'Allowed Domains' do
341341
context 'restricted domain not set' do
342342
before do
343343
site_settings = instance_double(SettingGetter)
344-
allow(SettingGetter).to receive(:new).with(setting_name: 'SpecificEmailDomainSignUp', provider: 'greenlight').and_return(site_settings)
344+
allow(SettingGetter).to receive(:new).with(setting_name: 'AllowedDomains', provider: 'greenlight').and_return(site_settings)
345345
allow(site_settings).to receive(:call).and_return('')
346346
end
347347

@@ -355,7 +355,7 @@
355355
context 'restricted domain set to 1 domain' do
356356
before do
357357
site_settings = instance_double(SettingGetter)
358-
allow(SettingGetter).to receive(:new).with(setting_name: 'SpecificEmailDomainSignUp', provider: 'greenlight').and_return(site_settings)
358+
allow(SettingGetter).to receive(:new).with(setting_name: 'AllowedDomains', provider: 'greenlight').and_return(site_settings)
359359
allow(site_settings).to receive(:call).and_return('@domain.com')
360360
end
361361

@@ -376,7 +376,7 @@
376376
context 'restricted domain set to multiple domain' do
377377
before do
378378
site_settings = instance_double(SettingGetter)
379-
allow(SettingGetter).to receive(:new).with(setting_name: 'SpecificEmailDomainSignUp', provider: 'greenlight').and_return(site_settings)
379+
allow(SettingGetter).to receive(:new).with(setting_name: 'AllowedDomains', provider: 'greenlight').and_return(site_settings)
380380
allow(site_settings).to receive(:call).and_return('@example.com,@test.com,@domain.com')
381381
end
382382

spec/controllers/users_controller_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,11 @@
302302
end
303303
end
304304

305-
context 'Specific Email Domain Signup' do
305+
context 'Allowed Domains' do
306306
context 'restricted domain not set' do
307307
before do
308308
site_settings = instance_double(SettingGetter)
309-
allow(SettingGetter).to receive(:new).with(setting_name: 'SpecificEmailDomainSignUp', provider: 'greenlight').and_return(site_settings)
309+
allow(SettingGetter).to receive(:new).with(setting_name: 'AllowedDomains', provider: 'greenlight').and_return(site_settings)
310310
allow(site_settings).to receive(:call).and_return('')
311311
end
312312

@@ -318,7 +318,7 @@
318318
context 'restricted domain set to 1 domain' do
319319
before do
320320
site_settings = instance_double(SettingGetter)
321-
allow(SettingGetter).to receive(:new).with(setting_name: 'SpecificEmailDomainSignUp', provider: 'greenlight').and_return(site_settings)
321+
allow(SettingGetter).to receive(:new).with(setting_name: 'AllowedDomains', provider: 'greenlight').and_return(site_settings)
322322
allow(site_settings).to receive(:call).and_return('@domain.com')
323323
end
324324

@@ -336,7 +336,7 @@
336336
context 'restricted domain set to multiple domain' do
337337
before do
338338
site_settings = instance_double(SettingGetter)
339-
allow(SettingGetter).to receive(:new).with(setting_name: 'SpecificEmailDomainSignUp', provider: 'greenlight').and_return(site_settings)
339+
allow(SettingGetter).to receive(:new).with(setting_name: 'AllowedDomains', provider: 'greenlight').and_return(site_settings)
340340
allow(site_settings).to receive(:call).and_return('@example.com,@test.com,@domain.com')
341341
end
342342

0 commit comments

Comments
 (0)